JmsRealmFactory { public String getFirstDatasourceJmsRealm() { Iterator<String> it = getRegisteredRealmNames(); while (it.hasNext()) { String jr = (String) it.next(); if (StringUtils.isNotEmpty(getJmsRealm(jr).getDatasourceName())) { return jr; } } return null; } private  JmsRealmFactory(); static synchronized JmsRealmFactory getInstance(); void clear(); JmsRealm getJmsRealm(String jmsRealmName); Iterator<String> getRegisteredRealmNames(); List<String> getRegisteredRealmNamesAsList(); void registerJmsRealm(JmsRealm jmsRealm); @Override String toString(); String getFirstDatasourceJmsRealm(); List<String> getRegisteredDatasourceRealmNamesAsList();  }
@Test public void firstDatasourceRealm() { assertEquals("b",jmsRealmFactory.getFirstDatasourceJmsRealm()); }