/** 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()); }
/** * This method will be run before every test as per @Before. It will initialize resources required * for the tests. * * <p>Other methods can be annotated with @Before here or in subclasses but no execution order is * guaranteed */ @Before @Override public void init() { super.init(); try { bf = BitstreamFormat.find(context, 5); bunknown = BitstreamFormat.findUnknown(context); } catch (SQLException ex) { log.error("SQL Error in init", ex); fail("SQL Error in init: " + ex.getMessage()); } }
/** 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()); }
/** Test of update method, of class BitstreamFormat. */ @Test public void testUpdateAdmin() throws SQLException, AuthorizeException { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.isAdmin((Context) any); result = true; } }; String desc = "Test description"; bf.setDescription(desc); bf.update(); BitstreamFormat b = BitstreamFormat.find(context, 5); assertThat("testUpdateAdmin 0", b.getDescription(), equalTo(desc)); }