@Test
public void compileAndLoadClass() throws Exception {

    Map<String, String> source = singletonMap("org.kie.memorycompiler.ExampleClass", EXAMPLE_CLASS);
    Map<String, Class<?>> compiled = KieMemoryCompiler.compile(source, this.getClass().getClassLoader());
    Class<?> exampleClazz = compiled.get("org.kie.memorycompiler.ExampleClass");
    assertThat(exampleClazz, is(notNullValue()));
    Object instance = exampleClazz.getDeclaredConstructors()[0].newInstance();
    Method sumMethod = exampleClazz.getMethod("sum", Integer.class, Integer.class);
    Object result = sumMethod.invoke(instance, 2, 3);
    assertThat(result, is(5));
}