Package org.languagetool.language

Examples of org.languagetool.language.German


    }
  }

  @Test
  public void testCheck() throws IOException {
    AtomFeedChecker atomFeedChecker = new AtomFeedChecker(new German());
    CheckResult checkResult = atomFeedChecker.checkChanges(getStream());
    List<ChangeAnalysis> changeAnalysis = checkResult.getCheckResults();
    assertThat(changeAnalysis.size(), is(3));

    assertThat(changeAnalysis.get(0).getAddedMatches().size(), is(1));
View Full Code Here


  public void testCheckToDatabase() throws IOException, SQLException {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    dateFormat.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
    initDatabase();
    DatabaseConfig databaseConfig = new DatabaseConfig(DB_URL, "user", "pass");
    AtomFeedChecker atomFeedChecker1 = new AtomFeedChecker(new German(), databaseConfig);
    CheckResult checkResult = atomFeedChecker1.runCheck(getStream());
    List<ChangeAnalysis> changeAnalysis = checkResult.getCheckResults();
    assertThat(changeAnalysis.size(), is(3));

    assertThat(changeAnalysis.get(0).getAddedMatches().size(), is(1));
    assertThat(changeAnalysis.get(0).getAddedMatches().get(0).getRule().getId(), is("DE_AGREEMENT"));
    assertTrue(changeAnalysis.get(0).getAddedMatches().get(0).getErrorContext().contains("Fehler: <err>der Haus</err>"));
    assertThat(changeAnalysis.get(0).getRemovedMatches().size(), is(0));

    assertThat(changeAnalysis.get(1).getAddedMatches().size(), is(0));
    assertThat(changeAnalysis.get(1).getRemovedMatches().size(), is(0));

    assertThat(changeAnalysis.get(2).getAddedMatches().size(), is(0));
    assertThat(changeAnalysis.get(2).getRemovedMatches().size(), is(0));

    Date latestCheckDate1 = atomFeedChecker1.getDatabase().getCheckDates().get("de");
    assertThat(dateFormat.format(latestCheckDate1), is("2013-12-03 10:48"));

    AtomFeedChecker atomFeedChecker2 = new AtomFeedChecker(new German(), databaseConfig);
    CheckResult checkResult2 = atomFeedChecker2.runCheck(getStream());
    List<ChangeAnalysis> changeAnalysis2 = checkResult2.getCheckResults();
    // All articles could be skipped as they have been checked in the previous run:
    assertThat(changeAnalysis2.size(), is(0));
    assertThat(atomFeedChecker2.getDatabase().getCheckDates().size(), is(1));
View Full Code Here

TOP

Related Classes of org.languagetool.language.German

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.