Example #1
0
 @Test
 public void testIsShowToCustomer() {
   OfferteOptionDto option = new OfferteOptionDto();
   option.setKey(TranslationKey.ADR_MINIMUM);
   Assert.assertFalse(quotationUtil.isShowToCustomer(option.getKey()));
   OfferteOptionDto option2 = new OfferteOptionDto();
   option.setKey(TranslationKey.DIESEL_SURCHARGE);
   Assert.assertTrue(quotationUtil.isShowToCustomer(option2.getKey()));
 }
Example #2
0
 @Test
 public void testOFferteOPtionsContainsKey() {
   OfferteOptionDto option = new OfferteOptionDto();
   option.setKey(TranslationKey.ADR_MINIMUM);
   OfferteOptionDto option2 = new OfferteOptionDto();
   option.setKey(TranslationKey.DIESEL_SURCHARGE);
   Assert.assertTrue(
       quotationUtil.offerteOptionsContainsKey(
           Arrays.asList(option, option2), TranslationKey.DIESEL_SURCHARGE));
   Assert.assertFalse(
       quotationUtil.offerteOptionsContainsKey(
           Arrays.asList(option, option2), TranslationKey.CHF_SURCHARGE));
 }
Example #3
0
 @Test
 public void testCreateOption() {
   OfferteOptionDto option =
       quotationUtil.createCalculationOption(
           TranslationKey.DIESEL_SURCHARGE, new BigDecimal(100d));
   Assert.assertNotNull(option);
   Assert.assertEquals(true, option.isCalculationOption());
   Assert.assertTrue(option.isShowToCustomer());
 }
Example #4
0
  @Test
  public void testCreateRateFileSearchFilterForQueryForFullCustomer() {
    Customer fc = new Customer();
    fc.setName("basfull");
    quotationQuery.setCustomer(fc);

    RateFileSearchFilter filter =
        quotationUtil.createRateFileSearchFilterForQuery(quotationQuery, false);
    Assert.assertNotNull(filter);
    Assert.assertEquals(filter.getCustomer(), fc);
  }
Example #5
0
  @Test
  public void testCreateRecipientsList() {
    List<CustomerContact> contacts = new ArrayList<CustomerContact>();
    contacts.add(new CustomerContact("bas"));
    contacts.add(new CustomerContact("bas2"));
    QuotationResult result = new QuotationResult();
    result.setQuery(new QuotationQuery());
    result.getQuery().setCustomer(new Customer());
    result.getQuery().getCustomer().setContacts(contacts);
    quotationUtil.setupEmailRecipients(result);

    Assert.assertEquals(2, result.getAvailableEmailRecipients().size());
    Assert.assertEquals("bas", result.getAvailableEmailRecipients().get(0));
  }
Example #6
0
 @Test
 public void testCreateRateFileSearchFilterForNormalQuery() {
   Country country = new Country();
   country.setShortName("kl");
   quotationQuery.setCustomer(new Customer());
   quotationQuery.setCountry(country);
   quotationQuery.setMeasurement(Measurement.KILO);
   quotationQuery.setTransportType(TransportType.EXPORT);
   quotationQuery.setKindOfRate(Kind.EXPRES);
   RateFileSearchFilter filter =
       quotationUtil.createRateFileSearchFilterForQuery(quotationQuery, false);
   Assert.assertNotNull(filter);
   Assert.assertEquals(quotationQuery.getCountry(), filter.getCountry());
   Assert.assertEquals(quotationQuery.getMeasurement(), filter.getMeasurement());
   Assert.assertEquals(quotationQuery.getTransportType(), filter.getTransportationType());
   Assert.assertEquals(quotationQuery.getKindOfRate(), filter.getRateKind());
 }
Example #7
0
  @Test
  public void testgenerateOfferteOptionsForRateFile() {
    Condition c1 = new Condition();
    c1.setConditionKey(TranslationKey.ADR_MINIMUM);
    Condition c2 = new Condition();
    c2.setConditionKey(TranslationKey.EUR1_DOCUMENT);
    c2.addTranslation(Language.NL, "test");
    Condition c3 = new Condition();
    c3.setConditionKey(TranslationKey.IMPORT_FORM);
    RateFile rf = new RateFile();
    rf.setConditions(Arrays.asList(c1, c2, c3));

    List<OfferteOptionDto> options =
        quotationUtil.generateOfferteOptionsForRateFileAndLanguage(rf, Language.NL);
    Assert.assertNotNull(options);
    Assert.assertEquals("test", options.get(1).getValue());
    Assert.assertEquals(3, options.size());
    Assert.assertTrue(options.get(0).getKey() == TranslationKey.ADR_MINIMUM);
    Assert.assertFalse(options.get(0).isSelected());
  }
Example #8
0
 @Before
 public void init() {
   quotationUtil = QuotationUtil.getInstance();
   quotationQuery = new QuotationQuery();
 }