For example below is a code snippet copied and pasted into Gist.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testReflectionNewInstanceViaConstructor() throws Exception{ | |
final String newInstance = String.class.getConstructor(String.class).newInstance("HELLO WORLD"); | |
assertEquals("HELLO WORLD", newInstance); | |
} |