コード例 #1
0
  @Test
  public void test_run_temporary_blocks_already_denied() throws Exception {
    when(accessControlListDao.getTemporaryBlocks(now.minusDays(30)))
        .thenReturn(Arrays.asList(createBlockEvents(IPV4_PREFIX, 20)));
    when(ipResourceConfiguration.isDenied(any(InetAddress.class))).thenReturn(true);

    subject.run();

    verify(ipResourceConfiguration).isDenied(any(InetAddress.class));
    verify(accessControlListDao, never())
        .savePermanentBlock(anyString(), any(LocalDate.class), anyInt(), anyString());
  }
コード例 #2
0
 @Before
 public void setUp() throws Exception {
   now = new LocalDate();
   when(dateTimeProvider.getCurrentDate()).thenReturn(now);
   when(ipResourceConfiguration.getLimit(any(InetAddress.class))).thenReturn(QUERY_LIMIT);
 }