summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java b/src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java
new file mode 100644
index 00000000..a1c8a8de
--- /dev/null
+++ b/src/test/java/org/luxons/sevenwonders/game/effects/RawPointsIncreaseTest.java
@@ -0,0 +1,61 @@
+package org.luxons.sevenwonders.game.effects;
+
+import org.junit.experimental.theories.DataPoints;
+import org.junit.experimental.theories.Theories;
+import org.junit.experimental.theories.Theory;
+import org.junit.runner.RunWith;
+import org.luxons.sevenwonders.game.api.Table;
+import org.luxons.sevenwonders.game.test.TestUtils;
+
+import static org.junit.Assert.*;
+
+@RunWith(Theories.class)
+public class RawPointsIncreaseTest {
+
+ @DataPoints
+ public static int[] points() {
+ return new int[] {0, 1, 2, 3, 5};
+ }
+
+ @Theory
+ public void computePoints_equalsNbOfPoints(int points) {
+ RawPointsIncrease rawPointsIncrease = new RawPointsIncrease(points);
+ Table table = TestUtils.createTable(5);
+ assertEquals(points, rawPointsIncrease.computePoints(table, 0));
+ }
+
+ @Theory
+ public void equals_falseWhenNull(int points) {
+ RawPointsIncrease rawPointsIncrease = new RawPointsIncrease(points);
+ //noinspection ObjectEqualsNull
+ assertFalse(rawPointsIncrease.equals(null));
+ }
+
+ @Theory
+ public void equals_falseWhenDifferentClass(int points) {
+ RawPointsIncrease rawPointsIncrease = new RawPointsIncrease(points);
+ GoldIncrease goldIncrease = new GoldIncrease(points);
+ //noinspection EqualsBetweenInconvertibleTypes
+ assertFalse(rawPointsIncrease.equals(goldIncrease));
+ }
+
+ @Theory
+ public void equals_trueWhenSame(int points) {
+ RawPointsIncrease rawPointsIncrease = new RawPointsIncrease(points);
+ assertEquals(rawPointsIncrease, rawPointsIncrease);
+ }
+
+ @Theory
+ public void equals_trueWhenSameContent(int points) {
+ RawPointsIncrease rawPointsIncrease1 = new RawPointsIncrease(points);
+ RawPointsIncrease rawPointsIncrease2 = new RawPointsIncrease(points);
+ assertTrue(rawPointsIncrease1.equals(rawPointsIncrease2));
+ }
+
+ @Theory
+ public void hashCode_sameWhenSameContent(int points) {
+ RawPointsIncrease rawPointsIncrease1 = new RawPointsIncrease(points);
+ RawPointsIncrease rawPointsIncrease2 = new RawPointsIncrease(points);
+ assertEquals(rawPointsIncrease1.hashCode(), rawPointsIncrease2.hashCode());
+ }
+} \ No newline at end of file
bgstack15