| Author |
JUnit testing void methods
|
Mark Miranda
Greenhorn
Joined: Feb 25, 2011
Posts: 24
|
|
Hello,
How can I write JUnit test cases for the Class below?
I put something together quickly, but that's basically the skeleton for the program i'm going to write...
I'm still fairly new to JUnit
|
 |
Pawel Piwowar
Greenhorn
Joined: Feb 12, 2010
Posts: 21
|
|
Hello,
Your findCar() method must return something, should not be void.
Since you fix this, the class could be tested with code like that:
You can create similar tests for other methods.
Repeating code, like creating new instance of ParkingLot could be moved to separate method annotated with @Before
|
SCJP 5, SCWCD 1.4, SCBCD 5, SCEA part1
|
 |
 |
|
|
subject: JUnit testing void methods
|
|
|