Esempio n. 1
0
  @Test
  public void testReadAndWriteBack() throws Exception {

    InputStream is = this.getClass().getResourceAsStream(INPUT);
    OutputStream os = new FileOutputStream(testFolder.newFile("layer-output.xml"));

    TextLayer layer = TestUtils.read(TextLayerStored.class, is);
    System.out.println(layer);
    TestUtils.write(layer, os);

    is.close();
    os.close();

    Assert.assertEquals("Peter aß eine Käsepizza. Sie schmeckte ihm.", layer.getText());
  }
Esempio n. 2
0
  @Test
  public void testReadAndWriteBack() throws Exception {

    InputStream is = this.getClass().getResourceAsStream(INPUT);
    OutputStream os = new FileOutputStream(testFolder.newFile(OUTPUT));

    FrequenciesLayer layer = TestUtils.read(FrequenciesLayerStored.class, is);
    System.out.println(layer);
    TestUtils.write(layer, os);

    is.close();
    os.close();

    assertEquals(8, layer.size());
    assertEquals(FrequencyType.absolute, layer.getType());
    assertEquals(100, layer.getFrequency(0).getValue(), delta);
    assertEquals(107, layer.getFrequency(layer.size() - 1).getValue(), delta);
  }