classloader example

This commit is contained in:
Raksha Rao
2018-02-05 11:09:34 +05:30
parent f12497c18b
commit 2f31b4a8cc
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
package com.baeldung.classloader;
import org.junit.Test;
import static org.junit.Assert.*;
public class SampleClassLoaderTest {
@Test(expected = ClassNotFoundException.class)
public void givenAppClassLoader_whenParentClassLoader_thenClassNotFoundException() throws Exception {
SampleClassLoader sampleClassLoader = (SampleClassLoader) Class.forName(SampleClassLoader.class.getName()).newInstance();
sampleClassLoader.loadClass();
}
}