コード例 #1
0
  @Test
  public void testFlexOffer() {
    try {
      FlexOffer flexOffer = buildFlexOffer();
      controller.action(flexOffer, null);

      Mockito.verify(corePlanboardValidatorService, Mockito.times(1))
          .validateTimezone(Matchers.eq(flexOffer.getTimeZone()));
      Mockito.verify(corePlanboardValidatorService, Mockito.times(1))
          .validateCurrency(Matchers.eq(flexOffer.getCurrency()));
      Mockito.verify(corePlanboardValidatorService, Mockito.times(1))
          .validatePTUDuration(Matchers.eq(flexOffer.getPTUDuration()));

      Mockito.verify(corePlanboardBusinessService, Mockito.times(1))
          .storeFlexOffer(
              Matchers.eq(flexOffer.getMessageMetadata().getSenderDomain()), Matchers.eq(flexOffer),
              Matchers.eq(DocumentStatus.ACCEPTED),
                  Matchers.eq(flexOffer.getMessageMetadata().getSenderDomain()));

      Mockito.verify(jmsService, Mockito.times(1))
          .sendMessageToOutQueue(Matchers.contains("Accepted"));
    } catch (BusinessException e) {
      fail(e.getMessage());
    }
  }
コード例 #2
0
  private FlexOffer buildFlexOffer() {
    FlexOffer request = new FlexOffer();
    request.setTimeZone("Europe/Amsterdam");
    request.setPTUDuration(Period.minutes(15));
    request.setCurrency("EUR");
    request.setMessageMetadata(MessageMetadataBuilder.buildDefault());
    request.setCongestionPoint("agr.usef-example.com");

    return request;
  }