@Test public void shouldReturnFalseIfUserDoesNotHasPermissionOnADeliveryZone() { Long userId = 1L; Long distributionId = 2L; List<DeliveryZone> deliveryZones = emptyList(); when(deliveryZoneService.getByUserForRight(userId, MANAGE_DISTRIBUTION)).thenReturn( deliveryZones); when(distributionService.getBy(distributionId)).thenReturn(new Distribution()); assertThat(distributionPermissionService.hasPermission(userId, "MANAGE_DISTRIBUTION", 1L), is(false)); }
public Boolean hasPermission(Long userId, String permission, final Distribution distribution) { return hasPermissionForDeliveryZone(userId, permission, distribution); }
DistributionPermissionService { public Boolean hasPermission(Long userId, String permission, final Distribution distribution) { return hasPermissionForDeliveryZone(userId, permission, distribution); } }
DistributionPermissionService { public Boolean hasPermission(Long userId, String permission, final Distribution distribution) { return hasPermissionForDeliveryZone(userId, permission, distribution); }  }
DistributionPermissionService { public Boolean hasPermission(Long userId, String permission, final Distribution distribution) { return hasPermissionForDeliveryZone(userId, permission, distribution); }  Boolean hasPermission(Long userId, String permission, final Distribution distribution); Boolean hasPermission(Long userId, String permission, final Long distributionId); }
DistributionPermissionService { public Boolean hasPermission(Long userId, String permission, final Distribution distribution) { return hasPermissionForDeliveryZone(userId, permission, distribution); }  Boolean hasPermission(Long userId, String permission, final Distribution distribution); Boolean hasPermission(Long userId, String permission, final Long distributionId);  }