Example #1
0
  @Before
  public void setUp() throws Exception {
    Product product = make(a(ProductBuilder.defaultProduct));
    productMapper.insert(product);

    Program program = make(a(ProgramBuilder.defaultProgram));
    programMapper.insert(program);

    ProductCategory category = new ProductCategory("C1", "Category 1", 1);
    productCategoryMapper.insert(category);

    ProgramProduct programProduct =
        new ProgramProduct(program, product, 30, true, new Money("12.5"));
    programProduct.setProductCategory(category);
    programProductMapper.insert(programProduct);

    Facility facility = make(a(FacilityBuilder.defaultFacility));
    facilityMapper.insert(facility);

    ProcessingSchedule processingSchedule =
        make(a(ProcessingScheduleBuilder.defaultProcessingSchedule));
    processingScheduleMapper.insert(processingSchedule);

    ProcessingPeriod processingPeriod =
        make(a(defaultProcessingPeriod, with(scheduleId, processingSchedule.getId())));
    processingPeriodMapper.insert(processingPeriod);

    requisition = new Rnr(facility, new Program(HIV), processingPeriod, false, MODIFIED_BY, 1L);
    requisition.setStatus(INITIATED);
    requisitionMapper.insert(requisition);

    user = new User();
    user.setId(MODIFIED_BY);
  }
Example #2
0
 @Test
 public void should_get_product() {
   final Product product = productMapper.findProductById(appleJuice.getId());
   assertThat(product.getName(), is("apple juice"));
   assertThat(product.getDescription(), is("good"));
   final Price currentPrice = product.getCurrentPrice();
   assertThat(currentPrice.getPrice(), is(120));
 }
Example #3
0
 @Before
 public void setUp() throws Exception {
   sqlSession = MybatisConnectionFactory.getSqlSessionFactory().openSession();
   productMapper = sqlSession.getMapper(ProductMapper.class);
   priceMapper = sqlSession.getMapper(PriceMapper.class);
   setUpAppleJuice();
   productMapper.createProduct(new Product("orange juice", "bad"));
 }
Example #4
0
  @Test
  public void should_get_products() {
    final List<Product> products = productMapper.all();
    assertThat(products.size(), is(2));

    final Product product = products.get(0);
    assertThat(product.getName(), is("apple juice"));
    assertThat(product.getCurrentPrice().getPrice(), is(120));
  }
Example #5
0
 private void setUpAppleJuice() {
   appleJuice = new Product("apple juice", "good");
   productMapper.createProduct(appleJuice);
   appleJuicePrice = new Price(120, "kiwi", new Timestamp(114, 1, 1, 0, 0, 0, 0));
   priceMapper.createPrice(appleJuice, appleJuicePrice);
 }