### Question:
Bundle extends DSpaceObject { public Bitstream createBitstream(InputStream is) throws AuthorizeException, IOException, SQLException { AuthorizeManager.authorizeAction(ourContext, this, Constants.ADD); Bitstream b = Bitstream.create(ourContext, is); addBitstream(b); return b; } Bundle(Context context, TableRow row); static Bundle find(Context context, int id); int getID(); String getName(); void setName(String name); int getPrimaryBitstreamID(); void setPrimaryBitstreamID(int bitstreamID); void unsetPrimaryBitstreamID(); String getHandle(); Bitstream getBitstreamByName(String name); Bitstream[] getBitstreams(); Item[] getItems(); Bitstream createBitstream(InputStream is); Bitstream registerBitstream(int assetstore, String bitstreamPath); void addBitstream(Bitstream b); void setOrder(int bitstreamIds[]); void removeBitstream(Bitstream b); void update(); int getType(); void inheritCollectionDefaultPolicies(Collection c); void replaceAllBitstreamPolicies(List<ResourcePolicy> newpolicies); List<ResourcePolicy> getBundlePolicies(); List<ResourcePolicy> getBitstreamPolicies(); DSpaceObject getAdminObject(int action); DSpaceObject getParentObject();  }### Answer:
@Test(expected=AuthorizeException.class) public void testCreateBitstreamNoAuth() throws FileNotFoundException, AuthorizeException, SQLException, IOException { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.authorizeAction((Context) any, (Bundle) any, Constants.ADD); result = new AuthorizeException(); } }; String name = "name"; File f = new File(testProps.get("test.bitstream").toString()); Bitstream bs = b.createBitstream(new FileInputStream(f)); fail("Exception should be thrown"); }