UnProxyClassServices { public Class<?> getRealClass(Class proxy) { try { return Class.forName(getRealClassname(proxy.getName())); } catch (ClassNotFoundException ex) { } return proxy; }  Class<?> getRealClass(Class proxy);  }
@Test public void testGetRealClass() throws ClassNotFoundException { System.out.println("getRealClass"); doReturn("java.lang.String").doThrow(ClassNotFoundException.class).when(instance).getRealClassname(anyString()); Class result = instance.getRealClass(Integer.class); assertThat(result).isEqualTo(String.class); result = instance.getRealClass(Integer.class); assertThat(result).isEqualTo(Integer.class); }