DefaultResourceHandler implements IResourceHandler { protected String buildCheckSum(Object content) { if (content instanceof String) { return Checksum.checksum((String) content); } else if (content instanceof byte[]) { return Checksum.checksum((byte[]) content); } else { throw new RuntimeException("Unsupported content type!"); } }  @Override byte[] getBinaryContent(IResource resource, IResourceContext context); @Override String getContent(IResource resource, IResourceContext context); @Override String getUrl(IResource resource, IResourceContext context);  }
@Test public void testBuildCheckSum() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Class<DefaultResourceHandler> clazz = DefaultResourceHandler.class; Method method = clazz.getDeclaredMethod("buildCheckSum", Object.class); method.setAccessible(true); String str = "test string for buildCheckSum"; Assert.assertEquals(Checksum.checksum(str), (String)method.invoke(m_handler, str)); try { method.invoke(m_handler, new Object()); } catch (Exception e) { Assert.assertTrue(e instanceof Exception); } }