@Test public void shouldGetByProductAndFacility() throws Exception { Product product = new Product(); Facility facility = new Facility(10L); product.setId(20L); OrderQuantityAdjustmentProduct adjustmentProduct = new OrderQuantityAdjustmentProduct(); adjustmentProduct.setAdjustmentFactor(new OrderQuantityAdjustmentFactor("adj-factor","adj-factor",1,true)); adjustmentProduct.setAdjustmentType(new OrderQuantityAdjustmentType("adj-type","adj-type",1)); adjustmentProduct.setFacility(facility); adjustmentProduct.setProduct(product); adjustmentProduct.setMinMOS(5L); adjustmentProduct.setMaxMOS(15L); when(adjustmentProductRepository.getByProductAndFacility(product.getId(), facility.getId())).thenReturn(adjustmentProduct); OrderQuantityAdjustmentProduct fetchedAdjustment = adjustmentProductService.getByProductAndFacility(product.getId(), facility.getId()); verify(adjustmentProductRepository).getByProductAndFacility(product.getId(), facility.getId()); assertThat(fetchedAdjustment, is(adjustmentProduct)); }
public OrderQuantityAdjustmentProduct getByProductAndFacility(Long productId, Long facilityId){ return this.repository.getByProductAndFacility(productId, facilityId); }
OrderQuantityAdjustmentProductService { public OrderQuantityAdjustmentProduct getByProductAndFacility(Long productId, Long facilityId){ return this.repository.getByProductAndFacility(productId, facilityId); } }
OrderQuantityAdjustmentProductService { public OrderQuantityAdjustmentProduct getByProductAndFacility(Long productId, Long facilityId){ return this.repository.getByProductAndFacility(productId, facilityId); }  }
OrderQuantityAdjustmentProductService { public OrderQuantityAdjustmentProduct getByProductAndFacility(Long productId, Long facilityId){ return this.repository.getByProductAndFacility(productId, facilityId); }  List<OrderQuantityAdjustmentProduct> getAll(); @Transactional void save(OrderQuantityAdjustmentProduct adjustmentProduct); OrderQuantityAdjustmentProduct getByProductAndFacility(Long productId, Long facilityId); }
OrderQuantityAdjustmentProductService { public OrderQuantityAdjustmentProduct getByProductAndFacility(Long productId, Long facilityId){ return this.repository.getByProductAndFacility(productId, facilityId); }  List<OrderQuantityAdjustmentProduct> getAll(); @Transactional void save(OrderQuantityAdjustmentProduct adjustmentProduct); OrderQuantityAdjustmentProduct getByProductAndFacility(Long productId, Long facilityId);  }