java - JUnit Test - Class invokes methods in other class -
i have class player has method
feedpet(pet p1, food f1){ p1.eat(f1) }
so feedpet invokes pets eat method, eat method adjusts pets hunger level.
to test need create player , food object in junit test case.
i test working simple
assertequals(p1.gethunger,3);
p1 pet object have created in player test case.
my question , doing appropriate? , testing player class correctly?
really testing if eat method pet works need check feedpet method works player well.
any thoughts or advice appreciated.
what should ideally create 2 test files -one pet class tests eat method , player class tests feedpet method.
when write
assertequals(p1.gethunger,3);
i hope hunger instance variable set under eat method of pet class, per expectation 3. if that's case on right path
Comments
Post a Comment