@Test public void shouldThrowErrorIfUserDoesNotHavePermissionOnGivenWareHouse() { orderPod.setModifiedBy(7L); when(fulfillmentPermissionService.hasPermission(7L, orderId, MANAGE_POD)).thenReturn(false); expectedException.expect(DataException.class); expectedException.expectMessage("error.permission.denied"); podService.checkPermissions(orderPod); }
public void checkPermissions(OrderPOD orderPod) { if (!fulfillmentPermissionService.hasPermission(orderPod.getModifiedBy(), orderPod.getOrderId(), MANAGE_POD)) { throw new DataException("error.permission.denied"); } }
PODService { public void checkPermissions(OrderPOD orderPod) { if (!fulfillmentPermissionService.hasPermission(orderPod.getModifiedBy(), orderPod.getOrderId(), MANAGE_POD)) { throw new DataException("error.permission.denied"); } } }
PODService { public void checkPermissions(OrderPOD orderPod) { if (!fulfillmentPermissionService.hasPermission(orderPod.getModifiedBy(), orderPod.getOrderId(), MANAGE_POD)) { throw new DataException("error.permission.denied"); } }  }
PODService { public void checkPermissions(OrderPOD orderPod) { if (!fulfillmentPermissionService.hasPermission(orderPod.getModifiedBy(), orderPod.getOrderId(), MANAGE_POD)) { throw new DataException("error.permission.denied"); } }  @Transactional OrderPOD createPOD(OrderPOD orderPOD); void updateOrderStatus(OrderPOD orderPod); void checkPermissions(OrderPOD orderPod); OrderPOD getPODByOrderId(Long orderId); List<OrderPODLineItem> getNPreviousOrderPodLineItems(String productCode,
                                                              Rnr requisition,
                                                              Integer n,
                                                              Date startDate); void insertPOD(OrderPOD orderPod); OrderPOD getPodById(Long podId); @Transactional OrderPOD save(OrderPOD orderPOD); @Transactional OrderPOD submit(Long podId, Long userId); void insertPODLineItem(OrderPODLineItem orderPodLineItem); }
PODService { public void checkPermissions(OrderPOD orderPod) { if (!fulfillmentPermissionService.hasPermission(orderPod.getModifiedBy(), orderPod.getOrderId(), MANAGE_POD)) { throw new DataException("error.permission.denied"); } }  @Transactional OrderPOD createPOD(OrderPOD orderPOD); void updateOrderStatus(OrderPOD orderPod); void checkPermissions(OrderPOD orderPod); OrderPOD getPODByOrderId(Long orderId); List<OrderPODLineItem> getNPreviousOrderPodLineItems(String productCode,
                                                              Rnr requisition,
                                                              Integer n,
                                                              Date startDate); void insertPOD(OrderPOD orderPod); OrderPOD getPodById(Long podId); @Transactional OrderPOD save(OrderPOD orderPOD); @Transactional OrderPOD submit(Long podId, Long userId); void insertPODLineItem(OrderPODLineItem orderPodLineItem);  }