That test does not actually check that exception is thrown. If no exception is thrown, assert will not be called and test will pass.
@Test
public void checkEbextensionsValidityThrowsExceptionNoDir()
throws IOException {
final ZipFile zip = Mockito.mock(ZipFile.class);
Mockito.when(zip.getEntry(".ebextensions")).thenReturn(null);
final WarFile war = new WarFile(zip);
try {
war.checkEbextensionsValidity();
} catch (final MojoFailureException exception) {
MatcherAssert.assertThat(
exception.getMessage(),
Matchers.equalTo(
".ebextensions directory does not exist in the WAR file"
)
);
}
That test does not actually check that exception is thrown. If no exception is thrown, assert will not be called and test will pass.