示例#1
0
  /** Test of create method, of class BitstreamFormat. */
  @Test(expected = AuthorizeException.class)
  public void testCreateNotAdmin() throws SQLException, AuthorizeException {
    new NonStrictExpectations() {
      AuthorizeManager authManager;

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

    BitstreamFormat found = BitstreamFormat.create(context);
    fail("Exception should have been thrown");
  }
示例#2
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());
  }