DefaultEntityResolver2 implements EntityResolver2 { protected InputSource getClassPathInputSource(final String publicId, final String systemId, final String path) { final InputStream stream = ClassPathLoader.getLatest().getResourceAsStream(getClass(), path); if (null == stream) { return null; } final InputSource inputSource = new InputSource(stream); inputSource.setPublicId(publicId); inputSource.setSystemId(systemId); return inputSource; }  @Override InputSource resolveEntity(final String publicId, final String systemId); @Override InputSource getExternalSubset(final String name, final String baseURI); @Override InputSource resolveEntity(final String name, final String publicId, final String baseURI,
      final String systemId);  }
@Test public void shouldBeMockable() throws Exception { DefaultEntityResolver2 mockDefaultEntityResolver2 = mock(DefaultEntityResolver2.class); InputSource inputSource = new InputSource(); when(mockDefaultEntityResolver2.getClassPathInputSource(eq("publicId"), eq("systemId"), eq("path"))).thenReturn(inputSource); assertThat(mockDefaultEntityResolver2.getClassPathInputSource("publicId", "systemId", "path")) .isSameAs(inputSource); }