public Mutater createMutator(final ClassByteArraySource source) { return this.engine.createMutator(source); }
@Override public MutationResultListener getListener(Properties props, ListenerArguments args) { return new MutationHtmlReportListener(args.getCoverage(), args.getOutputStrategy(), args.getEngine().getMutatorNames(), args.getLocator()); }
public MutationTestProcess createWorker( final Collection<MutationDetails> remainingMutations, final Collection<ClassName> testClasses) { final MinionArguments fileArgs = new MinionArguments(remainingMutations, testClasses, this.config.getEngine().getName(), this.args, this.timeoutStrategy, Log.isVerbose(), this.fullMutationMatrix, this.pitConfig); final ProcessArgs args = ProcessArgs.withClassPath(this.classPath) .andLaunchOptions(this.config.getLaunchOptions()) .andBaseDir(this.baseDir).andStdout(captureStdOutIfVerbose()) .andStderr(printWith("stderr ")); final SocketFinder sf = new SocketFinder(); final MutationTestProcess worker = new MutationTestProcess( sf.getNextAvailableServerSocket(), args, fileArgs); return worker; }
public MutationResultListener getListener(Properties properties, ListenerArguments listenerArguments) { return new JSONReportListener( listenerArguments.getStartTime(), listenerArguments.getEngine().getMutatorNames(), listenerArguments.getOutputStrategy()); }
private void mockMutationEngine() { when( this.mutationFactory.createEngine(any(EngineArguments.class))).thenReturn( this.engine); when(this.engine.createMutator(any(ClassByteArraySource.class))) .thenReturn(this.mutater); }
public void runEnd() { try { report.endList(); report.beginObjectAttribute("analysis"); report.writeAttribute("time", System.currentTimeMillis() - args.getStartTime()); report.writeStringListAttribute("mutators", args.getEngine().getMutatorNames()); report.endObject(); report.endObject(); report.close(); } catch(IOException exc) { throw Unchecked.translateCheckedException(exc); } } }
@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); } }