Esempio n. 1
0
  @Test
  public void deleteProxy() {
    when(aclServiceDao.getProxy(IpInterval.parse("10.0.0.0/32")))
        .thenReturn(new Proxy("10.0.0.0/32", ""));

    final Response response = subject.deleteProxy("10.0.0.0/32");
    assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));

    verify(aclServiceDao).deleteProxy(IpInterval.parse("10.0.0.0/32"));
  }
Esempio n. 2
0
  @Test
  public void deleteProxy_unknown() {
    when(aclServiceDao.getProxy(IpInterval.parse("10.0.0.0/32")))
        .thenThrow(EmptyResultDataAccessException.class);

    final Response response = subject.deleteProxy("10.0.0.0/32");
    assertThat(response.getStatus(), is(Response.Status.NOT_FOUND.getStatusCode()));

    verify(aclServiceDao, never()).deleteProxy(Matchers.any(IpInterval.class));
  }