I have this JUnit4 code which I want to migrate:
@Test(expected = Test.None.class)
public void test() {
.....
}
I tried to migrate this code to Junit5 this way:
import static org.junit.jupiter.api.Assertions;
Assertions.assertDoesNotThrow(ExceptionNotToThrow.class, () -> {
.....
});
But I get:
Cannot resolve method 'assertDoesNotThrow(Class<ExceptionNotToThrow>, <lambda expression>)'
Do you know how I can migrate this code properly?
Just use assertDoesNotThrow
without exception class:
@Test
void checkCodeDoesNotThrowAnyException() {
Assertions.assertDoesNotThrow(() -> {
//do something
});
}