BindingTableRule { public String getBindingActualTable(final String dataSource, final String logicTable, final String otherActualTable) { int index = -1; for (TableRule each : tableRules) { index = each.findActualTableIndex(dataSource, otherActualTable); if (-1 != index) { break; } } if (-1 == index) { throw new ShardingSphereConfigurationException("Actual table [%s].[%s] is not in table config", dataSource, otherActualTable); } for (TableRule each : tableRules) { if (each.getLogicTable().equals(logicTable.toLowerCase())) { return each.getActualDataNodes().get(index).getTableName().toLowerCase(); } } throw new ShardingSphereConfigurationException("Cannot find binding actual table, data source: %s, logic table: %s, other actual table: %s", dataSource, logicTable, otherActualTable); }  boolean hasLogicTable(final String logicTable); String getBindingActualTable(final String dataSource, final String logicTable, final String otherActualTable);  }
@Test public void assertGetBindingActualTablesSuccess() { assertThat(createBindingTableRule().getBindingActualTable("ds1", "Sub_Logic_Table", "table_1"), is("sub_table_1")); }
@Test(expected = ShardingSphereConfigurationException.class) public void assertGetBindingActualTablesFailureWhenNotFound() { createBindingTableRule().getBindingActualTable("no_ds", "Sub_Logic_Table", "table_1"); }
@Test(expected = ShardingSphereConfigurationException.class) public void assertGetBindingActualTablesFailureWhenLogicTableNotFound() { createBindingTableRule().getBindingActualTable("ds0", "No_Logic_Table", "table_1"); }