@@ -0,0 +1,2298 @@
+/* LanguageTool plugin for Oxygen XML editor%0A * Copyright (C) 2015 Daniel Naber (http://www.danielnaber.de)%0A *%0A * This library is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU Lesser General Public%0A * License as published by the Free Software Foundation; either%0A * version 2.1 of the License, or (at your option) any later version.%0A *%0A * This library is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this library; if not, write to the Free Software%0A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301%0A * USA%0A */%0Apackage org.languagetool.oxygen;%0A%0Aimport org.junit.Test;%0A%0Aimport static org.hamcrest.core.Is.is;%0Aimport static org.junit.Assert.*;%0A%0Apublic class LanguageAttributeDetectorTest %7B%0A%0A  @Test%0A  public void test() %7B%0A    LanguageAttributeDetector detector = new LanguageAttributeDetector();%0A    assertNull(detector.getDocumentLanguage(%22%22));%0A    assertNull(detector.getDocumentLanguage(%22%3Cx%3E%3C/x%3E%22));%0A    assertThat(detector.getDocumentLanguage(%22%3Cx lang='en'%3E%3C/x%3E%22), is(%22en%22));%0A    assertThat(detector.getDocumentLanguage(%22%3Cx lang='foobar'%3E%3C/x%3E%22), is(%22foobar%22));%0A    assertThat(detector.getDocumentLanguage(%22%3Cx lang=%5C%22de-DE%5C%22%3E%3C/x%3E%22), is(%22de-DE%22));%0A    assertThat(detector.getDocumentLanguage(%22%3Cx lang='de-DE'%3E%3C/x%3E%22), is(%22de-DE%22));%0A    assertThat(detector.getDocumentLanguage(%22%3Cx xml:lang=%5C%22de-DE%5C%22%3E%3C/x%3E%22), is(%22de-DE%22));%0A    assertThat(detector.getDocumentLanguage(%22%3Cx xml:lang='de-DE'%3E%3C/x%3E%22), is(%22de-DE%22));%0A    // first occurrence wins:%0A    assertThat(detector.getDocumentLanguage(%22%3Cx xml:lang='de-DE'%3E%3Cp lang='xx'%3E%3C/p%3E%3C/x%3E%22), is(%22de-DE%22));%0A    assertThat(detector.getDocumentLanguage(%22%3Cx xml:lang='de-DE'%3E%3Cp xml:lang='xx'%3E%3C/p%3E%3C/x%3E%22), is(%22de-DE%22));%0A    // invalid XML:%0A    assertNull(detector.getDocumentLanguage(%22%3Cx%22));%0A    assertNull(detector.getDocumentLanguage(%22%3Cx xml:lang='de-DE'%3E%3Cp%22));%0A    assertNull(detector.getDocumentLanguage(%22%3Cx xml:lang='de-DE'%3Ep%3E%22));%0A    assertNull(detector.getDocumentLanguage(%22%3Cx xml:lang='de-DE'%3E%3C/x%3E%3Cx%3E%3C/x%3E%22));%0A  %7D%0A  %0A%7D%0A

add test case