@Test
  public void testDoSendFailsWithInvalidTime() throws Exception {
    IntegrationDefinition integrationDefinition =
        new IntegrationDefinition("test", providerService, consumerSystem, 5000, true, null, null);

    EgovWebService service = new EgovWebService("test", 5000, integrationDefinition, echoClient);

    Calendar from = Calendar.getInstance();
    from.add(Calendar.YEAR, 1);
    Calendar to = Calendar.getInstance();
    to.add(Calendar.YEAR, -1);

    // from
    integrationDefinition.setValidateFrom(from);
    integrationDefinition.setValidateTo(null);

    EgovIntegrationMessage requestMessage = service.createRequestMessage();
    EgovIntegrationMessage responseMessage = service.doSend(requestMessage);

    assertNotNull(responseMessage);
    assertNotNull(responseMessage.getHeader());
    assertEquals(ResultCode.INVALID_TIME, responseMessage.getHeader().getResultCode());

    // to
    integrationDefinition.setValidateFrom(null);
    integrationDefinition.setValidateTo(to);

    requestMessage = service.createRequestMessage();
    responseMessage = service.doSend(requestMessage);

    assertNotNull(responseMessage);
    assertNotNull(responseMessage.getHeader());
    assertEquals(ResultCode.INVALID_TIME, responseMessage.getHeader().getResultCode());
  }
  @Test
  public void testCreateRequestMessageSucceeds() throws Exception {
    EgovWebService service = new EgovWebService("test", 5000, integrationDefinition, echoClient);

    EgovIntegrationMessage requestMessage = service.createRequestMessage();

    assertNotNull(requestMessage);
    assertNotNull(requestMessage.getHeader());
    EgovIntegrationMessageHeader header = requestMessage.getHeader();
    assertEquals(integrationDefinition.getId(), header.getIntegrationId());
    assertEquals(providerOrganization.getId(), header.getProviderOrganizationId());
    assertEquals(providerSystem.getId(), header.getProviderSystemId());
    assertEquals(providerService.getId(), header.getProviderServiceId());
    assertEquals(consumerOrganization.getId(), header.getConsumerOrganizationId());
    assertEquals(consumerSystem.getId(), header.getConsumerSystemId());
    assertNotNull(requestMessage.getBody());
    assertEquals(0, requestMessage.getBody().size());
  }