No meu controller não estou usando explicitamente o Results.
Como testar ?
Controller
@Path("/categorias")
public List<Categoria> listCategorias() {
return this.categorias.findCategorias();
}
Teste
@Test
public void testListCategorias() {
MockResult result = new MockResult();
CategoriaController controller = new CategoriaController(database);
controller.listCategorias();
List<Categoria> categorias = result.included("categoriaList");
assertThat(categorias, notNullValue());
}
java.lang.AssertionError:
Expected: not null
but: was null
[]s