private void assertRendition(CMISRendition receivedRendition, CMISRendition expectedRendition) {
   assertEquals(expectedRendition.getStreamId(), receivedRendition.getStreamId());
   assertEquals(expectedRendition.getKind(), receivedRendition.getKind());
   assertEquals(expectedRendition.getMimeType(), receivedRendition.getMimeType());
   assertEquals(expectedRendition.getWidth(), receivedRendition.getWidth());
   assertEquals(expectedRendition.getHeight(), receivedRendition.getHeight());
 }
  public void testGetRenditionsByMimetype() throws Exception {
    for (CMISRendition rendition : documentRenditions) {
      testGetRenditionsByMimetype(rendition.getMimeType());
    }
    testGetRenditionsByMimetype(icon16Rendition.getMimeType());
    testGetRenditionsByMimetype(icon32Rendition.getMimeType());

    String[] mimetypes = getDifferentMimetypes();
    testGetRenditionsByMimetype(mimetypes);
  }
 private String[] getDifferentMimetypes() {
   List<CMISRendition> allRenditions = new ArrayList<CMISRendition>(documentRenditions);
   allRenditions.add(icon16Rendition);
   allRenditions.add(icon32Rendition);
   Set<String> mimetypes = new HashSet<String>();
   for (CMISRendition rendition : allRenditions) {
     mimetypes.add(rendition.getMimeType());
   }
   return mimetypes.toArray(new String[0]);
 }
  private void assertRendiions(
      List<CMISRendition> receivedRenditions, List<CMISRendition> expectedRenditions) {
    assertNotNull(receivedRenditions);
    expectedRenditions = removeReplication(expectedRenditions);
    assertTrue(receivedRenditions.size() == expectedRenditions.size());

    for (CMISRendition rendition : receivedRenditions) {
      assertNotNull(rendition);
      assertNotNull(rendition.getStreamId());
    }

    Collections.sort(receivedRenditions, renditionsComparator);
    Collections.sort(expectedRenditions, renditionsComparator);

    for (int i = 0; i < expectedRenditions.size(); ++i) {
      assertRendition(receivedRenditions.get(i), expectedRenditions.get(i));
    }
  }
 private boolean isRenditionSatisfyConditions(
     CMISRendition rendition, String kind, String mimetype) {
   if (kind != null) {
     if (!kind.equals(rendition.getKind())) {
       return false;
     }
   }
   if (mimetype != null) {
     if (mimetype.endsWith("/*")) {
       String baseMimetype = getBaseType(mimetype);
       if (!rendition.getMimeType().startsWith(baseMimetype)) {
         return false;
       }
     } else if (!mimetype.equals(rendition.getMimeType())) {
       return false;
     }
   }
   return true;
 }
 public int compare(CMISRendition rendition1, CMISRendition rendition2) {
   return rendition1.getStreamId().compareTo(rendition2.getStreamId());
 }