title: Mockito when().thenReturn() Returning Null when it should return empty list
body: <p>I've been trying to figure out why my mocked findIngredientsByCategory method is returning null when I have <code>when(controller.findIngredientsByCategory(any()).thenReturn(Collections.emptyList())</code>. This implementation works for the findAll method works.</p>
  
  <p>Below is my implementation for my unit test:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @WebMvcTest(IngredientController.class)
  @ContextConfiguration(classes = {TestContext.class, WebApplicationContext.class})
  @WebAppConfiguration
  public class IngredientControllerTest {
  
    @Autowired
    private WebApplicationContext context;
  
    @Autowired
    private MockMvc mvc;
  
    @MockBean
    private IngredientController ingredientController;
  
    @Before
    public void setup() {
      MockitoAnnotations.initMocks(this);
      mvc = MockMvcBuilders.webAppContextSetup(context).build();
    }
  
    @Autowired
    private ObjectMapper mapper;
  
    private static class Behavior {
      IngredientController ingredientController;
  
      public static Behavior set(IngredientController ingredientController) {
        Behavior behavior = new Behavior();
        behavior.ingredientController = ingredientController;
        return behavior;
      }
  
      public Behavior hasNoIngredients() {
        when(ingredientController.getAllIngredients()).thenReturn(Collections.emptyList());
        when(ingredientController.getIngredientsByCategory(any())).thenReturn(Collections.emptyList());
        when(ingredientController.getIngredientById(anyString())).thenReturn(Optional.empty());
        return this;
      }
    }
  
    @Test
    public void getIngredientsByCategoryNoIngredients() throws Exception {
      Behavior.set(ingredientController).hasNoIngredients();
      MvcResult result = mvc.perform(get("/ingredients/filter=meat"))
          .andExpect(status().isOk())
          .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
          .andReturn();
      String content = result.getResponse().getContentAsString();
      System.out.println(content);
   }
  </code></pre>
  
  <p>And below is the implementation for the controller:</p>
  
  <pre><code>@RestController
  @RequestMapping("/ingredients")
  public class IngredientController {
  
    @Autowired
    private IngredientRepository repository;
  
    @RequestMapping(value = "/filter", method = RequestMethod.GET)
    public List getIngredientsByCategory(@RequestParam("category") String category) {
      return repository.findByCategory(category);
    }
  }
  </code></pre>
  
  <p>I'm not sure why the mock controller is returning null with this request, when I tell it to return an empty list. If someone could please help with this I would greatly appreciate it! Thanks.</p>