title: Mockito mock doesn't work properly
body: <p>I have the following test method:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class AccountManagerTest {
  
      @InjectMocks
      private AccountManager accountManager = new AccountManagerImpl(null);
  
      @Mock
      private AuthStorage authStorage;
  
      @Before
      public void setup() {
          MockitoAnnotations.initMocks(this);
      }
  
      /* REGISTER TESTS */
  
      @Test
      public void test_whenRegister_withAlreadyExistingEmail_thenDoNotRegister() throws AuthStorageException {
          String email = "foo@bar.com";
          String name = "Foo";
          String password = "123456";
          String password2 = "123456";
  
          doThrow(new AuthStorageException("Email already in use")).when(authStorage).registerNewUser(Matchers.any());
          assertFalse(accountManager.register(email, name, password, password2));
      }
  }
  </code></pre>
  
  <p>that tests the following class method:</p>
  
  <pre><code>@Override
      public Boolean register(String email, String name, String password, String password2) {
          if (password.equals(password2)) {
              try {
                  String pwd = hashPassword(password);
                  User user = new User(email, name, pwd);
                  AuthStorage authStorage = new AuthStorageImpl();
                  authStorage.registerNewUser(user);
                  return true;
              } catch (NoSuchAlgorithmException | AuthStorageException e) {
                  return false;
              }
          }
          // If passwords don't match
          return false;
      }
  </code></pre>
  
  <p>Supposedly, when calling <code>registerNewUser</code> it should thow an exception and then the method would return <code>false</code>, but when debugging I see that the exception isn't thrown and the program returns <code>true</code>. What am I doing wrong?</p>