Skip to content

Instantly share code, notes, and snippets.

@pkdevel
Created July 8, 2016 07:50
Show Gist options
  • Save pkdevel/073e78ae980675eac81624f067fb9114 to your computer and use it in GitHub Desktop.
Save pkdevel/073e78ae980675eac81624f067fb9114 to your computer and use it in GitHub Desktop.
package com.transporeon.tpm.core.service.impl;
import java.lang.reflect.Field;
import org.junit.Before;
import org.junit.Test;
public final class MagicTest {
@Before
public void before() {
}
@Test
public void test() throws Exception {
System.out.println("Hello World!");
magic();
System.out.println("Hello World!");
System.out.println("Hello chris");
}
private static void magic() throws NoSuchFieldException, IllegalAccessException {
final Field field = String.class.getDeclaredField("value");
field.setAccessible(true);
field.set("Hello World!", "lol".toCharArray());
field.set("Hello chris", "Hello pimmelp".toCharArray());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment