A test case without assertions ensures only that no exceptions are thrown. Beyond basic runnability, it ensures nothing about the behavior of the code under test.
This rule raises an exception when no assertions from any of the following frameworks are found in a test:
org.springframework.test.web.servlet.ResultActions.andExpect()
@Test
public void testDoSomething() { // Noncompliant
MyClass myClass = new MyClass();
myClass.doSomething();
}
@Test
public void testDoSomething() {
MyClass myClass = new MyClass();
assertNull(myClass.doSomething()); // JUnit assertion
assertThat(myClass.doSomething()).isNull(); // Fest assertion
}