### Question:
DBGroup { public String getDBServer(DBRole role) throws QuitException { if (!isInitialized()) { logger.error("DBGroup:" + this.groupName + " has not been initialized"); throw new QuitException("DBGroup:" + this.groupName + " has not been initialized"); } if (dbGroupUpdater.isMultiMaster() && !this.masters.isEmpty()) { return masterSelector.select(masters); } if (role == DBRole.MASTER) { if (masterElected()) { return master; } else { throw new QuitException("DBGroup:" + this.groupName + " no available master pool"); } } else { List<String> slavelist = this.slaves; if (slavelist.size() > 0) { return slaveSelector.select(slaves); } else if (masterElected()) { return master; } else { throw new QuitException("DBGroup:" + this.groupName + " no available slave pool"); } } } DBGroup(String group, ZKCache zkCache, SchedulerGroup schedulerGroup,
        DALGroup dalGroup); void init(); void tryAttachFakePool(DBVendor dbVendor); String getGroupName(); void setDalGroup(DALGroup dalGroup); DALGroup getDalGroup(); synchronized void removeDbs(List<DBConnectionInfo> infos); String getDBServer(DBRole role); void acquireServerSession(final DBConnectionInfo targetDb,
        final SqlSessionContext sqlCtx, final ResponseHandler handler); String getMasterName(); boolean isInitialized(); DbGroupUpdater getDbGroupUpdater(); boolean masterElected(); List<String> getSlaves(); synchronized void tryWarmUpServerSession(int expectedActiveSessions); static final String DEFAULT_MASTER_NAME; }### Answer:
@Test(expectedExceptions = QuitException.class, expectedExceptionsMessageRegExp = ".* has not been initialized") public void testDBGroupNotInit() throws QuitException { ZKCache zkCache = new ZKCache("testDalGroup"); DBGroup dbGroup = new DBGroup("test", zkCache, new SchedulerGroup("testDalGroup", zkCache), new DALGroup("testDalGroup", "", "test")); dbGroup.getDBServer(DBRole.MASTER); }