title: Mocking String.valueof()
body: <p>I'm testing my spring controller and trying to do the following</p>
  
  <p>Controller</p>
  
  <pre><code>Authentication authentication = SecurityContextHolder.getContext()
              .getAuthentication();
      String role = String.valueOf(authentication.getAuthorities());
      if(role.contains("user")) {
          ...
      }
  </code></pre>
  
  <p>Test</p>
  
  <pre><code>@Test
  public void testLoginUser() throws Exception {
      User user = new User();
      user.setLogin("user");
      user.setRoleid(1L);
      SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(user,user));
      when(String.valueOf(Collection.class)).thenReturn("user");
  </code></pre>
  
  <p>But I get </p>
  
  <pre><code>org.mockito.exceptions.misusing.MissingMethodInvocationException
  </code></pre>
  
  <p>I need my <code>if</code> block to be <code>true</code> and execute.<br>
  Is there any way it can be done?</p>