UnProxyClassServices { String getRealClassname(String proxyname) throws ClassNotFoundException { int index = proxyname.indexOf('$'); if (index != -1) { return proxyname.substring(0, index); } else { throw new ClassNotFoundException(); } }  Class<?> getRealClass(Class proxy);  }
@Test public void testGetRealClassname() throws ClassNotFoundException { System.out.println("getRealClassname"); String proxyname = "java.lang.String$Proxy"; String result = instance.getRealClassname(proxyname); assertThat(result).isEqualTo("java.lang.String"); }
@Test(expected = ClassNotFoundException.class) public void testGetRealClassnameNotProxy() throws ClassNotFoundException { System.out.println("getRealClassname"); String proxyname = "java.lang.String"; instance.getRealClassname(proxyname); }