BaseResource { protected static <T> T ensureExists(T value) { if (value == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } return value; }    }
@Test public void testEnsureExists() { final Object value = new Object(); assertTrue("expected same object reference value", value == BaseResource.ensureExists(value)); }
@Test(expected = WebApplicationException.class) public void testEnsureExistsThrows() { BaseResource.ensureExists(null); }