### Question:
WeightedSum extends TestFitnessFunction { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (this == obj) { return true; } return getClass() == obj.getClass(); } WeightedSum(StackTrace crash); void setFitnessCalculator(CrashCoverageFitnessCalculator fitnessCalculator); @Override double getFitness(TestChromosome testChromosome, ExecutionResult executionResult); @Override int compareTo(TestFitnessFunction other); @Override int hashCode(); @Override boolean equals(Object obj); @Override String getTargetClass(); @Override String getTargetMethod();  }### Answer:
@Test public void testEqual() throws FileNotFoundException { assertFalse(weightedSum.equals(null)); BufferedReader givenStackTrace = new BufferedReader(new StringReader("java.lang.IllegalArgumentException:\n" + "\tat eu.stamp.ClassA.method2(ClassA.java:10)\n" + "\tat eu.stamp.ClassB.method1(ClassB.java:20)")); StackTrace target = Mockito.spy(new StackTrace()); Mockito.doReturn(givenStackTrace).when(target).readFromFile(anyString()); target.setup("", 2); WeightedSum ws = new WeightedSum(target); assertTrue(weightedSum.equals(ws)); WeakMutationSuiteFitness fitnessFunction = new WeakMutationSuiteFitness(); assertFalse(weightedSum.equals(fitnessFunction)); }