### Question:
SimpleRole extends Role { @Override @Nullable KeyAddress getSimpleAddress(boolean ignoreRefs) { if(!ignoreRefs && (requiredAnyReferences.size() > 0 || requiredAllReferences.size() > 0)) return null; if(anonymousIds.size() == 0 && keyRecords.size() + keyAddresses.size() == 1) { if(keyRecords.size() == 1) { return keyRecords.keySet().iterator().next().getShortAddress(); } else { return keyAddresses.iterator().next(); } } return null; } @Deprecated  SimpleRole(String name, @NonNull KeyRecord keyRecord);  SimpleRole(String name, Contract contract, @NonNull KeyRecord keyRecord); private  SimpleRole(); @Deprecated  SimpleRole(String name);  SimpleRole(String name,Contract contract); @Deprecated  SimpleRole(String name, @NonNull Collection records);  SimpleRole(String name, Contract contract, @NonNull Collection records); void addKeyRecord(KeyRecord keyRecord); @Deprecated KeyRecord getKeyRecord(); @Deprecated Set<KeyRecord> getKeyRecords(); @Override @Deprecated Set<PublicKey> getKeys(); @Override @Deprecated Set<AnonymousId> getAnonymousIds(); @Deprecated @Override Set<KeyAddress> getKeyAddresses(); Set<KeyRecord> getSimpleKeyRecords(); Set<PublicKey> getSimpleKeys(); Set<AnonymousId> getSimpleAnonymousIds(); Set<KeyAddress> getSimpleKeyAddresses(); @Override boolean isAllowedForKeysQuantized(Set<? extends AbstractKey> keys); boolean isValid(); @Override void initWithDsl(Binder serializedRole); SimpleRole cloneAs(String name,Contract contract); @Deprecated SimpleRole cloneAs(String name); @Override String toString(); boolean isAllowedForKeys(SimpleRole anotherRole); @Override void deserialize(Binder data, BiDeserializer deserializer); @Override Binder serialize(BiSerializer s); @Override void anonymize();  }### Answer:
@Test public void testGetSimpleAddress() throws Exception { Set<Object> keyAddresses = new HashSet<>(); keyAddresses.add(keys.get(0).getPublicKey().getShortAddress()); SimpleRole sr = new SimpleRole("tr1",null, keyAddresses); assertEquals(sr.getSimpleAddress(),keyAddresses.iterator().next()); keyAddresses.add(keys.get(1).getPublicKey()); sr = new SimpleRole("tr1", null, keyAddresses); assertNull(sr.getSimpleAddress()); keyAddresses.remove(keys.get(0).getPublicKey().getShortAddress()); sr = new SimpleRole("tr1", null, keyAddresses); assertEquals(sr.getSimpleAddress(),keys.get(1).getPublicKey().getShortAddress()); sr.addRequiredReference("dummy", Role.RequiredMode.ALL_OF); assertNull(sr.getSimpleAddress()); assertEquals(RoleExtractor.extractSimpleAddress(sr),keys.get(1).getPublicKey().getShortAddress()); }