aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-12-22 19:33:23 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2012-12-22 19:33:23 +0100
commit78e7933c0af1d11d9476c5ee213c64ad87066f55 (patch)
treeb7d7f908bf24c5ce000dac9b6ff0dfb63c30b5ee /src/test
parentc8c863ce36f57954369a0b4a15e6c5e720f03f87 (diff)
downloadesper-testing-78e7933c0af1d11d9476c5ee213c64ad87066f55.tar.gz
esper-testing-78e7933c0af1d11d9476c5ee213c64ad87066f55.tar.bz2
esper-testing-78e7933c0af1d11d9476c5ee213c64ad87066f55.tar.xz
esper-testing-78e7933c0af1d11d9476c5ee213c64ad87066f55.zip
o First badge: UNBREAKABLE.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgressTest.java42
1 files changed, 42 insertions, 0 deletions
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<UnbreakableBadge> badges = new ArrayList<>();
+
+ for (int i = 0; i < 55; i++) {
+ P2<UnbreakableBadgeProgress, Option<UnbreakableBadge>> 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);
+ }
+}