Learning Points - n89sharma/AxisAllies GitHub Wiki
Following test was passing when unit was annotated with @Data
.
Unit subA = buildUnitOfNation(TANK, GERMANY);
Unit subB = buildUnitOfNation(TANK, GERMANY);
assertThat(subA).isNotEqualTo(subB);
Only run one test usign -Dtest=<TestClassName>
argument.
Check here.
Circular references with lombok would fail when toString()
(or hashing function is invoked) like the system print line in this case. Lombok will fail on recursion. Use exclude
tag. See here.
@Test
public void stackOverflowTest2() {
Node nodeA = new Node();
Node nodeB = new Node();
nodeA.setNextNode(nodeB);
nodeB.setNextNode(nodeA);
// System.out.println(nodeA);
assertTrue(nodeA.getNextNode().equals(nodeB));
}
@Data
private class Node {
private Node nextNode;
}
Stack overflow why?:
Territory A = territoryMap.get("A");
Territory B = territoryMap.get("B");
Territory C = territoryMap.get("C");
List<Territory> BC = new ArrayList<>();
BC.add(B);
BC.add(C);
List<Territory> AC = new ArrayList<>();
AC.add(A);
AC.add(C);
List<Territory> AB = new ArrayList<>();
AB.add(A);
AB.add(B);
A.setNeighbours(BC);
B.setNeighbours(AC);
C.setNeighbours(AB);
ArrayList<String> list = new ArrayList<String>() {{
add("A");
add("B");
add("C");
}};