RazorCodeLanguage { @Nullable public static RazorCodeLanguage getLanguageByExtension(@Nonnull String fileExtension) { checkArgument(!Strings.isNullOrEmpty(fileExtension)); RazorCodeLanguage language = null; if (fileExtension.charAt(0) == '.') { fileExtension = fileExtension.substring(1); } if (getLanguages().containsKey(fileExtension)) { language = getLanguages().get(fileExtension); } return language; }  static Map<String, RazorCodeLanguage> getLanguages(); abstract String getLanguageName(); abstract Class<T> getCodeDomProviderType(); @Nullable static RazorCodeLanguage getLanguageByExtension(@Nonnull String fileExtension); abstract ParserBase createCodeParser(); abstract RazorCodeGenerator createCodeGenerator(final String className, final String rootNamespaceName,
                                                           final String sourceFileName, final RazorEngineHost host
                                                          );  }
@Test public void getServiceByExtensionReturnsEntryMatchingExtensionWithoutPreceedingDot() { assertThat(RazorCodeLanguage.getLanguageByExtension("rzhtml"), instanceOf(JavaRazorCodeLanguage.class)); }
@Test public void getServiceByExtensionReturnsEntryMatchingExtensionWithPreceedingDot() { assertThat(RazorCodeLanguage.getLanguageByExtension(".rzhtml"), instanceOf(JavaRazorCodeLanguage.class)); }
@Test public void getServiceByExtensionReturnsNullIfNoServiceForSpecifiedExtension() { assertThat(RazorCodeLanguage.getLanguageByExtension("floozy"), is(nullValue())); }
@Test public void multipleCallsToGetServiceWithSameExtensionReturnSameObject() { final RazorCodeLanguage expected = RazorCodeLanguage.getLanguageByExtension("rzhtml"); final RazorCodeLanguage actual = RazorCodeLanguage.getLanguageByExtension("rzhtml"); assertSame(expected, actual); }