### Question:
MetadataDocAttributeExtractor { public static String formatAttributeKey(TagType tagType, String paramName) { Validate.notNull(tagType, "Tag type is null"); Validate.notBlank(paramName, "Param name is blank"); if (tagType.paramIndex(paramName) == null) { throw new IllegalArgumentException( String.format("Tag %s has no parameter '%s'", tagType, paramName)); } return String.format(KEY_TEMPLATE, tagType.name(), paramName); } private  MetadataDocAttributeExtractor(); static Map<String, List<Object>> extract(String doc); static Map<String, List<Object>> extract(List<Part> parts); static String formatAttributeKey(TagType tagType, String paramName); static boolean isAttributeKey(String key);  }### Answer:
@Test public void testAttributeKeyFormatted() throws Exception { Assert.assertEquals( "SQL_TABLE.database", MetadataDocAttributeExtractor.formatAttributeKey(TagType.SQL_TABLE, "database")); Assert.assertEquals( "FOREIGN_KEY.field", MetadataDocAttributeExtractor.formatAttributeKey(TagType.FOREIGN_KEY, "field")); Assert.assertEquals( "LINK.title", MetadataDocAttributeExtractor.formatAttributeKey(TagType.LINK, "title")); }
@Test(expected=Exception.class) public void testAttributeKeyFormattingFailedOnInvalidArgument1() throws Exception { MetadataDocAttributeExtractor.formatAttributeKey(null, "database"); }
@Test(expected=Exception.class) public void testAttributeKeyFormattingFailedOnInvalidArgument2() throws Exception { MetadataDocAttributeExtractor.formatAttributeKey(TagType.SQL_TABLE, null); }
@Test(expected=Exception.class) public void testAttributeKeyFormattingFailedOnInvalidArgument3() throws Exception { MetadataDocAttributeExtractor.formatAttributeKey(TagType.SQL_TABLE, ""); }
@Test(expected=Exception.class) public void testAttributeKeyFormattingFailedOnInvalidArgument4() throws Exception { MetadataDocAttributeExtractor.formatAttributeKey(TagType.SQL_TABLE, "database__"); }