SkuWarehouseServiceImpl extends BaseGenericServiceImpl<SkuWarehouse> implements SkuWarehouseService { @Override public SkuWarehouse create(SkuWarehouse instance) { return super.create(instance); } SkuWarehouseServiceImpl(
            final GenericDAO<SkuWarehouse, Long> genericDao); @Override List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId); @Override BigDecimal reservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal reserveQty); @Override BigDecimal reservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal reserveQty, final boolean allowBackorder); @Override BigDecimal voidReservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal voidQty); @Override BigDecimal credit(final Warehouse warehouse, final String productSkuCode, final BigDecimal addQty); @Override BigDecimal debit(final Warehouse warehouse, final String productSkuCode, final BigDecimal debitQty); @Override SkuWarehouse create(SkuWarehouse instance); @Override SkuWarehouse update(SkuWarehouse instance); @Override SkuWarehouse findByWarehouseSku(final Warehouse warehouse, final String productSkuCode); @Override List<String> findProductSkuForWhichInventoryChangedAfter(final Instant lastUpdate); @Override List<String> findProductSkuByUnavailableBefore(final LocalDateTime before); @Override List<SkuWarehouse> findSkuWarehouses(final int start, final int offset, final String sort, final boolean sortDescending, final Map<String, List> filter); @Override int findSkuWarehouseCount(final Map<String, List> filter); void setProductService(ProductService productService);  }
@Test public void testCreate() { SkuWarehouse skuWarehouse = skuWarehouseService.getGenericDao().getEntityFactory().getByIface(SkuWarehouse.class); skuWarehouse.setSkuCode("PRODUCT7"); skuWarehouse.setWarehouse(warehouseService.findById(1L)); skuWarehouse.setQuantity(BigDecimal.TEN); skuWarehouse = skuWarehouseService.create(skuWarehouse); assertTrue(skuWarehouse.getSkuWarehouseId() > 0); skuWarehouseService.delete(skuWarehouse); }
@Test public void testDelete() { SkuWarehouse skuWarehouse = skuWarehouseService.getGenericDao().getEntityFactory().getByIface(SkuWarehouse.class); skuWarehouse.setSkuCode("PRODUCT7"); skuWarehouse.setWarehouse(warehouseService.findById(1L)); skuWarehouse.setQuantity(BigDecimal.TEN); skuWarehouse = skuWarehouseService.create(skuWarehouse); assertTrue(skuWarehouse.getSkuWarehouseId() > 0); long pk = skuWarehouse.getSkuWarehouseId(); skuWarehouseService.delete(skuWarehouse); skuWarehouse = skuWarehouseService.findById(pk); assertNull(skuWarehouse); }