Exemplo n.º 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");
  }
Exemplo n.º 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");
  }
Exemplo n.º 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());
  }