Source:
<code>public void testInsertingCourseItem() throws AuthenticationException, DatabaseAccessException, NoSuchAlgorithmException { identityManager.createNewItem(TEACHER_USER_ID, TEACHER_AUTH_ID, VALID_ITEM_ID, VALID_ITEM_TYPE, null, null); final DBObject dbItemObject = db.getCollection(getCollectionFromType(VALID_ITEM_TYPE)).findOne(new ObjectId(VALID_ITEM_ID)); Assert.assertEquals(VALID_ITEM_ID, dbItemObject.get(DatabaseStringConstants.COURSE_ID).toString()); Assert.assertEquals(TEACHER_USER_ID, dbItemObject.get(DatabaseStringConstants.OWNER_ID).toString()); final DBCursor cursor = db.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION).find(); final DBObject dbObject = cursor.next(); System.out.println(dbObject); Assert.assertEquals(VALID_ITEM_ID, dbObject.get(DatabaseStringConstants.COURSE_ID).toString()); String salt = HashManager.generateUnSecureSalt(dbObject.get(DatabaseStringConstants.COURSE_ID).toString()); String hash = null; try { hash = HashManager.toHex(HashManager.createHash(TEACHER_USER_ID, salt).getBytes()); <START> } catch (NoSuchAlgorithmException e) { <END> e.printStackTrace(); } catch (AuthenticationException e) { e.printStackTrace(); } DBObject nonUsers = new BasicDBObject(); nonUsers.put(TEACHER_USER_ID, hash); DBObject adminGroup = (DBObject) dbObject.get(DatabaseStringConstants.NON_USER_LIST); Assert.assertEquals(nonUsers, adminGroup); DBObject students = new BasicDBObject(); DBObject studentGroup = (DBObject) dbObject.get(DatabaseStringConstants.USER_LIST); Assert.assertEquals(students, studentGroup); List<String> userList = (List<String>) dbItemObject.get(DatabaseStringConstants.USER_LIST); Assert.assertEquals(dbObject.get(DatabaseStringConstants.SELF_ID), userList.get(0)); }</code><technical_language>combine catches please</technical_language>

Target:
public void testInsertingCourseItem() throws AuthenticationException, DatabaseAccessException, NoSuchAlgorithmException { identityManager.createNewItem(TEACHER_USER_ID, TEACHER_AUTH_ID, VALID_ITEM_ID, VALID_ITEM_TYPE, null, null); final DBObject dbItemObject = db.getCollection(getCollectionFromType(VALID_ITEM_TYPE)).findOne(new ObjectId(VALID_ITEM_ID)); Assert.assertEquals(VALID_ITEM_ID, dbItemObject.get(DatabaseStringConstants.COURSE_ID).toString()); Assert.assertEquals(TEACHER_USER_ID, dbItemObject.get(DatabaseStringConstants.OWNER_ID).toString()); final DBCursor cursor = db.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION).find(); final DBObject dbObject = cursor.next(); System.out.println(dbObject); Assert.assertEquals(VALID_ITEM_ID, dbObject.get(DatabaseStringConstants.COURSE_ID).toString()); String salt = HashManager.generateUnSecureSalt(dbObject.get(DatabaseStringConstants.COURSE_ID).toString()); String hash = null; try { hash = HashManager.toHex(HashManager.createHash(TEACHER_USER_ID, salt).getBytes()); } catch (NoSuchAlgorithmException | AuthenticationException e) { e.printStackTrace(); } DBObject nonUsers = new BasicDBObject(); nonUsers.put(TEACHER_USER_ID, hash); DBObject adminGroup = (DBObject) dbObject.get(DatabaseStringConstants.NON_USER_LIST); Assert.assertEquals(nonUsers, adminGroup); DBObject students = new BasicDBObject(); DBObject studentGroup = (DBObject) dbObject.get(DatabaseStringConstants.USER_LIST); Assert.assertEquals(students, studentGroup); List<String> userList = (List<String>) dbItemObject.get(DatabaseStringConstants.USER_LIST); Assert.assertEquals(dbObject.get(DatabaseStringConstants.SELF_ID), userList.get(0)); }