fix: fixed sonarqube-reported bugs in JSON and EventBuilderTest
This commit is contained in:
parent
32cbb6d876
commit
672e5e7727
src
main/java/uulm/teamname/marvelous/gamelibrary/json
test/java/uulm/teamname/marvelous/gamelibrary/events
@ -32,7 +32,7 @@ public class JSON {
|
||||
try {
|
||||
return Optional.of(mapper.readValue(input, BasicMessage.class));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@ -46,7 +46,7 @@ public class JSON {
|
||||
try {
|
||||
return Optional.of(mapper.writeValueAsString(input));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ class EventBuilderTest {
|
||||
roundSetupEventBaseline.characterOrder = turns;
|
||||
|
||||
assertThat(roundSetupEvent)
|
||||
.isEqualTo(roundSetupEventBaseline)
|
||||
.withFailMessage("RoundSetupEvent built improperly");
|
||||
.withFailMessage("RoundSetupEvent built improperly")
|
||||
.isEqualTo(roundSetupEventBaseline);
|
||||
|
||||
var turnEvent = new EventBuilder(EventType.TurnEvent)
|
||||
.withNextCharacter(turn)
|
||||
@ -153,8 +153,8 @@ class EventBuilderTest {
|
||||
turnEventBaseline.turnCount = 5;
|
||||
|
||||
assertThat(turnEvent)
|
||||
.isEqualTo(turnEventBaseline)
|
||||
.withFailMessage("TurnEvent was built improperly");
|
||||
.withFailMessage("TurnEvent was built improperly")
|
||||
.isEqualTo(turnEventBaseline);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -185,8 +185,9 @@ class EventBuilderTest {
|
||||
baseline.timeLeft = -144;
|
||||
|
||||
assertThat(gameEvent)
|
||||
.isEqualTo(baseline)
|
||||
.withFailMessage("GameEvent was built improperly");
|
||||
.withFailMessage("GameEvent was built improperly")
|
||||
.isEqualTo(baseline);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -211,8 +212,9 @@ class EventBuilderTest {
|
||||
baseline.winCondition = true;
|
||||
|
||||
assertThat(gameStateEvent)
|
||||
.isEqualTo(baseline)
|
||||
.withFailMessage("GameStateEvent was built improperly");
|
||||
.withFailMessage("GameStateEvent was built improperly")
|
||||
.isEqualTo(baseline);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -268,12 +270,12 @@ class EventBuilderTest {
|
||||
assertEquals(des.targetField, des2.targetField);
|
||||
// EntityEvent des2 = new EntityEvent(eb.);
|
||||
|
||||
assertTrue(des.equals(des2));
|
||||
assertEquals(des, des2);
|
||||
assertEquals(des.hashCode(), des2.hashCode());
|
||||
|
||||
des.targetField = new IntVector2(3,3);
|
||||
|
||||
assertFalse(des.equals(des2));
|
||||
assertNotEquals(des, des2);
|
||||
assertNotEquals(des.hashCode(), des2.hashCode());
|
||||
|
||||
|
||||
@ -311,12 +313,12 @@ class EventBuilderTest {
|
||||
assertEquals(des.originEntity, des2.originEntity);
|
||||
assertEquals(des.originField, des2.originField);
|
||||
|
||||
assertTrue(des.equals(des2));
|
||||
assertEquals(des, des2);
|
||||
assertEquals(des.hashCode(), des2.hashCode());
|
||||
|
||||
des.targetField = new IntVector2(3,3);
|
||||
|
||||
assertFalse(des.equals(des2));
|
||||
assertNotEquals(des, des2);
|
||||
assertNotEquals(des.hashCode(), des2.hashCode());
|
||||
|
||||
|
||||
@ -381,14 +383,14 @@ class EventBuilderTest {
|
||||
assertEquals(des.type, des2.type);
|
||||
assertEquals(des.customContent, des2.customContent);
|
||||
|
||||
assertTrue(des.equals(des2));
|
||||
assertEquals(des, des2);
|
||||
assertEquals(des.hashCode(), des2.hashCode());
|
||||
|
||||
Object o = new Object();
|
||||
des.customContent = new HashMap<>(1, 1);
|
||||
des.customContent.put("a",o);
|
||||
|
||||
assertFalse(des.equals(des2));
|
||||
assertNotEquals(des, des2);
|
||||
assertNotEquals(des.hashCode(), des2.hashCode());
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user