@Test public void shouldGetCCEInventory() throws Exception { equipmentType.setColdChain(true); inventory.setEquipment(coldChainEquipment); List<EquipmentInventory> inventories = new ArrayList<>(); inventories.add(inventory); Pagination page = new Pagination(1, 2); long[] facilityIds = {facilityId,facilityId2}; String strFacilityIds = "{"+facilityId+","+facilityId2+"}"; when(mapper.getInventory(programId, equipmentTypeId, strFacilityIds, page)).thenReturn(inventories); when(equipmentMapper.getById(equipmentId)).thenReturn(equipment); when(equipmentTypeMapper.getEquipmentTypeById(equipmentTypeId)).thenReturn(equipmentType); when(coldChainEquipmentMapper.getById(equipmentId)).thenReturn(coldChainEquipment); when(equipmentInventoryStatusMapper.getCurrentStatus(inventoryId)).thenReturn(status); List<EquipmentInventory> results = repository.getInventory(programId, equipmentTypeId, facilityIds, page); verify(mapper).getInventory(programId, equipmentTypeId, strFacilityIds, page); verify(equipmentMapper).getById(equipmentId); verify(equipmentTypeMapper).getEquipmentTypeById(equipmentTypeId); verify(coldChainEquipmentMapper).getById(equipmentId); verify(equipmentInventoryStatusMapper).getCurrentStatus(inventoryId); assertEquals(results, inventories); }
public List<EquipmentInventory> getInventory(Long programId, Long equipmentTypeId, long[] facilityIds, Pagination pagination) { String strFacilityIds = getFacilityIdString(facilityIds); List<EquipmentInventory> inventories = mapper.getInventory(programId, equipmentTypeId, strFacilityIds, pagination); for (EquipmentInventory inventory : inventories) { setEquipmentToInventory(inventory); setStatusToInventory(inventory); } return inventories; }
EquipmentInventoryRepository { public List<EquipmentInventory> getInventory(Long programId, Long equipmentTypeId, long[] facilityIds, Pagination pagination) { String strFacilityIds = getFacilityIdString(facilityIds); List<EquipmentInventory> inventories = mapper.getInventory(programId, equipmentTypeId, strFacilityIds, pagination); for (EquipmentInventory inventory : inventories) { setEquipmentToInventory(inventory); setStatusToInventory(inventory); } return inventories; } }
EquipmentInventoryRepository { public List<EquipmentInventory> getInventory(Long programId, Long equipmentTypeId, long[] facilityIds, Pagination pagination) { String strFacilityIds = getFacilityIdString(facilityIds); List<EquipmentInventory> inventories = mapper.getInventory(programId, equipmentTypeId, strFacilityIds, pagination); for (EquipmentInventory inventory : inventories) { setEquipmentToInventory(inventory); setStatusToInventory(inventory); } return inventories; }  }
EquipmentInventoryRepository { public List<EquipmentInventory> getInventory(Long programId, Long equipmentTypeId, long[] facilityIds, Pagination pagination) { String strFacilityIds = getFacilityIdString(facilityIds); List<EquipmentInventory> inventories = mapper.getInventory(programId, equipmentTypeId, strFacilityIds, pagination); for (EquipmentInventory inventory : inventories) { setEquipmentToInventory(inventory); setStatusToInventory(inventory); } return inventories; }  List<EquipmentInventory> getFacilityInventory(Long facilityId, Long programId); List<EquipmentInventory> getInventory(Long programId, Long equipmentTypeId, long[] facilityIds, Pagination pagination); Integer getInventoryCount(Long programId, Long equipmentTypeId, long[] facilityIds); EquipmentInventory getInventoryById(Long id); void insert(EquipmentInventory inventory); void update(EquipmentInventory inventory); void updateStatus(EquipmentInventory inventory); String updateNonFunctionalEquipments(); }
EquipmentInventoryRepository { public List<EquipmentInventory> getInventory(Long programId, Long equipmentTypeId, long[] facilityIds, Pagination pagination) { String strFacilityIds = getFacilityIdString(facilityIds); List<EquipmentInventory> inventories = mapper.getInventory(programId, equipmentTypeId, strFacilityIds, pagination); for (EquipmentInventory inventory : inventories) { setEquipmentToInventory(inventory); setStatusToInventory(inventory); } return inventories; }  List<EquipmentInventory> getFacilityInventory(Long facilityId, Long programId); List<EquipmentInventory> getInventory(Long programId, Long equipmentTypeId, long[] facilityIds, Pagination pagination); Integer getInventoryCount(Long programId, Long equipmentTypeId, long[] facilityIds); EquipmentInventory getInventoryById(Long id); void insert(EquipmentInventory inventory); void update(EquipmentInventory inventory); void updateStatus(EquipmentInventory inventory); String updateNonFunctionalEquipments(); static Logger logger; }