@Test public void shouldGetAllDeliveryZonesForAUser() throws Exception { List<DeliveryZone> deliveryZones = new ArrayList<>(); when(repository.getByUserForRight(1l, MANAGE_DISTRIBUTION)).thenReturn(deliveryZones); List<DeliveryZone> returnedZones = service.getByUserForRight(1l, MANAGE_DISTRIBUTION); verify(repository).getByUserForRight(1l, MANAGE_DISTRIBUTION); assertThat(returnedZones, is(deliveryZones)); }
public List<DeliveryZone> getByUserForRight(long userId, String rightName) { return repository.getByUserForRight(userId, rightName); }
DeliveryZoneService { public List<DeliveryZone> getByUserForRight(long userId, String rightName) { return repository.getByUserForRight(userId, rightName); } }
DeliveryZoneService { public List<DeliveryZone> getByUserForRight(long userId, String rightName) { return repository.getByUserForRight(userId, rightName); }  }
DeliveryZoneService { public List<DeliveryZone> getByUserForRight(long userId, String rightName) { return repository.getByUserForRight(userId, rightName); }  void save(DeliveryZone zone); DeliveryZone getByCode(String code); List<DeliveryZone> getByUserForRight(long userId, String rightName); List<Program> getActiveProgramsForDeliveryZone(long zoneId); DeliveryZone getById(Long id); List<DeliveryZone> getAll(); List<Program> getAllProgramsForDeliveryZone(Long zoneId); }
DeliveryZoneService { public List<DeliveryZone> getByUserForRight(long userId, String rightName) { return repository.getByUserForRight(userId, rightName); }  void save(DeliveryZone zone); DeliveryZone getByCode(String code); List<DeliveryZone> getByUserForRight(long userId, String rightName); List<Program> getActiveProgramsForDeliveryZone(long zoneId); DeliveryZone getById(Long id); List<DeliveryZone> getAll(); List<Program> getAllProgramsForDeliveryZone(Long zoneId);  }