Reputation: 2269
I have added a test case in my Spring Boot application. However, when I ./gradlew build
, all the test cases pass. Any reason?
@Test
public void testIntentionalError() throws Exception {
boolean thrown = true;
assertThat(!thrown);
}
Upvotes: 2
Views: 778
Reputation: 1712
you can try something like the following (in case you want to use the assertThat method):
@Test
public void testIntentionalError() throws Exception {
boolean thrown = true;
assertThat(!thrown, is(true));
}
using hamcrest matcher (import static org.hamcrest.core.Is.is)
Upvotes: 1
Reputation: 1463
It's because your test doesn't test anything.
Try this :
@Test
public void testIntentionalError() throws Exception {
boolean thrown = true;
assertTrue(!thrown);
}
Upvotes: 4