summaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2016-12-20 23:01:23 +0100
committerjbion <joffrey.bion@amadeus.com>2016-12-21 01:29:28 +0100
commit803ecd6740c5cb0d911d52edab99177f31bd42b6 (patch)
treeb1240c9396617e96de5ee3174dc10bcc9378f309 /src/main/java/org
parentAdd test for ScienceProgressSerializer (diff)
downloadseven-wonders-803ecd6740c5cb0d911d52edab99177f31bd42b6.tar.gz
seven-wonders-803ecd6740c5cb0d911d52edab99177f31bd42b6.tar.bz2
seven-wonders-803ecd6740c5cb0d911d52edab99177f31bd42b6.zip
Add test for Resources serializers
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/resources/Resources.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java b/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java
index 5f7e2606..d3f6de94 100644
--- a/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java
+++ b/src/main/java/org/luxons/sevenwonders/game/resources/Resources.java
@@ -3,6 +3,7 @@ package org.luxons.sevenwonders.game.resources;
import java.util.EnumMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
public class Resources {
@@ -44,4 +45,21 @@ public class Resources {
public boolean isEmpty() {
return quantities.values().stream().reduce(0, Integer::sum) == 0;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Resources resources = (Resources)o;
+ return Objects.equals(quantities, resources.quantities);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(quantities);
+ }
}
bgstack15