Created
August 30, 2011 17:02
-
-
Save outdooricon/1181365 to your computer and use it in GitHub Desktop.
example of testing an abstract class with Mockito
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Abstract Class We Are Testing | |
public Abstract class Car { | |
public String getDescription(String color) { | |
return "sleek "+color+" car"; | |
}; | |
} | |
// Test Contained in Separate Class Below | |
Car blueCar = mock(Car.class); | |
given(blueCar.getDescription(anyString())).willCallRealMethod(); | |
assertThat(blueCar.getDescription("blue"), contains("blue")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment