@Test
  public void testFindBySearchTerm() throws Exception {
    IPictogram pictogram = new Pictogram();
    pictogram.setTitle("This is a complex title with an Ümlaut");
    pictogram.setFileIdentifier("test.txt");

    repository.save(pictogram);

    // empty term
    List<IPictogram> hits = repository.findBySearchTerm("", 1, true);
    assertEquals(1, hits.size());

    // unknown term
    hits = repository.findBySearchTerm("complexxxxxx", 1, true);
    assertEquals(0, hits.size());

    // 1 term
    hits = repository.findBySearchTerm("complex", 1, true);
    assertEquals(1, hits.size());

    // 2 terms
    hits = repository.findBySearchTerm("Title complex", 1, true);
    assertEquals(1, hits.size());

    // partial terms
    hits = repository.findBySearchTerm("comp tit", 1, true);
    assertEquals(1, hits.size());
  }
  @Test
  public void testConvertToDocument() throws Exception {
    IPictogram pictogram = new Pictogram();
    pictogram.setTitle("title");
    pictogram.setFileIdentifier("test.txt");

    ODocument document = repository.convertToDocument(pictogram);

    assertEquals("title", document.field("title"));
    assertEquals("test.txt", document.field("fileIdentifier"));

    // class name should be correct
    assertEquals("Pictogram", document.getClassName());

    // save document to get id
    document.save();
    String id = document.getIdentity().toString();

    // set id and test conversion
    pictogram.setId(id);

    ODocument newDocument = repository.convertToDocument(pictogram);

    assertEquals(document.getIdentity().toString(), newDocument.getIdentity().toString());
  }
  @Test
  public void testFindByTitle() throws Exception {
    IPictogram pictogram = new Pictogram();
    pictogram.setTitle("testFindByTitle");
    pictogram.setFileIdentifier("test.txt");

    repository.save(pictogram);

    IPictogram testPictogram = repository.findByTitle(pictogram.getTitle());

    assertEquals(pictogram.getId(), testPictogram.getId());

    // return null for non-existing entities
    testPictogram = repository.findByTitle("NON-EXIST");

    assertEquals(null, testPictogram);
  }