### Question:
MetadataTableConfigHelper extends AbstractTableConfigHelper { @Override public void setup(String tableName, Configuration config, Logger log) throws IllegalArgumentException { this.log = log; this.conf = config; this.tableName = conf.get(ShardedDataTypeHandler.METADATA_TABLE_NAME, null); if (this.tableName == null || !this.tableName.equals(tableName)) { throw new IllegalArgumentException("No Such Table: " + tableName); } }  @Override void configure(TableOperations tops); @Override void setup(String tableName, Configuration config, Logger log);  }### Answer:
@Test public void testSetupNothingDefinedInConfiguration() { MetadataTableConfigHelperTest.logger.info("MetadataTableConfigHelperTest.testSetupNothingDefinedInConfiguration called."); try { WrappedMetadataTableConfigHelper uut = new WrappedMetadataTableConfigHelper(); Configuration config = this.createMockConfiguration(); Logger log = this.createMockLogger(); uut.setup(MetadataTableConfigHelperTest.TABLE_NAME, config, log); } catch (IllegalArgumentException iae) { String msg = iae.getMessage(); Assert.assertTrue("MetadataTableConfigHelper.setup threw the expected exception, but the message was not the expected message.", msg.startsWith("No Such Table: ")); } finally { MetadataTableConfigHelperTest.logger.info("MetadataTableConfigHelperTest.testSetupNothingDefinedInConfiguration completed."); } }
@Test public void testSetupOneShardTableDefinedInConfiguration() { MetadataTableConfigHelperTest.logger.info("MetadataTableConfigHelperTest.testSetupNothingDefinedInConfiguration called."); try { WrappedMetadataTableConfigHelper uut = new WrappedMetadataTableConfigHelper(); Configuration config = this.createMockConfiguration(); Logger log = this.createMockLogger(); this.configuration.put(ShardedDataTypeHandler.METADATA_TABLE_NAME, MetadataTableConfigHelperTest.TABLE_NAME); uut.setup(MetadataTableConfigHelperTest.TABLE_NAME, config, log); Assert.assertEquals("MetadataTableConfigHelper.setup incorrectly identified the TableName", MetadataTableConfigHelperTest.TABLE_NAME, uut.exposeTableName()); } finally { MetadataTableConfigHelperTest.logger.info("MetadataTableConfigHelperTest.testSetupNothingDefinedInConfiguration completed."); } }
@Test public void testSetupOneShardTableDefinedInConfigurationButNotTableNameParameter() { MetadataTableConfigHelperTest.logger.info("MetadataTableConfigHelperTest.testSetupNothingDefinedInConfiguration called."); try { WrappedMetadataTableConfigHelper uut = new WrappedMetadataTableConfigHelper(); Configuration config = this.createMockConfiguration(); Logger log = this.createMockLogger(); this.configuration.put(ShardedDataTypeHandler.METADATA_TABLE_NAME, MetadataTableConfigHelperTest.TABLE_NAME); try { uut.setup(MetadataTableConfigHelperTest.BAD_TABLE_NAME, config, log); } catch (IllegalArgumentException iae) { String msg = iae.getMessage(); Assert.assertTrue("MetadataTableConfigHelper.setup threw the expected exception, but the message was not the expected message.", msg.startsWith("No Such Table: ")); } } finally { MetadataTableConfigHelperTest.logger.info("MetadataTableConfigHelperTest.testSetupNothingDefinedInConfiguration completed."); } }