@Test
  public void testLoadCompleteModelWithDbId() {
    try {
      Model mockModel = ModelFactory.createModelWithMultipleLinks();
      Model loadedModel = papi.loadCompleteModelWithDbId(mockModelId);
      assertNotNull(loadedModel);
      assertEquals(loadedModel.getDbId(), mockModelId);
      assertEquals(loadedModel.getTitle(), mockModel.getTitle());
      assertEquals(loadedModel.getImportedId(), mockModel.getImportedId());
      assertEquals(loadedModel.getOrigin(), mockModel.getOrigin());
      assertEquals(
          loadedModel.getLatestRevision().getRevisionNumber(),
          mockModel.getLatestRevision().getRevisionNumber());
      assertEquals(loadedModel.getNrOfRevisions(), mockModel.getNrOfRevisions());
      assertEquals(loadedModel.getNrOfRepresentations(), mockModel.getNrOfRepresentations());
      loadedModel.toStringExtended();

      // not existent
      Model m1 = papi.loadCompleteModelWithDbId(NonExistentClusterId);
      assertNull(m1);
      Model m2 = papi.loadCompleteModelWithDbId(wrongModId);
      assertNull(m2);

    } catch (Exception e) {
      fail(e.getMessage());
    }

    // wrong input
    try {
      papi.loadCompleteModelWithDbId(AbcId);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }
  }
  @Test
  public void testLoadRepresentationsWithIds() {
    ArrayList<String> repIds = null;
    List<Representation> reps = null;
    try {
      // prepare a list of ids
      Model m = papi.loadCompleteModelWithDbId(mockModelId);
      repIds = new ArrayList<String>();
      for (Revision r : m.getRevisions()) {
        Representation oneRep = r.getRepresentations().iterator().next();
        repIds.add(oneRep.getDbId());
      }
      // load list
      reps = papi.loadRepresentations(repIds);
      assertEquals(reps.size(), repIds.size());
      for (Representation rep : reps) {
        assertTrue(repIds.contains(rep.getDbId()));
        assertEquals(rep.getModel().getDbId(), mockModelId);
      }
      // empty list
      reps = papi.loadRepresentations(new ArrayList<String>());
      assertTrue(reps.isEmpty());
    } catch (Exception e) {
      fail(e.getMessage());
    }

    try {
      // non-existent representation id
      repIds.add(wrongRepId);
      reps = papi.loadRepresentations(repIds);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }

    try {
      // non-existent id
      repIds.add(NonExistentClusterId);
      reps = papi.loadRepresentations(repIds);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }
    try {
      // wrong input
      repIds.add(AbcId);
      reps = papi.loadRepresentations(repIds);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }
  }
  @Test
  public void testLoadPojosWithIds() {
    ArrayList<String> repIds = null;
    List<AbstractPojo> pojos = null;
    try {
      // prepare a list of ids
      Model m = papi.loadCompleteModelWithDbId(mockModelId);
      m.toStringExtended();
      repIds = new ArrayList<String>();
      for (Revision r : m.getRevisions()) {
        Representation oneRep = r.getRepresentations().iterator().next();
        repIds.add(oneRep.getDbId());
      }
      // load list
      pojos = papi.loadPojos(repIds);
      assertEquals(pojos.size(), repIds.size());
      for (AbstractPojo pojo : pojos) {
        Representation rep = (Representation) pojo;
        assertTrue(repIds.contains(rep.getDbId()));
        assertEquals(rep.getModel().getDbId(), mockModelId);
      }

      // empty list
      pojos = papi.loadPojos(new ArrayList<String>());
      assertTrue(pojos.isEmpty());

    } catch (Exception e) {
      fail(e.getMessage());
    }

    try {
      // non-existent id
      repIds.add(NonExistentClusterId);
      pojos = papi.loadPojos(repIds);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }
    try {
      repIds.remove(NonExistentClusterId);
      repIds.add(AbcId);
      pojos = papi.loadPojos(repIds);
      fail();
    } catch (IllegalArgumentException e) {
      assert (true);
    }
  }