@Test public void shouldCreateReadableUsage() { String usage = AnalyzerGuruHelp.getUsage(); assertTrue("usage is not empty", !usage.isEmpty()); assertTrue("usage contains \"*.\"", usage.contains("*.")); assertTrue("usage contains \"#!\"", usage.contains("#!")); }
public static String getUsage() { StringBuilder b = new StringBuilder(); b.append("AnalyzerGuru prefixes:\n"); byKey(AnalyzerGuru.getPrefixesMap()).forEach((kv) -> { b.append(String.format("%-10s : %s\n", reportable(kv.key + '*'), reportable(kv.fac))); }); b.append("\nAnalyzerGuru extensions:\n"); byKey(AnalyzerGuru.getExtensionsMap()).forEach((kv) -> { b.append(String.format("*.%-7s : %s\n", reportable(kv.key.toLowerCase(Locale.ROOT)), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic strings:\n"); byFactory(AnalyzerGuru.getMagicsMap()).forEach((kv) -> { b.append(String.format("%-23s : %s\n", reportable(kv.key), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic matchers:\n"); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (m.getIsPreciseMagic()) { b.append(reportable(m)); } }); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (!m.getIsPreciseMagic()) { b.append(reportable(m)); } }); return b.toString(); }
AnalyzerGuruHelp { public static String getUsage() { StringBuilder b = new StringBuilder(); b.append("AnalyzerGuru prefixes:\n"); byKey(AnalyzerGuru.getPrefixesMap()).forEach((kv) -> { b.append(String.format("%-10s : %s\n", reportable(kv.key + '*'), reportable(kv.fac))); }); b.append("\nAnalyzerGuru extensions:\n"); byKey(AnalyzerGuru.getExtensionsMap()).forEach((kv) -> { b.append(String.format("*.%-7s : %s\n", reportable(kv.key.toLowerCase(Locale.ROOT)), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic strings:\n"); byFactory(AnalyzerGuru.getMagicsMap()).forEach((kv) -> { b.append(String.format("%-23s : %s\n", reportable(kv.key), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic matchers:\n"); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (m.getIsPreciseMagic()) { b.append(reportable(m)); } }); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (!m.getIsPreciseMagic()) { b.append(reportable(m)); } }); return b.toString(); } }
AnalyzerGuruHelp { public static String getUsage() { StringBuilder b = new StringBuilder(); b.append("AnalyzerGuru prefixes:\n"); byKey(AnalyzerGuru.getPrefixesMap()).forEach((kv) -> { b.append(String.format("%-10s : %s\n", reportable(kv.key + '*'), reportable(kv.fac))); }); b.append("\nAnalyzerGuru extensions:\n"); byKey(AnalyzerGuru.getExtensionsMap()).forEach((kv) -> { b.append(String.format("*.%-7s : %s\n", reportable(kv.key.toLowerCase(Locale.ROOT)), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic strings:\n"); byFactory(AnalyzerGuru.getMagicsMap()).forEach((kv) -> { b.append(String.format("%-23s : %s\n", reportable(kv.key), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic matchers:\n"); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (m.getIsPreciseMagic()) { b.append(reportable(m)); } }); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (!m.getIsPreciseMagic()) { b.append(reportable(m)); } }); return b.toString(); } private  AnalyzerGuruHelp(); }
AnalyzerGuruHelp { public static String getUsage() { StringBuilder b = new StringBuilder(); b.append("AnalyzerGuru prefixes:\n"); byKey(AnalyzerGuru.getPrefixesMap()).forEach((kv) -> { b.append(String.format("%-10s : %s\n", reportable(kv.key + '*'), reportable(kv.fac))); }); b.append("\nAnalyzerGuru extensions:\n"); byKey(AnalyzerGuru.getExtensionsMap()).forEach((kv) -> { b.append(String.format("*.%-7s : %s\n", reportable(kv.key.toLowerCase(Locale.ROOT)), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic strings:\n"); byFactory(AnalyzerGuru.getMagicsMap()).forEach((kv) -> { b.append(String.format("%-23s : %s\n", reportable(kv.key), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic matchers:\n"); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (m.getIsPreciseMagic()) { b.append(reportable(m)); } }); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (!m.getIsPreciseMagic()) { b.append(reportable(m)); } }); return b.toString(); } private  AnalyzerGuruHelp(); static String getUsage(); }
AnalyzerGuruHelp { public static String getUsage() { StringBuilder b = new StringBuilder(); b.append("AnalyzerGuru prefixes:\n"); byKey(AnalyzerGuru.getPrefixesMap()).forEach((kv) -> { b.append(String.format("%-10s : %s\n", reportable(kv.key + '*'), reportable(kv.fac))); }); b.append("\nAnalyzerGuru extensions:\n"); byKey(AnalyzerGuru.getExtensionsMap()).forEach((kv) -> { b.append(String.format("*.%-7s : %s\n", reportable(kv.key.toLowerCase(Locale.ROOT)), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic strings:\n"); byFactory(AnalyzerGuru.getMagicsMap()).forEach((kv) -> { b.append(String.format("%-23s : %s\n", reportable(kv.key), reportable(kv.fac))); }); b.append("\nAnalyzerGuru magic matchers:\n"); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (m.getIsPreciseMagic()) { b.append(reportable(m)); } }); AnalyzerGuru.getAnalyzerFactoryMatchers().forEach((m) -> { if (!m.getIsPreciseMagic()) { b.append(reportable(m)); } }); return b.toString(); } private  AnalyzerGuruHelp(); static String getUsage();  }