### Question:
MasterSlaveDataSource extends AbstractDataSourceAdapter { public DataSource getDataSource(final SQLType sqlType) { if (isMasterRoute(sqlType)) { DML_FLAG.set(true); return masterDataSource; } return slaveLoadBalanceStrategy.getDataSource(name, slaveDataSources); }  static String getDataSourceName(final String dataSourceName, final SQLType sqlType); DataSource getDataSource(final SQLType sqlType); String getDatabaseProductName(); @Override Connection getConnection(); static void resetDMLFlag();  }### Answer:
@Test public void assertGetDataSourceForDML() { assertThat(masterSlaveDataSource.getDataSource(SQLType.DML), is(masterDataSource)); }
@Test public void assertGetDataSourceForDQL() { assertThat(masterSlaveDataSource.getDataSource(SQLType.DQL), is(slaveDataSource)); }
@Test public void assertGetDataSourceForDMLAndDQL() { assertThat(masterSlaveDataSource.getDataSource(SQLType.DML), is(masterDataSource)); assertThat(masterSlaveDataSource.getDataSource(SQLType.DQL), is(masterDataSource)); }
@Test public void assertGetDataSourceForHintToMasterOnly() { HintManager hintManager = HintManager.getInstance(); hintManager.setMasterRouteOnly(); assertThat(masterSlaveDataSource.getDataSource(SQLType.DQL), is(masterDataSource)); hintManager.close(); }