I am currently writing junit tests for my program.
One of my tests updated an existing product. Here`s the code:
@Test
public void testUpdate(){
Produkt p = new Produkt(1, "apple", "food", true, 2.00, false, true);
assertFalse(handler.updateProdukt(p)==0);;
}
but eclispe always says:
The operator == is undefined for the argument type(s) void, int
if I write null nothing changes…
Is there a possibility to test whether the updatedProdukt is null or not?
I really appreaciate your answer!!!
Your method is
void. It returns nothing and thus the return value cannot be used in assignments or expressions.Has nothing to do with jUnit or Eclipse.
Maybe you want something like this: