Ejemplo n.º 1
0
  /** Test of setInternal method, of class BitstreamFormat. */
  @Test
  public void testSetInternal() {
    assertFalse("testSetInternal 0", bf.isInternal());

    bf.setInternal(true);

    assertThat("testSetInternal 1", bf.isInternal(), equalTo(true));
  }
Ejemplo n.º 2
0
  /** Test of findByShortDescription method, of class BitstreamFormat. */
  @Test
  public void testFindByShortDescription() throws SQLException {
    BitstreamFormat found = BitstreamFormat.findByShortDescription(context, "Adobe PDF");
    assertThat("testFindByShortDescription 0", found, notNullValue());
    assertThat("testFindByShortDescription 1", found.getShortDescription(), equalTo("Adobe PDF"));
    assertFalse("testFindByShortDescription 2", found.isInternal());

    found = BitstreamFormat.findByShortDescription(context, "XML");
    assertThat("testFindByShortDescription 3", found, notNullValue());
    assertThat("testFindByShortDescription 4", found.getShortDescription(), equalTo("XML"));
    assertFalse("testFindByShortDescription 5", found.isInternal());
  }
Ejemplo n.º 3
0
  /** Test of findByMIMEType method, of class BitstreamFormat. */
  @Test
  public void testFindByMIMEType() throws SQLException {
    BitstreamFormat found = BitstreamFormat.findByMIMEType(context, "text/plain");
    assertThat("testFindByMIMEType 0", found, notNullValue());
    assertThat("testFindByMIMEType 1", found.getMIMEType(), equalTo("text/plain"));
    assertFalse("testFindByMIMEType 2", found.isInternal());

    found = BitstreamFormat.findByMIMEType(context, "text/xml");
    assertThat("testFindByMIMEType 3", found, notNullValue());
    assertThat("testFindByMIMEType 4", found.getMIMEType(), equalTo("text/xml"));
    assertFalse("testFindByMIMEType 5", found.isInternal());
  }
Ejemplo n.º 4
0
  /** Test of isInternal method, of class BitstreamFormat. */
  @Test
  public void testIsInternal() throws SQLException {
    assertThat("testIsInternal 0", bf.isInternal(), equalTo(false));

    BitstreamFormat found = BitstreamFormat.findByShortDescription(context, "License");
    assertThat("testIsInternal 1", found.isInternal(), equalTo(true));

    found = BitstreamFormat.findByShortDescription(context, "CC License");
    assertThat("testIsInternal 2", found.isInternal(), equalTo(true));

    assertThat("testIsInternal 3", bunknown.isInternal(), equalTo(false));
  }
Ejemplo n.º 5
0
 /** Test of findUnknown method, of class BitstreamFormat. */
 @Test
 public void testFindUnknown() throws SQLException {
   BitstreamFormat found = BitstreamFormat.findUnknown(context);
   assertThat("testFindUnknown 0", found, notNullValue());
   assertThat("testFindUnknown 1", found.getShortDescription(), equalTo("Unknown"));
   assertFalse("testFindUnknown 2", found.isInternal());
   assertThat("testFindUnknown 3", found.getSupportLevel(), equalTo(0));
 }
Ejemplo n.º 6
0
  /** Test of find method, of class BitstreamFormat. */
  @Test
  public void testFind() throws SQLException {
    BitstreamFormat found = BitstreamFormat.find(context, 1);
    assertThat("testFind 0", found, notNullValue());
    assertThat("testFind 1", found.getShortDescription(), equalTo("Unknown"));

    found = BitstreamFormat.find(context, 2);
    assertThat("testFind 2", found, notNullValue());
    assertThat("testFind 3", found.getShortDescription(), equalTo("License"));
    assertTrue("testFind 4", found.isInternal());
  }
Ejemplo n.º 7
0
  /** Test of findNonInternal method, of class BitstreamFormat. */
  @Test
  public void testFindNonInternal() throws SQLException {

    BitstreamFormat[] found = BitstreamFormat.findNonInternal(context);
    assertThat("testFindNonInternal 0", found, notNullValue());
    int i = 0;
    for (BitstreamFormat b : found) {
      i++;
      assertFalse(
          "testFindNonInternal " + i + " (" + b.getShortDescription() + ")", b.isInternal());
    }
  }
Ejemplo n.º 8
0
  /** Test of create method, of class BitstreamFormat. */
  @Test
  public void testCreateAdmin() throws SQLException, AuthorizeException {
    new NonStrictExpectations() {
      AuthorizeManager authManager;

      {
        AuthorizeManager.isAdmin((Context) any);
        result = true;
      }
    };

    BitstreamFormat found = BitstreamFormat.create(context);
    assertThat("testCreate 0", found, notNullValue());
    assertThat("testCreate 1", found.getDescription(), nullValue());
    assertThat("testCreate 2", found.getMIMEType(), nullValue());
    assertThat("testCreate 3", found.getSupportLevel(), equalTo(-1));
    assertFalse("testCreate 4", found.isInternal());
  }