### Question:
SchemaConfigured implements HeapSize, SchemaAware { public void passSchemaMetricsTo(SchemaConfigured target) { if (isNull()) { resetSchemaMetricsConf(target); return; } if (!isSchemaConfigured()) { throw new IllegalStateException("Table name/CF not initialized: " + schemaConfAsJSON()); } if (conflictingWith(target)) { throw new IllegalArgumentException("Trying to change table name to \"" + tableName + "\", CF name to \"" + cfName + "\" from " + target.schemaConfAsJSON()); } target.tableName = tableName.intern(); target.cfName = cfName.intern(); target.schemaMetrics = schemaMetrics; target.schemaConfigurationChanged(); } private  SchemaConfigured(Configuration conf);  SchemaConfigured();  SchemaConfigured(Configuration conf, Path path);  SchemaConfigured(Path path);  SchemaConfigured(Configuration conf, String tableName, String cfName);  SchemaConfigured(SchemaAware that); static SchemaConfigured createUnknown(); @Override String getTableName(); @Override String getColumnFamilyName(); @Override SchemaMetrics getSchemaMetrics(); void passSchemaMetricsTo(SchemaConfigured target); static void resetSchemaMetricsConf(SchemaConfigured target); @Override long heapSize(); String schemaConfAsJSON(); static final int SCHEMA_CONFIGURED_UNALIGNED_HEAP_SIZE; }### Answer:
@Test(expected=IllegalStateException.class) public void testConfigureWithUnconfigured1() { SchemaConfigured unconfigured = new SchemaConfigured(null, "t1", null); SchemaConfigured target = new SchemaConfigured(); unconfigured.passSchemaMetricsTo(target); }
@Test(expected=IllegalStateException.class) public void testConfigureWithUnconfigured2() { SchemaConfigured unconfigured = new SchemaConfigured(null, null, "cf1"); SchemaConfigured target = new SchemaConfigured(); unconfigured.passSchemaMetricsTo(target); }
@Test(expected=IllegalArgumentException.class) public void testConflictingConf() { SchemaConfigured sc = new SchemaConfigured(null, "t1", "cf1"); SchemaConfigured target = new SchemaConfigured(null, "t2", "cf1"); sc.passSchemaMetricsTo(target); }
@Test public void testTmpPath() { SchemaConfigured sc = new SchemaConfigured(null, "myTable", "myCF"); SchemaConfigured target = new SchemaConfigured(TMP_HFILE_PATH); sc.passSchemaMetricsTo(target); }
@Test(expected=IllegalArgumentException.class) public void testTmpPathButInvalidTable() { SchemaConfigured sc = new SchemaConfigured(null, "anotherTable", "myCF"); SchemaConfigured target = new SchemaConfigured(TMP_HFILE_PATH); sc.passSchemaMetricsTo(target); }