@Test
  public void testLoadRepresentation() {
    try {
      Representation mockRep = RepresentationFactory.createLightweightRepresentation();
      Representation loadedRep = papi.loadRepresentation(mockRepresentationId);
      assertNotNull(loadedRep);
      assertEquals(loadedRep.getDbId(), mockRepresentationId);
      assertEquals(loadedRep.getDataContent().length, mockRep.getDataContent().length);
      assertEquals(loadedRep.getFormat(), mockRep.getFormat());
      assertEquals(loadedRep.getNotation(), mockRep.getNotation());
      assertEquals(loadedRep.getOriginalFilePath(), mockRep.getOriginalFilePath());
      assertEquals(loadedRep.getRevisionNumber(), mockRep.getRevisionNumber());
      assertEquals(loadedRep.getTitle(), mockRep.getTitle());
      assertEquals(loadedRep.belongsToLatestRevision(), mockRep.belongsToLatestRevision());

      // not existent
      Representation r1 = papi.loadRepresentation(NonExistentClusterId);
      assertNull(r1);
      Representation r2 = papi.loadRepresentation(wrongRepId);
      assertNull(r2);

    } catch (Exception e) {
      fail("error: testLoad " + e.getMessage());
    }

    // wrong input
    try {
      papi.loadRepresentation(AbcId);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }
  }
  @Test
  public void testLoadRepresentationsWithConfig() {
    try {
      // create config according to saved representation
      Representation mockRepresentation = RepresentationFactory.createLightweightRepresentation();

      DbFilterConfig config = new DbFilterConfig();
      config.addFormat(mockRepresentation.getFormat());
      config.addOrigin(mockRepresentation.getModel().getOrigin());
      config.addNotation(mockRepresentation.getNotation());

      // load
      List<Representation> results = papi.loadRepresentations(config);
      Representation rep = results.get(0);
      Revision rev = rep.getRevision();
      Model mod = rep.getModel();
      assertTrue(results.size() > 0);
      assertEquals(rep.getFormat(), (mockRepresentation.getFormat()));
      assertEquals(rep.getNotation(), mockRepresentation.getNotation());
      assertEquals(mod.getOrigin(), mockRepresentation.getModel().getOrigin());
      assertEquals(
          mod.getLatestRevision(),
          rev); // because the mockRepresentation's model has only 1 revision
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
  // ----------------------------- load 1 object ----------------------------
  @Test
  public void testLoadPojoWithId() {
    try {
      Representation mockRep = RepresentationFactory.createLightweightRepresentation();
      AbstractPojo loadedPojo = papi.loadPojo(mockRepresentationId);
      Representation loadedRep = (Representation) loadedPojo;
      assertEquals(loadedRep.getDbId(), mockRepresentationId);
      assertEquals(loadedRep.getTitle(), mockRep.getTitle());

      // not existent
      AbstractPojo p1 = papi.loadPojo("#-1:-1");
      assertNull(p1);
      AbstractPojo p2 = papi.loadPojo(NonExistentClusterId);
      assertNull(p2);
    } catch (Exception e) {
      fail(e.getMessage());
    }

    // wrong input
    try {
      papi.loadPojo(AbcId);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }
  }
  @BeforeClass
  public static void setUp() {
    try {
      papi = PersistenceApiOrientDbObj.getInstance(Constants.TEST_DB_CONFIG_PATH);
      // don't store mockObjects as class fields for caching reasons
      Model mockModel = ModelFactory.createModelWithMultipleLinks();
      Representation mockRepresentation = RepresentationFactory.createLightweightRepresentation();
      mockModelId = papi.savePojo(mockModel);
      mockRepresentationId = papi.savePojo(mockRepresentation);

      // assure same cluster, but non existent id
      wrongModId = mockModelId + "50";
      wrongRepId = mockRepresentationId + "50";
    } catch (Exception e) {
      e.printStackTrace();
      fail("Unexpected error occurred: " + e.getMessage());
    }
  }