Created
September 3, 2018 15:11
-
-
Save Romeh/eb676c3ca8741e3de8892c5759a70e60 to your computer and use it in GitHub Desktop.
This file contains hidden or 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) | |
@DisplayName("Spring boot 2 mockito2 Junit5 example") | |
public class ShowServiceTests { | |
private static final String MOCK_OUTPUT = "Mocked show label"; | |
@Mock | |
private TextService textService; | |
@InjectMocks | |
private ShowService showService; | |
@BeforeEach | |
void setMockOutput() { | |
when(textService.getText()).thenReturn(MOCK_OUTPUT); | |
} | |
@Test | |
@DisplayName("Mock the output of the text service using mockito") | |
public void contextLoads() { | |
assertEquals(showService.getShowLable(), MOCK_OUTPUT); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment