### Question:
ListRole extends Role { @Override @Nullable KeyAddress getSimpleAddress(boolean ignoreRefs) { if(!ignoreRefs && (requiredAnyReferences.size() > 0 || requiredAllReferences.size() > 0)) return null; if(roles.size() == 1 && (mode != Mode.QUORUM || quorumSize == 1)) { return roles.iterator().next().getSimpleAddress(ignoreRefs); } return null; } ListRole();  ListRole(String name,Contract contract); @Deprecated  ListRole(String name);  ListRole(String name, Contract contract, Mode mode, @NonNull Collection<Role> roles); @Deprecated  ListRole(String name, Mode mode, @NonNull Collection<Role> roles);  ListRole(String name, Contract contract, int quorumSize, @NonNull Collection<Role> roles); @Deprecated  ListRole(String name, int quorumSize, @NonNull Collection<Role> roles); void addAll(Collection<Role> roles); Set<Role> getRoles(); ListRole addRole(Role role); void setQuorum(int n); int getQuorum(); void setMode(Mode newMode); Mode getMode(); @Override boolean isAllowedForKeysQuantized(Set<? extends AbstractKey> keys); @Override boolean isValid(); @Override void initWithDsl(Binder serializedRole); @Override void setContract(Contract contract); @Override @Deprecated Set<KeyRecord> getKeyRecords(); @Override @Deprecated Set<PublicKey> getKeys(); @Override @Deprecated Set<AnonymousId> getAnonymousIds(); @Override @Deprecated Set<KeyAddress> getKeyAddresses(); @Override String toString(); @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(TestKeys.publicKey(0).getLongAddress()); SimpleRole sr = new SimpleRole("sr", keyAddresses); ListRole lr = new ListRole(); lr.addRole(sr); lr.setMode(ListRole.Mode.ALL); assertEquals(lr.getSimpleAddress(),TestKeys.publicKey(0).getLongAddress()); lr.setMode(ListRole.Mode.ANY); assertEquals(lr.getSimpleAddress(),TestKeys.publicKey(0).getLongAddress()); lr.setQuorum(2); assertNull(lr.getSimpleAddress()); lr.setQuorum(1); assertEquals(lr.getSimpleAddress(),TestKeys.publicKey(0).getLongAddress()); lr.setMode(ListRole.Mode.ANY); SimpleRole sr2 = new SimpleRole("sr2", keyAddresses); lr.addRole(sr2); assertNull(lr.getSimpleAddress()); lr.getRoles().remove(sr2); lr.addRequiredReference("dummy", Role.RequiredMode.ALL_OF); assertNull(lr.getSimpleAddress()); assertEquals(RoleExtractor.extractSimpleAddress(lr),TestKeys.publicKey(0).getLongAddress()); }