From 78e7933c0af1d11d9476c5ee213c64ad87066f55 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 22 Dec 2012 19:33:23 +0100 Subject: o First badge: UNBREAKABLE. --- .../core/badge/UnbreakableBadgeProgressTest.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/test/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgressTest.java (limited to 'src/test/java') diff --git a/src/test/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgressTest.java b/src/test/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgressTest.java new file mode 100644 index 0000000..42ca98d --- /dev/null +++ b/src/test/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgressTest.java @@ -0,0 +1,42 @@ +package io.trygvis.esper.testing.core.badge; + +import fj.*; +import fj.data.*; +import io.trygvis.esper.testing.core.db.*; +import junit.framework.*; +import org.joda.time.*; + +import java.util.*; +import java.util.List; + +import static java.util.UUID.*; + +public class UnbreakableBadgeProgressTest extends TestCase { + UUID uuid = randomUUID(); + + public void testBadge() { + BuildDto build = new BuildDto(uuid, new DateTime(), new DateTime(), true, null); + + UUID person = randomUUID(); + + UnbreakableBadgeProgress p = UnbreakableBadgeProgress.initial(person); + + List badges = new ArrayList<>(); + + for (int i = 0; i < 55; i++) { + P2> p2 = p.onBuild(build); + + if (p2._2().isSome()) { + badges.add(p2._2().some()); + } + + p = p2._1(); + } + + assertEquals(5, p.count); + assertEquals(3, badges.size()); + assertEquals(1, badges.get(0).level); + assertEquals(2, badges.get(1).level); + assertEquals(3, badges.get(2).level); + } +} -- cgit v1.2.3