Created
October 14, 2023 22:03
-
-
Save igorstojanovski/ecda08b1bfcd34dec9d898fe114e79e3 to your computer and use it in GitHub Desktop.
Sample Junit 5 test with a Mockito Extension
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
@ExtendWith(MockitoExtension.class) | |
class PersonTest { | |
@Mock | |
PinProvider pinProvider; | |
@Test | |
public void shouldCreatePersonWithCorrectPin() { | |
String samplePin = "samplePin"; | |
when(pinProvider.getPin()).thenReturn(samplePin); | |
Person person = new Person("Star", "Lord", pinProvider); | |
assertThat(person.getPin()).isEqualTo(samplePin); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment