コード例 #1
0
  @Test
  public void shouldAddTheDefaultTimestampValueOfZeroWhenTheLastAuditIsNull()
      throws URISyntaxException {
    String pollingUrl = "www.localhost.com/form";

    when(auditService.getLastAudit()).thenReturn(Audit.DEFAULT);
    when(configuration.getPollingUrl()).thenReturn(pollingUrl);
    when(configuration.getPollingUrlUsername()).thenReturn("admin");
    when(configuration.getPollingUrlPassword()).thenReturn("password");
    when(formService.save(any())).thenReturn(newArrayList());

    jobScheduler.process();

    verify(httpClient).call(new URI("www.localhost.com/form?timestamp=0"), "admin", "password");
  }
コード例 #2
0
  @Test
  public void shouldReplaceTheLastTimestampFromTheLastAuditBeforePolling()
      throws URISyntaxException {
    Audit lastPolledAudit = new Audit(420L, 100L, 100L);
    String pollingUrl = "www.localhost.com/form?timestamp=0";

    when(auditService.getLastAudit()).thenReturn(lastPolledAudit);
    when(configuration.getPollingUrl()).thenReturn(pollingUrl);
    when(configuration.getPollingUrlUsername()).thenReturn("admin");
    when(configuration.getPollingUrlPassword()).thenReturn("password");
    when(formService.save(any())).thenReturn(newArrayList());

    jobScheduler.process();

    verify(httpClient).call(new URI("www.localhost.com/form?timestamp=420"), "admin", "password");
  }