Symbol { public boolean equals(Symbol newSymbol) { return (getSymbolString().equals(newSymbol.getSymbolString())) && (getType() == newSymbol.getType()); } Symbol();  Symbol(String newString, Enums.SymbolType newType);  Symbol(Symbol copy); void setType(Enums.SymbolType newType); Enums.SymbolType getType(); String getSymbolString(); void setSymbolString(String s); boolean equals(Symbol newSymbol); boolean equals(String newSymbol); void clear(); @Override String toString();  }
@Test public void testEquals_Symbol() { System.out.println("* SymbolTest: equals"); Symbol newSymbol = new Symbol("test2", Enums.SymbolType.NTSymbol); Symbol instance = new Symbol("test", Enums.SymbolType.NTSymbol); boolean expResult = false; boolean result = instance.equals(newSymbol); assertEquals(expResult, result); newSymbol = new Symbol("test", Enums.SymbolType.TSymbol); expResult = false; assertEquals(expResult, instance.equals(newSymbol)); newSymbol = new Symbol("test2", Enums.SymbolType.TSymbol); expResult = false; assertEquals(expResult, instance.equals(newSymbol)); newSymbol = new Symbol("test", Enums.SymbolType.NTSymbol); expResult = true; assertEquals(expResult, instance.equals(newSymbol)); newSymbol = null; expResult = false; try { result = instance.equals(newSymbol); } catch (NullPointerException e) { assertTrue(true); } assertEquals(expResult, result); }
@Test public void testEquals_String() { System.out.println("* SymbolTest: equals"); Symbol instance = new Symbol("test2", Enums.SymbolType.TSymbol); assertEquals(false, instance.equals("test")); assertEquals(true, instance.equals("test2")); }