Package org.jacoco.core.test

Examples of org.jacoco.core.test.TargetLoader


    mv.visitInsn(Opcodes.ARETURN);
    mv.visitMaxs(5, 1);
    mv.visitEnd();

    writer.visitEnd();
    final TargetLoader loader = new TargetLoader("Sample", writer
        .toByteArray());
    Callable<?> callable = (Callable<?>) loader.newTargetInstance();
    final Object[] args = (Object[]) callable.call();
    assertEquals(3, args.length, 0.0);
    assertEquals(Long.valueOf(1000), args[0]);
    assertEquals("Sample", args[1]);
    assertEquals(Integer.valueOf(15), args[2]);
View Full Code Here


    writer.visitField(Opcodes.ACC_PRIVATE, "access", "Ljava/lang/Object;",
        null, null);

    writer.visitEnd();
    final TargetLoader loader = new TargetLoader("Sample", writer
        .toByteArray());
    Callable<?> callable = (Callable<?>) loader.getTargetClass()
        .getConstructor(Object.class).newInstance(access);
    assertSame(data, callable.call());
  }
View Full Code Here

  private ExecutionDataStore execute(final ClassReader reader)
      throws Exception {
    IRuntime runtime = new SystemPropertiesRuntime();
    runtime.startup();
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(target, bytes);
    run(loader.getTargetClass());
    final ExecutionDataStore store = new ExecutionDataStore();
    runtime.collect(store, null, false);
    runtime.shutdown();
    return store;
  }
View Full Code Here

    gen.visitMaxs(3, 0);
    gen.visitEnd();

    writer.visitEnd();

    final TargetLoader loader = new TargetLoader(className
        .replace('/', '.'), writer.toByteArray());
    return (ITarget) loader.newTargetInstance();
  }
View Full Code Here

  private ExecutionDataStore execute(final ClassReader reader)
      throws Exception {
    IRuntime runtime = new SystemPropertiesRuntime();
    runtime.startup();
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(target, bytes);
    run(loader.getTargetClass());
    final ExecutionDataStore store = new ExecutionDataStore();
    runtime.collect(store, null, false);
    runtime.shutdown();
    return store;
  }
View Full Code Here

    gen.visitMaxs(3, 0);
    gen.visitEnd();

    writer.visitEnd();

    final TargetLoader loader = new TargetLoader(className
        .replace('/', '.'), writer.toByteArray());
    return (ITarget) loader.newTargetInstance();
  }
View Full Code Here

  private ExecutionDataStore execute(final ClassReader reader)
      throws Exception {
    IRuntime runtime = new SystemPropertiesRuntime();
    runtime.startup();
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(target, bytes);
    run(loader.getTargetClass());
    final ExecutionDataStore store = new ExecutionDataStore();
    runtime.collect(store, null, false);
    runtime.shutdown();
    return store;
  }
View Full Code Here

  private ExecutionDataStore execute(final ClassReader reader)
      throws InstantiationException, IllegalAccessException {
    IRuntime runtime = new SystemPropertiesRuntime();
    runtime.startup();
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(target, bytes);
    final Object instance = loader.getTargetClass().newInstance();
    ((Runnable) instance).run();
    final ExecutionDataStore store = new ExecutionDataStore();
    runtime.collect(store, false);
    runtime.shutdown();
    return store;
View Full Code Here

  @Test
  public void testSerialization() throws Exception {
    // Create instrumented instance:
    final byte[] bytes = instrumenter.instrument(TargetLoader
        .getClassData(SerializationTarget.class));
    final TargetLoader loader = new TargetLoader(SerializationTarget.class,
        bytes);
    final Object obj1 = loader.getTargetClass().getConstructor(
        String.class, Integer.TYPE).newInstance("Hello",
        Integer.valueOf(42));

    // Serialize instrumented instance:
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
View Full Code Here

    gen.visitMaxs(3, 0);
    gen.visitEnd();

    writer.visitEnd();

    final TargetLoader loader = new TargetLoader(
        className.replace('/', '.'), writer.toByteArray());
    return (ITarget) loader.newTargetInstance();
  }
View Full Code Here

TOP

Related Classes of org.jacoco.core.test.TargetLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.