ItemEventProcessor extends ExportEventProcessor { protected String addObjectSpecificData(final String string, Item item) throws UnsupportedEncodingException { StringBuilder data = new StringBuilder(string); String itemInfo = getItemInfo(item); data.append("&").append(URLEncoder.encode("svc_dat", UTF_8)).append("=") .append(URLEncoder.encode(itemInfo, UTF_8)); data.append("&").append(URLEncoder.encode("rft_dat", UTF_8)).append("=") .append(URLEncoder.encode(ITEM_VIEW, UTF_8)); return data.toString(); } ItemEventProcessor(Context context, HttpServletRequest request, Item item); void processEvent();  }
@Test public void testAddObectSpecificData() throws UnsupportedEncodingException { context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context).build(); Collection collection = CollectionBuilder.createCollection(context, community).build(); Item item = ItemBuilder.createItem(context, collection).build(); context.restoreAuthSystemState(); String encodedHandle = URLEncoder.encode(item.getHandle(), CharEncoding.UTF_8); ItemEventProcessor itemEventProcessor = new ItemEventProcessor(context, null, item); String result = itemEventProcessor.addObjectSpecificData("existing-string", item); assertThat(result, is("existing-string&svc_dat=" + encodedUrl + "%2Fhandle%2F" + encodedHandle + "&rft_dat=Investigation")); }