Created
January 10, 2019 07:04
-
-
Save jieniu/23ea51e6bf55fcee495c68015438ae87 to your computer and use it in GitHub Desktop.
power mock static
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
@RunWith(PowerMockRunner.class) | |
@PrepareForTest(DriverManager.class) | |
public class Mocker { | |
@Test | |
public void testName() throws Exception { | |
//given | |
PowerMockito.mockStatic(DriverManager.class); | |
BDDMockito.given(DriverManager.getConnection(...)).willReturn(...); | |
//when | |
sut.execute(); | |
//then | |
PowerMockito.verifyStatic(); | |
DriverManager.getConnection(...); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment