@SuppressWarnings("unchecked") public <T extends Serializable> T read(final Class<T> type) { try { return (T) deserialize(readBytes()); } catch (final IOException e) { throw Unchecked.translateCheckedException(e); } }
@Test public void shouldPassCommandsToReceiver() throws Exception { final SafeDataOutputStream dos = new SafeDataOutputStream(this.o); dos.writeByte(Id.DESCRIBE); dos.writeByte(Id.DONE); dos.writeInt(ExitCode.OK.getCode()); mockClientSocketInputStream(); this.testee.call(); verify(this.receiveStrategy, times(1)).apply(anyByte(), any(SafeDataInputStream.class)); }
private void mockClientSocketToSendExitCode(final ExitCode timeout) throws IOException { final SafeDataOutputStream dos = new SafeDataOutputStream(this.o); dos.writeByte(Id.DONE); dos.writeInt(timeout.getCode()); mockClientSocketInputStream(); }
@Override public synchronized void registerClass(final int id, final String className) { this.dos.writeByte(Id.CLAZZ); this.dos.writeInt(id); this.dos.writeString(className); }
public <T extends Serializable> void write(final T value) { try { writeBytes(toByteArray(value)); } catch (final IOException e) { throw Unchecked.translateCheckedException(e); } }
public String readString() { try { return new String(readBytes(), "UTF-8"); } catch (final IOException e) { throw Unchecked.translateCheckedException(e); } }
public static Object clone(final Object object) { return cloneForLoader(object, IsolationUtils.getContextClassLoader()); }
private PitError createPitErrorForExceptionOnClass(final Exception ex, final ClientClasspathPlugin clazz) { return new PitError("Error getting location of class " + clazz, ex); } };
@Override public void run() { while (!this.isInterrupted()) { readFromStream(); } }
public JUnitCompatibleConfiguration(TestGroupConfig config, Collection<String> excludedRunners, Collection<String> includedTestMethods) { Preconditions.checkNotNull(config); this.config = config; this.excludedRunners = excludedRunners; this.includedTestMethods = includedTestMethods; }
@Override public synchronized void registerProbes(int classId, String methodName, String methodDesc, int firstProbe, int lastProbe) { this.dos.writeByte(Id.PROBES); this.dos.writeInt(classId); this.dos.writeString(methodName); this.dos.writeString(methodDesc); this.dos.writeInt(firstProbe); this.dos.writeInt(lastProbe); }
public CoverageOptions(final Collection<String> include, final Collection<String> exclude, final TestPluginArguments pitConfig, final boolean verbose, final int maxDependencyDistance) { Preconditions.checkNotNull(pitConfig); this.include = include; this.exclude = exclude; this.verbose = verbose; this.pitConfig = pitConfig; this.maxDependencyDistance = maxDependencyDistance; }
public MutationDetails(final MutationIdentifier id, final String filename, final String description, final int lineNumber, final int block, final boolean isInFinallyBlock, final PoisonStatus poison) { this.id = id; this.description = Preconditions.checkNotNull(description); this.filename = Preconditions.checkNotNull(filename); this.lineNumber = lineNumber; this.block = block; this.isInFinallyBlock = isInFinallyBlock; this.poison = poison; }