public void testProcess_T1_Imicus() {
CalculationDto calculation = new CalculationDto();
calculation.setBlueprintTypeName("Imicus Blueprint");
calculation.setMaterialLevel(40);
calculation.setProductivityLevel(25);
CalculationItemDto tritaniumCalculationItem = new CalculationItemDto();
tritaniumCalculationItem.setPathExpression(PathExpression.parsePath("/607:40:25/34"));
tritaniumCalculationItem.setPerfectQuantity(6629L);
tritaniumCalculationItem.setItemTypeID(34L);
tritaniumCalculationItem.setPrice(new BigDecimal("2.20"));
tritaniumCalculationItem.setDamagePerJob(BigDecimal.ONE);
tritaniumCalculationItem.setWasteFactor(10);
CalculationItemDto pyeriteCalculationItem = new CalculationItemDto();
pyeriteCalculationItem.setPathExpression(PathExpression.parsePath("/607:40:25/35"));
pyeriteCalculationItem.setPerfectQuantity(5422L);
pyeriteCalculationItem.setItemTypeID(35L);
pyeriteCalculationItem.setPrice(new BigDecimal("3.00"));
pyeriteCalculationItem.setDamagePerJob(BigDecimal.ONE);
pyeriteCalculationItem.setWasteFactor(10);
CalculationItemDto mexallonCalculationItem = new CalculationItemDto();
mexallonCalculationItem.setPathExpression(PathExpression.parsePath("/607:40:25/36"));
mexallonCalculationItem.setPerfectQuantity(1295L);
mexallonCalculationItem.setItemTypeID(36L);
mexallonCalculationItem.setPrice(new BigDecimal("26.85"));
mexallonCalculationItem.setDamagePerJob(BigDecimal.ONE);
mexallonCalculationItem.setWasteFactor(10);
CalculationItemDto isogenCalculationItem = new CalculationItemDto();
isogenCalculationItem.setPathExpression(PathExpression.parsePath("/607:40:25/37"));
isogenCalculationItem.setPerfectQuantity(1L);
isogenCalculationItem.setItemTypeID(37L);
isogenCalculationItem.setPrice(new BigDecimal("51.00"));
isogenCalculationItem.setDamagePerJob(BigDecimal.ONE);
isogenCalculationItem.setWasteFactor(10);
CalculationItemDto zydrineCalculationItem = new CalculationItemDto();
zydrineCalculationItem.setPathExpression(PathExpression.parsePath("/607:40:25/39"));
zydrineCalculationItem.setPerfectQuantity(1L);
zydrineCalculationItem.setItemTypeID(39L);
zydrineCalculationItem.setPrice(new BigDecimal("1000.01"));
zydrineCalculationItem.setDamagePerJob(BigDecimal.ONE);
zydrineCalculationItem.setWasteFactor(10);
List<CalculationItemDto> items = new ArrayList<CalculationItemDto>();
items.add(tritaniumCalculationItem);
items.add(pyeriteCalculationItem);
items.add(mexallonCalculationItem);
items.add(isogenCalculationItem);
items.add(zydrineCalculationItem);
calculation.setItems(items);
CalculationTree calculationTree = new CalculationTree();
calculationTree.build(calculation);
PricingProcessorResult pricingProcessorResult = pricingProcessor.process(1L, calculationTree, new HashMap<Long, CalculationPriceSetItemDto>());
Map<Long, CalculationPriceSetItemDto> typeIdToCalculationPriceSetItemMap = pricingProcessorResult.getTypeIdToCalculationPriceSetItemMap();
assertThat(typeIdToCalculationPriceSetItemMap.size(), equalTo(5));
assertThat(pricingProcessorResult.getTotalPrice(), equalTo(new BigDecimal("66826.31")));
assertThat(tritaniumCalculationItem.getQuantity(), equalTo(6645L));
assertThat(pyeriteCalculationItem.getQuantity(), equalTo(5435L));
assertThat(mexallonCalculationItem.getQuantity(), equalTo(1298L));
assertThat(isogenCalculationItem.getQuantity(), equalTo(1L));
assertThat(zydrineCalculationItem.getQuantity(), equalTo(1L));
assertThat(tritaniumCalculationItem.getParentQuantity(), equalTo(1L));
assertThat(pyeriteCalculationItem.getParentQuantity(), equalTo(1L));
assertThat(mexallonCalculationItem.getParentQuantity(), equalTo(1L));
assertThat(isogenCalculationItem.getParentQuantity(), equalTo(1L));
assertThat(zydrineCalculationItem.getParentQuantity(), equalTo(1L));
assertThat(tritaniumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("14619.00")));
assertThat(pyeriteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("16305.00")));
assertThat(mexallonCalculationItem.getTotalPrice(), equalTo(new BigDecimal("34851.30")));
assertThat(isogenCalculationItem.getTotalPrice(), equalTo(new BigDecimal("51.00")));
assertThat(zydrineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("1000.01")));
assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getQuantity(), equalTo(6645L));
assertThat(typeIdToCalculationPriceSetItemMap.get(35L).getQuantity(), equalTo(5435L));
assertThat(typeIdToCalculationPriceSetItemMap.get(36L).getQuantity(), equalTo(1298L));
assertThat(typeIdToCalculationPriceSetItemMap.get(37L).getQuantity(), equalTo(1L));
assertThat(typeIdToCalculationPriceSetItemMap.get(39L).getQuantity(), equalTo(1L));
assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getTotalPrice(), equalTo(new BigDecimal("14619.00")));
assertThat(typeIdToCalculationPriceSetItemMap.get(35L).getTotalPrice(), equalTo(new BigDecimal("16305.00")));
assertThat(typeIdToCalculationPriceSetItemMap.get(36L).getTotalPrice(), equalTo(new BigDecimal("34851.30")));
assertThat(typeIdToCalculationPriceSetItemMap.get(37L).getTotalPrice(), equalTo(new BigDecimal("51.00")));
assertThat(typeIdToCalculationPriceSetItemMap.get(39L).getTotalPrice(), equalTo(new BigDecimal("1000.01")));
pricingProcessorResult = pricingProcessor.process(500L, calculationTree, new HashMap<Long, CalculationPriceSetItemDto>());
typeIdToCalculationPriceSetItemMap = pricingProcessorResult.getTypeIdToCalculationPriceSetItemMap();
assertThat(typeIdToCalculationPriceSetItemMap.size(), equalTo(5));
assertThat(pricingProcessorResult.getTotalPrice(), equalTo(new BigDecimal("33413155.00")));
assertThat(tritaniumCalculationItem.getQuantity(), equalTo(6645L));
assertThat(pyeriteCalculationItem.getQuantity(), equalTo(5435L));
assertThat(mexallonCalculationItem.getQuantity(), equalTo(1298L));
assertThat(isogenCalculationItem.getQuantity(), equalTo(1L));
assertThat(zydrineCalculationItem.getQuantity(), equalTo(1L));
assertThat(tritaniumCalculationItem.getParentQuantity(), equalTo(500L));
assertThat(pyeriteCalculationItem.getParentQuantity(), equalTo(500L));
assertThat(mexallonCalculationItem.getParentQuantity(), equalTo(500L));
assertThat(isogenCalculationItem.getParentQuantity(), equalTo(500L));
assertThat(zydrineCalculationItem.getParentQuantity(), equalTo(500L));
assertThat(tritaniumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("14619.00")));
assertThat(pyeriteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("16305.00")));
assertThat(mexallonCalculationItem.getTotalPrice(), equalTo(new BigDecimal("34851.30")));
assertThat(isogenCalculationItem.getTotalPrice(), equalTo(new BigDecimal("51.00")));
assertThat(zydrineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("1000.01")));
assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getQuantity(), equalTo(3322500L));
assertThat(typeIdToCalculationPriceSetItemMap.get(35L).getQuantity(), equalTo(2717500L));
assertThat(typeIdToCalculationPriceSetItemMap.get(36L).getQuantity(), equalTo(649000L));
assertThat(typeIdToCalculationPriceSetItemMap.get(37L).getQuantity(), equalTo(500L));
assertThat(typeIdToCalculationPriceSetItemMap.get(39L).getQuantity(), equalTo(500L));