コード例 #1
0
  private void givenRequestBody(String user, String pass) {
    expectedUser = user;
    expectedPass = pass;
    String body = String.format("user=%s&pass=%s", user, pass);

    Mockito.when(mockRequestContext.getRequestBody())
        .thenReturn(new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)));
  }
コード例 #2
0
 private void givenUserLogIn() {
   Mockito.when(mockRequestContext.getPrincipal()).thenReturn("username");
 }