AuthenticationUtil { public static String encryptPassword(String userId, String password) { PasswordEncryptor passwordEncryptor = SystemRepository.get(PASSWORD_ENCRYPTOR); return passwordEncryptor.encrypt(userId, password); } private  AuthenticationUtil(); static String encryptPassword(String userId, String password); static void authenticate(String userId, String password);  }
@Test public void testEncryptPassword() { MockPasswordEncryptor sut = SystemRepository.get("passwordEncryptor"); sut.called(1); sut.calledWith("salt", "password"); AuthenticationUtil.encryptPassword("salt", "password"); sut.verify("1度だけ呼び出され、引数がそのままpasswordEncryptorに渡されていること。"); }