@Test(expected = IllegalArgumentException.class) public void testSaveNew_hasId() { ResourceSet rs = new ResourceSet(); rs.setId(1L); resourceSetService.saveNew(rs); }
@Override public ResourceSet saveNew(ResourceSet rs) { if (rs.getId() != null) { throw new IllegalArgumentException("Can't save a new resource set with an ID already set to it."); } if (!checkScopeConsistency(rs)) { throw new IllegalArgumentException("Can't save a resource set with inconsistent claims."); } ResourceSet saved = repository.save(rs); return saved; }
DefaultResourceSetService implements ResourceSetService { @Override public ResourceSet saveNew(ResourceSet rs) { if (rs.getId() != null) { throw new IllegalArgumentException("Can't save a new resource set with an ID already set to it."); } if (!checkScopeConsistency(rs)) { throw new IllegalArgumentException("Can't save a resource set with inconsistent claims."); } ResourceSet saved = repository.save(rs); return saved; } }
DefaultResourceSetService implements ResourceSetService { @Override public ResourceSet saveNew(ResourceSet rs) { if (rs.getId() != null) { throw new IllegalArgumentException("Can't save a new resource set with an ID already set to it."); } if (!checkScopeConsistency(rs)) { throw new IllegalArgumentException("Can't save a resource set with inconsistent claims."); } ResourceSet saved = repository.save(rs); return saved; }  }
DefaultResourceSetService implements ResourceSetService { @Override public ResourceSet saveNew(ResourceSet rs) { if (rs.getId() != null) { throw new IllegalArgumentException("Can't save a new resource set with an ID already set to it."); } if (!checkScopeConsistency(rs)) { throw new IllegalArgumentException("Can't save a resource set with inconsistent claims."); } ResourceSet saved = repository.save(rs); return saved; }  @Override ResourceSet saveNew(ResourceSet rs); @Override ResourceSet getById(Long id); @Override ResourceSet update(ResourceSet oldRs, ResourceSet newRs); @Override void remove(ResourceSet rs); @Override Collection<ResourceSet> getAllForOwner(String owner); @Override Collection<ResourceSet> getAllForOwnerAndClient(String owner, String clientId); @Override Collection<ResourceSet> getAllForClient(ClientDetailsEntity client); }
DefaultResourceSetService implements ResourceSetService { @Override public ResourceSet saveNew(ResourceSet rs) { if (rs.getId() != null) { throw new IllegalArgumentException("Can't save a new resource set with an ID already set to it."); } if (!checkScopeConsistency(rs)) { throw new IllegalArgumentException("Can't save a resource set with inconsistent claims."); } ResourceSet saved = repository.save(rs); return saved; }  @Override ResourceSet saveNew(ResourceSet rs); @Override ResourceSet getById(Long id); @Override ResourceSet update(ResourceSet oldRs, ResourceSet newRs); @Override void remove(ResourceSet rs); @Override Collection<ResourceSet> getAllForOwner(String owner); @Override Collection<ResourceSet> getAllForOwnerAndClient(String owner, String clientId); @Override Collection<ResourceSet> getAllForClient(ClientDetailsEntity client);  }