RouteUnit { public Optional<RouteMapper> findTableMapper(final String logicDataSourceName, final String actualTableName) { for (RouteMapper each : tableMappers) { if (logicDataSourceName.equalsIgnoreCase(dataSourceMapper.getLogicName()) && actualTableName.equalsIgnoreCase(each.getActualName())) { return Optional.of(each); } } return Optional.empty(); }  Set<String> getLogicTableNames(); Set<String> getActualTableNames(final String logicTableName); Optional<RouteMapper> findTableMapper(final String logicDataSourceName, final String actualTableName);  }
@Test public void assertFindTableMapper() { Optional<RouteMapper> actual = routeUnit.findTableMapper(LOGIC_DATA_SOURCE, ACTUAL_TABLE_0); assertTrue(actual.isPresent()); assertThat(actual.get().getLogicName(), is(LOGIC_TABLE)); assertThat(actual.get().getActualName(), is(ACTUAL_TABLE_0)); }
@Test public void assertTableMapperNotFound() { assertFalse(routeUnit.findTableMapper("invalid_ds", "invalid_tbl").isPresent()); }