Search in sources :

Example 1 with NullLookupDataSource

use of de.metas.ui.web.window.model.lookup.NullLookupDataSource in project metasfresh-webui-api by metasfresh.

the class PickingSlotViewRepositoryTests method createPickingSllotViewRepository.

private PickingSlotViewRepository createPickingSllotViewRepository() {
    final NullLookupDataSource nullDs = NullLookupDataSource.instance;
    final PickingSlotViewRepository pickingSlotViewRepository = new PickingSlotViewRepository(pickingHUsRepo, () -> nullDs, () -> nullDs, () -> nullDs);
    return pickingSlotViewRepository;
}
Also used : NullLookupDataSource(de.metas.ui.web.window.model.lookup.NullLookupDataSource)

Example 2 with NullLookupDataSource

use of de.metas.ui.web.window.model.lookup.NullLookupDataSource in project metasfresh-webui-api by metasfresh.

the class PickingSlotViewRepositoryTests method testRetrievePickingSlotRows_No_HUs_show_PickingSlotsOnly.

/**
 * Verifies {@link PickingSlotViewRepository#retrieveRows(PickingSlotRepoQuery)}<br>
 * when there are no HUs (no picking candidates) assigned to a picking slot, but still the picking slot itself shall be shown.
 */
@Test
public void testRetrievePickingSlotRows_No_HUs_show_PickingSlotsOnly() {
    final I_M_ShipmentSchedule shipmentSchedule = newInstance(I_M_ShipmentSchedule.class);
    save(shipmentSchedule);
    final I_M_PickingSlot pickingSlot = newInstance(I_M_PickingSlot.class);
    pickingSlot.setIsPickingRackSystem(true);
    save(pickingSlot);
    final PickingSlotRepoQuery query = PickingSlotRepoQuery.of(shipmentSchedule.getM_ShipmentSchedule_ID());
    // @formatter:off return an empty list
    new Expectations() {

        {
            pickingHUsRepo.retrievePickedHUsIndexedByPickingSlotId(query);
            result = ImmutableListMultimap.of();
        }
    };
    // @formatter:on
    final NullLookupDataSource nullDS = NullLookupDataSource.instance;
    final PickingSlotViewRepository pickingSlotViewRepository = new PickingSlotViewRepository(pickingHUsRepo, () -> nullDS, () -> nullDS, () -> nullDS);
    final List<PickingSlotRow> pickingSlotRows = pickingSlotViewRepository.retrievePickingSlotRows(query);
    // even if there are no HUs, there shall still be a row for our picking slot.
    assertThat(pickingSlotRows.size(), is(1));
    final PickingSlotRow pickingSlotRow = pickingSlotRows.get(0);
    assertThat(pickingSlotRow.getType()).isEqualTo(PickingSlotRowType.forPickingSlotRow());
}
Also used : Expectations(mockit.Expectations) I_M_PickingSlot(de.metas.picking.model.I_M_PickingSlot) I_M_ShipmentSchedule(de.metas.handlingunits.model.I_M_ShipmentSchedule) NullLookupDataSource(de.metas.ui.web.window.model.lookup.NullLookupDataSource) Test(org.junit.Test)

Aggregations

NullLookupDataSource (de.metas.ui.web.window.model.lookup.NullLookupDataSource)2 I_M_ShipmentSchedule (de.metas.handlingunits.model.I_M_ShipmentSchedule)1 I_M_PickingSlot (de.metas.picking.model.I_M_PickingSlot)1 Expectations (mockit.Expectations)1 Test (org.junit.Test)1