Snippets tagged “junit-5”
3 snippets use this tag.
- Difference between @Mock and @InjectMocksJava
In the context of testing with the Mockito framework, the @Mock annotation is used to create a mock object of a class or interface, and the @InjectMocks annotation is used to inject the mock objects into a test class.
- How to test that no exception is thrown?Java
To test that no exception is thrown in a Java method, you can use the assertDoesNotThrow method from the org.junit.jupiter.api.Assertions class (part of the JUnit 5 library).
- JUnit 5: How to assert an exception is thrown?Java
To read a text file in Java, you can use the BufferedReader class from the java.io package.