I have implemented controller test (using spring web testing framework).
mvc.perform(MockMvcRequestBuilders.post("/calendar").contentType(V1_0)
.content(toJSON(createCalendarDto(expectedCalendar))))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(V1_0))
.andExpect(jsonPath("$.id", is(notNullValue())))
//...
.andExpect(jsonPath("$.email", is(expectedCalendar.getEmail())));
this test covers some important cases, checking json structure and field values.
Test works correctly, sonar prints a message:
Tests should include assertions. Code smell Critical squid:S2699
I could use workaround like @SuppressWarnings("squid:S2699")
but I hope it can be managed in better way.
java 1.8 Sonarcube Version 6.3.1 Spring-boot 1.4.3
You've found a false positive in a rule. Specifically, your test framework is not taken into account by the rule.
The best course for rule false positives in general is to open a thread on the SonarQube Google Group saying, essentially, "For language L, could you add case X to rule Y, please?". Don't forget to include a minimum code sample to reproduce the false positive.
Update It's a Discourse instance now: https://community.sonarsource.com/