public Mutater createMutator(final ClassByteArraySource source) { return this.engine.createMutator(source); }
private void mockMutationEngine() { when( this.mutationFactory.createEngine(any(EngineArguments.class))).thenReturn( this.engine); when(this.engine.createMutator(any(ClassByteArraySource.class))) .thenReturn(this.mutater); }
@Before public void setup() { MockitoAnnotations.initMocks(this); this.mutations = new ArrayList<>(); this.tests = new ArrayList<>(); this.args = new MinionArguments(this.mutations, this.tests, "anEgine", EngineArguments.arguments(), this.timeoutStrategy, false, false, TestPluginArguments.defaults()); when(this.is.read(MinionArguments.class)).thenReturn(this.args); when(this.engine.createMutator(any(ClassByteArraySource.class))) .thenReturn(this.mutater); final MutationEngineFactory factory = Mockito.mock(MutationEngineFactory.class); when(factory.createEngine(any(EngineArguments.class))).thenReturn(this.engine); when(this.settings.createEngine(any(String.class))).thenReturn(factory); this.testee = new MutationTestMinion(this.settings, this.is, this.reporter); }
@Before public void setUp() { when(this.engine.createMutator(any(ClassByteArraySource.class))).thenReturn(this.mutater); this.config = new MutationConfig(this.engine, new LaunchOptions(null)); this.testee = new MutationSource(this.config, this.prioritiser , this.source, CompoundMutationInterceptor.nullInterceptor()); }
public void run() { try { final MinionArguments paramsFromParent = this.dis .read(MinionArguments.class); Log.setVerbose(paramsFromParent.isVerbose()); final ClassLoader loader = IsolationUtils.getContextClassLoader(); final ClassByteArraySource byteSource = new CachingByteArraySource(new ClassloaderByteArraySource( loader), CACHE_SIZE); final F3<ClassName, ClassLoader, byte[], Boolean> hotswap = new HotSwap( byteSource); final MutationEngine engine = createEngine(paramsFromParent.engine, paramsFromParent.engineArgs); final MutationTestWorker worker = new MutationTestWorker(hotswap, engine.createMutator(byteSource), loader, paramsFromParent.fullMutationMatrix); final List<TestUnit> tests = findTestsForTestClasses(loader, paramsFromParent.testClasses, createTestPlugin(paramsFromParent.pitConfig)); worker.run(paramsFromParent.mutations, this.reporter, new TimeOutDecoratedTestSource(paramsFromParent.timeoutStrategy, tests, this.reporter)); this.reporter.done(ExitCode.OK); } catch (final Throwable ex) { ex.printStackTrace(System.out); LOG.log(Level.WARNING, "Error during mutation test", ex); this.reporter.done(ExitCode.UNKNOWN_ERROR); } }
public void run() { try { final MinionArguments paramsFromParent = this.dis .read(MinionArguments.class); Log.setVerbose(paramsFromParent.isVerbose()); final ClassLoader loader = IsolationUtils.getContextClassLoader(); final ClassByteArraySource byteSource = new CachingByteArraySource(new ClassloaderByteArraySource( loader), CACHE_SIZE); final F3<ClassName, ClassLoader, byte[], Boolean> hotswap = new HotSwap( byteSource); final MutationEngine engine = createEngine(paramsFromParent.engine, paramsFromParent.engineArgs); final MutationTestWorker worker = new MutationTestWorker(hotswap, engine.createMutator(byteSource), loader, paramsFromParent.fullMutationMatrix); final List<TestUnit> tests = findTestsForTestClasses(loader, paramsFromParent.testClasses, createTestPlugin(paramsFromParent.pitConfig)); worker.run(paramsFromParent.mutations, this.reporter, new TimeOutDecoratedTestSource(paramsFromParent.timeoutStrategy, tests, this.reporter)); this.reporter.done(ExitCode.OK); } catch (final Throwable ex) { ex.printStackTrace(System.out); LOG.log(Level.WARNING, "Error during mutation test", ex); this.reporter.done(ExitCode.UNKNOWN_ERROR); } }