Tenant { public boolean isLightweight() { return ( id != null && (name == null || name.isEmpty()) && tier == null && status == null && (users == null || users.isEmpty()) ); } Tenant();  Tenant(UUID id); UUID getId(); void setId(UUID id); String getName(); void setName(String name); Tier getTier(); void setTier(Tier tier); Status getStatus(); void setStatus(Status status); List<User> getUsers(); void setUsers(List<User> users); boolean isLightweight();  }
@Test public void isLightweight() { Tenant lightweight = new Tenant(); lightweight.setId(UUID.randomUUID()); assertTrue("Only ID is lightweight", lightweight.isLightweight()); lightweight.setUsers(new ArrayList<>()); assertTrue("Only ID and empty users list is still lightweight", lightweight.isLightweight()); Tenant heavyweight = new Tenant(); heavyweight.setId(UUID.randomUUID()); heavyweight.setName("ABCDEF"); assertFalse("Any property in addition to ID are not lightweight", heavyweight.isLightweight()); heavyweight.setStatus(Status.active); heavyweight.setTier(Tier.gold); heavyweight.setUsers(new ArrayList<>()); assertFalse("Fully hydrated tenants are not lightweight", heavyweight.isLightweight()); }