@Test public void shouldGetExistingLot() { when(mapper.getByObject(lot)).thenReturn(lot); Lot l = repository.getOrCreateLot(lot); assertEquals(l.getLotCode(), lot.getLotCode()); assertEquals(l.getManufacturerName(), lot.getManufacturerName()); assertEquals(l.getExpirationDate(), lot.getExpirationDate()); }
public Lot getOrCreateLot(Lot lot) { Lot l = mapper.getByObject(lot); if (null == l) { mapper.insert(lot); l = lot; } return l; }
LotRepository { public Lot getOrCreateLot(Lot lot) { Lot l = mapper.getByObject(lot); if (null == l) { mapper.insert(lot); l = lot; } return l; } }
LotRepository { public Lot getOrCreateLot(Lot lot) { Lot l = mapper.getByObject(lot); if (null == l) { mapper.insert(lot); l = lot; } return l; } LotRepository(LotMapper mapper); }
LotRepository { public Lot getOrCreateLot(Lot lot) { Lot l = mapper.getByObject(lot); if (null == l) { mapper.insert(lot); l = lot; } return l; } LotRepository(LotMapper mapper); LotOnHand getLotOnHandByStockCardAndLot(Long stockCardId, Long lotId); LotOnHand getLotOnHandByStockCardAndLotObject(Long stockCardId, Lot lot); Lot getOrCreateLot(Lot lot); void saveLotOnHand(LotOnHand lotOnHand); }
LotRepository { public Lot getOrCreateLot(Lot lot) { Lot l = mapper.getByObject(lot); if (null == l) { mapper.insert(lot); l = lot; } return l; } LotRepository(LotMapper mapper); LotOnHand getLotOnHandByStockCardAndLot(Long stockCardId, Long lotId); LotOnHand getLotOnHandByStockCardAndLotObject(Long stockCardId, Lot lot); Lot getOrCreateLot(Lot lot); void saveLotOnHand(LotOnHand lotOnHand);  }