Podarilo sa niekomu uspesne spojazdnit tie JUnit testy pre ParserImpl? Skusil som taketo nieco:
@Test
public void testGetCommand() {
/*List<String> listOfKnownCommands = Arrays.asList("SEVER", "juh",
" VYCHOD", "zapad ", "rozhliadni SA", "inVENtar", "KONIEC",
"VEZMI", "POLOZ", "POUZI", "PRESKUMAJ", "PRIKAZY", "NAHRAJ",
"ULOZ", "VERZIA", "RESTART" );*/
System.out.println("getCommand");
String arg0 = "SEVER";
ParserImpl instance = new ParserImpl();
//Command expResult = null;
Command result = instance.getCommand(arg0);
assertEquals(new North(), result);
// TODO review the generated test code and remove the default call to fail.
//fail("The test case is a prototype.");
}
Ale po spusteni test failne:
Testcase: testGetCommand(commands.ParserImplTest): FAILED
expected:<commands.North@1ca4eb4> but was:<commands.North@f522e8>
junit.framework.AssertionFailedError: expected:<commands.North@1ca4eb4> but was:<commands.North@f522e8>
at commands.ParserImplTest.testGetCommand(ParserImplTest.java:58)
Cize ak tomu spravne rozumiem, mam 2 instancie North, lenze ta prva ma ako keby ine ID?