summaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2016-12-24 11:37:08 +0100
committerjbion <joffrey.bion@amadeus.com>2016-12-24 13:55:18 +0100
commit800633586ab29cf8f178a78df2542fdd7f0d7114 (patch)
tree9a580671a72e2ef5113b1ec119eaed5233652bf9 /src/test/java
parentAdd equals, hashcode, and computePoints tests for instant effects (diff)
downloadseven-wonders-800633586ab29cf8f178a78df2542fdd7f0d7114.tar.gz
seven-wonders-800633586ab29cf8f178a78df2542fdd7f0d7114.tar.bz2
seven-wonders-800633586ab29cf8f178a78df2542fdd7f0d7114.zip
Add test for RawPointsIncrease
Diffstat (limited to 'src/test/java')
-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