コード例 #1
0
  @Override
  public AbstractModule getModule() throws IOException {
    when(proxyRepo.exists(any(MailAddress.class)))
        .thenAnswer(
            invocationOnMock -> {
              MailAddress passedAddress = (MailAddress) invocationOnMock.getArguments()[0];
              return (USER_IN_USE + "@forward.cat").equals(passedAddress.toString());
            });

    return new AbstractModule() {
      @Override
      protected void configure() {
        bind(ProxyRepository.class).toInstance(proxyRepo);
      }
    };
  }
コード例 #2
0
 @Test(expected = RuntimeException.class)
 public void redisConnectionError_sendInvalidUsername() throws Exception {
   when(proxyRepo.exists(any(MailAddress.class))).thenThrow(new RuntimeException());
   Result route = route(request(USER_NOT_IN_USE));
   assertThatIsInvalid(route);
 }