@Test
public void testRemovingClassFile() throws IOException {

  ourLoggerInstance = new DefaultLogger("") {
    @Override
    public void error(@NonNls String message, @Nullable Throwable t, @NonNls @NotNull String... details) {
      fail("Logger shouldn't receive any error calls");
    }
  };
  File classSource = new File(AndroidTestBase.getTestDataPath(), "rendering/renderClassLoader/MyJarClass.class");
  byte[] classBytes = Files.readAllBytes(classSource.toPath());
  RenderClassLoader loader = new RenderClassLoader(this.getClass().getClassLoader()) {
    @Override
    protected List<URL> getExternalJars() {
      return ImmutableList.of();
    }
    @NotNull
    @Override
    protected Class<?> defineClassAndPackage(@NotNull String name, @NotNull byte[] b, int offset, int len) {
      // We do not really want to define the class in the test, only make sure that this call is made.
      return RenderClassLoaderTest.class;
    }
  };
  VirtualFile vFile = mock(VirtualFile.class);
  when(vFile.contentsToByteArray()).thenReturn(classBytes);
  assertEquals(RenderClassLoaderTest.class, loader.loadClassFile("com.myjar.MyJarClass", vFile));
  vFile = mock(VirtualFile.class);
  when(vFile.contentsToByteArray()).thenThrow(new FileNotFoundException(""));
  assertNull(loader.loadClassFile("com.myjar.MyJarClass", vFile));
}