예제 #1
0
  /** Test of delete method, of class BitstreamFormat. */
  @Test(expected = IllegalArgumentException.class)
  public void testDeleteUnknown() throws SQLException, AuthorizeException {

    new NonStrictExpectations() {
      AuthorizeManager authManager;

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

    bunknown.delete();
    fail("Exception should have been thrown");
  }
예제 #2
0
  /** Test of delete method, of class BitstreamFormat. */
  @Test(expected = AuthorizeException.class)
  public void testDeleteNotAdmin() throws SQLException, AuthorizeException {

    new NonStrictExpectations() {
      AuthorizeManager authManager;

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

    bf.delete();
    fail("Exception should have been thrown");
  }
예제 #3
0
  /** Test of delete method, of class BitstreamFormat. */
  @Test
  public void testDeleteAdmin() throws SQLException, AuthorizeException {

    new NonStrictExpectations() {
      AuthorizeManager authManager;
      BitstreamFormat unknown;

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

    bf.delete();
    BitstreamFormat b = BitstreamFormat.find(context, 5);
    assertThat("testDeleteAdmin 0", b, nullValue());
  }