/** Test of setSupportLevel method, of class BitstreamFormat. */ @Test public void testSetSupportLevelValidValues() { bf.setSupportLevel(BitstreamFormat.UNKNOWN); assertThat( "testSetSupportLevelValidValues 0", bf.getSupportLevel(), equalTo(BitstreamFormat.UNKNOWN)); bf.setSupportLevel(BitstreamFormat.KNOWN); assertThat( "testSetSupportLevelValidValues 1", bf.getSupportLevel(), equalTo(BitstreamFormat.KNOWN)); bf.setSupportLevel(BitstreamFormat.SUPPORTED); assertThat( "testSetSupportLevelValidValues 2", bf.getSupportLevel(), equalTo(BitstreamFormat.SUPPORTED)); }
/** 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)); }
/** Test of getSupportLevel method, of class BitstreamFormat. */ @Test public void testGetSupportLevel() throws SQLException { assertTrue("testGetSupportLevel 0", bf.getSupportLevel() >= 0); assertTrue("testGetSupportLevel 1", bf.getSupportLevel() <= 2); assertTrue("testGetSupportLevel 2", bunknown.getSupportLevel() >= 0); assertTrue("testGetSupportLevel 3", bunknown.getSupportLevel() <= 2); BitstreamFormat[] found = BitstreamFormat.findAll(context); int i = 0; for (BitstreamFormat b : found) { i++; assertTrue( "testGetSupportLevel " + i + " (" + b.getMIMEType() + ")", b.getSupportLevel() >= 0); i++; assertTrue( "testGetSupportLevel " + i + " (" + b.getMIMEType() + ")", b.getSupportLevel() <= 2); } }
/** 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()); }