auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void requestNetwork(NetworkRequest networkRequest, @RequestNetworkType int type, Message onCompleteMsg, LocalLog log) { final int apnType = ApnContext.getApnTypeFromNetworkRequest(networkRequest); final ApnContext apnContext = mApnContextsByType.get(apnType); log.log("DcTracker.requestNetwork for " + networkRequest + " found " + apnContext + ", type=" + requestTypeToString(type)); if (apnContext != null) { if (type == DcTracker.REQUEST_TYPE_HANDOVER && onCompleteMsg != null) { synchronized (mHandoverCompletionMsgs) { List<Message> msgs = mHandoverCompletionMsgs.get(apnType); if (msgs == null) { msgs = new ArrayList<>(); } msgs.add(onCompleteMsg); mHandoverCompletionMsgs.put(apnType, msgs); } } apnContext.requestNetwork(networkRequest, type, log); } }

Target:
public void requestNetwork(NetworkRequest networkRequest, @RequestNetworkType int type, Message onCompleteMsg, LocalLog log) { final int apnType = ApnContext.getApnTypeFromNetworkRequest(networkRequest); final ApnContext apnContext = mApnContextsByType.get(apnType); log.log("DcTracker.requestNetwork for " + networkRequest + " found " + apnContext + ", type=" + requestTypeToString(type)); if (apnContext != null) { apnContext.requestNetwork(networkRequest, type, onCompleteMsg, log); } }
Source:
public Configuration getConfiguration(GraphContext context) { AbstractIterationOperation<FileLocationModel> addTypeRefToList = new AbstractIterationOperation<FileLocationModel>() { @Override public void perform(GraphRewrite event, EvaluationContext context, FileLocationModel payload) { xmlFiles.add(payload); } }; return ConfigurationBuilder .begin() .addRule() .when(XmlFile.matchesXpath("/abc:ejb-jar").inFile(EXAMPLE_EJB_JAR_2_XML) .namespace("abc", "<LINK_0>")) .perform(Iteration .over() .perform(addTypeRefToList).endIteration() ); }

Target:
public Configuration getConfiguration(GraphContext context) { AbstractIterationOperation<FileLocationModel> addMatchedFile = new AbstractIterationOperation<FileLocationModel>() { @Override public void perform(GraphRewrite event, EvaluationContext context, FileLocationModel payload) { xmlFiles.add(payload); } }; return ConfigurationBuilder .begin() .addRule() .when(XmlFile.matchesXpath("/abc:ejb-jar").inFile(EXAMPLE_EJB_JAR_2_XML) .namespace("abc", "<LINK_0>")) .perform(addMatchedFile); }
Source:
public DuraStoreChunkSyncEndpoint(ContentStore contentStore, String username, String spaceId, boolean syncDeletes, long maxFileSize, boolean syncUpdates, boolean renameUpdates, boolean jumpStart, String updateSuffix, String prefix) { super(contentStore, username, spaceId, syncDeletes, syncUpdates, renameUpdates, jumpStart, updateSuffix, prefix); if (maxFileSize % 1000 != 0) { throw new RuntimeException("Max file size must be factor of 1000"); } this.maxFileSize = maxFileSize; this.jumpStart = jumpStart; stitcher = new FileStitcherImpl(new DuraStoreDataSource(contentStore)); }

Target:
public DuraStoreChunkSyncEndpoint(ContentStore contentStore, String username, String spaceId, boolean syncDeletes, long maxFileSize, boolean syncUpdates, boolean renameUpdates, boolean jumpStart, String updateSuffix, String prefix) { super(contentStore, username, spaceId, syncDeletes, syncUpdates, renameUpdates, jumpStart, updateSuffix, prefix); if (maxFileSize % 1000 != 0) { throw new RuntimeException("Max file size must be factor of 1000"); } this.jumpStart = jumpStart; this.chunkerOptions = new FileChunkerOptions(maxFileSize); stitcher = new FileStitcherImpl(new DuraStoreDataSource(contentStore)); }
Source:
public void submit() throws GitAPIException, IOException, RestApiException { PushOneCommit.Result r = createChange(); RevisionApi rApi = gApi.changes() .id("p~master~" + r.getChangeId()) .revision(r.getCommit().name()); rApi.review(approve()); rApi.submit(new SubmitInput()); }

Target:
public void submit() throws GitAPIException, IOException, RestApiException { PushOneCommit.Result r = createChange(); RevisionApi rApi = gApi.changes() .id("p~master~" + r.getChangeId()) .revision(r.getCommit().name()); rApi.review(approve()); rApi.submit(new SubmitInput(true)); }
Source:
public void onMatch(RelOptRuleCall call) { final Filter filter = call.rel(0); final Project project = call.rel(1); if (RexOver.containsOver(project.getProjects(), null)) { return; } if (RexUtil.containsCorrelation(filter.getCondition())) { return; } RexNode newCondition = RelOptUtil.pushPastProject(filter.getCondition(), project); final RelBuilder relBuilder = call.builder(); RelNode newFilterRel; if (copyFilter) { RexSimplify simplifier = new RexSimplify(relBuilder.getRexBuilder(), RelOptPredicateList.EMPTY, false, Util.first(call.getPlanner().getExecutor(), RexUtil.EXECUTOR)); newCondition = simplifier.simplify(newCondition); newFilterRel = filter.copy(filter.getTraitSet(), project.getInput(), RexUtil.removeNullabilityCast(relBuilder.getTypeFactory(), newCondition)); } else { newFilterRel = relBuilder.push(project.getInput()).filter(newCondition).build(); } RelNode newProjRel = copyProject ? project.copy(project.getTraitSet(), newFilterRel, project.getProjects(), project.getRowType()) : relBuilder.push(newFilterRel) .project(project.getProjects(), project.getRowType().getFieldNames()) .build(); call.transformTo(newProjRel); }

Target:
public void onMatch(RelOptRuleCall call) { final Filter filter = call.rel(0); final Project project = call.rel(1); if (RexOver.containsOver(project.getProjects(), null)) { return; } RexNode newCondition = RelOptUtil.pushPastProject(filter.getCondition(), project); final RelBuilder relBuilder = call.builder(); RelNode newFilterRel; if (copyFilter) { newFilterRel = filter.copy(filter.getTraitSet(), project.getInput(), simplifyFilterCondition(newCondition, call)); } else { newFilterRel = relBuilder.push(project.getInput()).filter(newCondition).build(); } RelNode newProjRel = copyProject ? project.copy(project.getTraitSet(), newFilterRel, project.getProjects(), project.getRowType()) : relBuilder.push(newFilterRel) .project(project.getProjects(), project.getRowType().getFieldNames()) .build(); call.transformTo(newProjRel); }
Source:
public @NonNull String getPresetFilterName(String presetFilterId) { String presetFilterName = null; if (fPresetFilterName != null) { presetFilterName = fPresetFilterName.get(presetFilterId); } if (presetFilterName == null && fPresetFilter != null) { presetFilterName = fPresetFilter.get(fPresetFilter.indexOf(presetFilterId)); } return presetFilterName == null ? "" : presetFilterName; }

Target:
public @NonNull String getPresetFilterName(String presetFilterId) { String presetFilterName = presetFilterId; if (fPresetFilterName != null) { presetFilterName = fPresetFilterName.get(presetFilterId); } return presetFilterName == null ? "" : presetFilterName; }
Source:
public String getImageUrl() { return getData(KEY_IMAGE_URL).toString(); }

Target:
public String getImageUrl() { return (getCreativeData(KEY_IMAGE_URL) != null) ? creativeData.get(KEY_IMAGE_URL).toString() : null; }
Source:
public void run() { mThreadName = Thread.currentThread().getName(); long blockToBeRemoved; while (true) { blockToBeRemoved = INVALID_BLOCK_ID; try { blockToBeRemoved = mBlocksToRemove.take(); mBlockWorker.removeBlock(Sessions.MASTER_COMMAND_SESSION_ID, blockToBeRemoved); LOG.debug("Block is removed in thread {}.", blockToBeRemoved, mThreadName); } catch (InterruptedException e) { if (!mShutdown) { Thread.currentThread().interrupt(); LOG.warn("{} got interrupted while it was cleaning block {}.", mThreadName, blockToBeRemoved); } } catch (IOException e) { LOG.warn("IOException occurred while was cleaning block {}, exception is {}.", mThreadName, blockToBeRemoved, e.getMessage()); } catch (BlockDoesNotExistException e) { LOG.warn("{}: block may be deleted already. exception is {}.", mThreadName, blockToBeRemoved, e.getMessage()); } catch (InvalidWorkerStateException e) { LOG.warn("{}: invalid block state for block {}, exception is {}.", mThreadName, blockToBeRemoved, e.getMessage()); } catch (Exception e) { LOG.warn("Unexpected exception: {}.", e.getMessage()); } finally { if (blockToBeRemoved != INVALID_BLOCK_ID) { mRemovingBlocks.remove(blockToBeRemoved); } } } }

Target:
public void run() { mThreadName = Thread.currentThread().getName(); long blockToBeRemoved; while (true) { blockToBeRemoved = INVALID_BLOCK_ID; try { blockToBeRemoved = mBlocksToRemove.take(); mBlockWorker.removeBlock(Sessions.MASTER_COMMAND_SESSION_ID, blockToBeRemoved); LOG.debug("Block is removed in thread {}.", blockToBeRemoved, mThreadName); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (!mShutdown) { LOG.warn("{} got interrupted while it was cleaning block {}.", mThreadName, blockToBeRemoved); } break; } catch (IOException e) { LOG.warn("IOException occurred while was cleaning block {}, exception is {}.", mThreadName, blockToBeRemoved, e.getMessage()); } catch (BlockDoesNotExistException e) { LOG.warn("{}: block may be deleted already. exception is {}.", mThreadName, blockToBeRemoved, e.getMessage()); } catch (InvalidWorkerStateException e) { LOG.warn("{}: invalid block state for block {}, exception is {}.", mThreadName, blockToBeRemoved, e.getMessage()); } catch (Exception e) { LOG.warn("Unexpected exception: {}.", e.getMessage()); } finally { if (blockToBeRemoved != INVALID_BLOCK_ID) { mRemovingBlocks.remove(blockToBeRemoved); } } } }
Source:
public long findZephyrTypeId() { long status = ISSUE_TYPE_ID; final String url = String.format(URL_GET_ISSUETYPES, getUrl()); final Header[] headers = new Header[2]; headers[0] = new BasicHeader("Content-Type", "application/json"); headers[1] = new BasicHeader("Accept-Encoding", "gzip, deflate, sdch"); try (final CloseableHttpResponse response = get(url, headers)) { int statusCode = response.getStatusLine().getStatusCode(); if (statusCode >= 200 && statusCode < 300) { HttpEntity entity = response.getEntity(); String string = null; try { string = EntityUtils.toString(entity, "utf-8"); final JsonArray jArr = new JsonParser().parse(string).getAsJsonArray(); jArr.add(string); for (int i = 0; i < jArr.size(); i++) { final JsonObject jObj = jArr.get(i).getAsJsonObject(); if (jObj.get("name").getAsString().trim().equals(TEST_ISSSUETYPE_NAME)) { return jObj.get("id").getAsLong(); } } } catch (IOException e) { ZephyrPlugin.log(String.format("Bad response entity upon receipt of zephyr type id <%s>", url), e); } } else if (statusCode == 401 || statusCode == 404) { return status; } else { ZephyrPlugin.log(String.format("Unexpected response status <%s> upon receipt of zephyr type id <%s>", statusCode, url)); } } catch (IOException e) { ZephyrPlugin.log(e); } return status; }

Target:
public long findZephyrTypeId() { long status = ISSUE_TYPE_ID; final String url = String.format(URL_GET_ISSUETYPES, getUrl()); final Header[] headers = new Header[2]; headers[0] = new BasicHeader("Content-Type", "application/json"); headers[1] = new BasicHeader("Accept-Encoding", "gzip, deflate, sdch"); try (final CloseableHttpResponse response = get(url, headers)) { int statusCode = response.getStatusLine().getStatusCode(); if (statusCode >= 200 && statusCode < 300) { HttpEntity entity = response.getEntity(); String string = null; try { string = EntityUtils.toString(entity, "utf-8"); final JsonArray jArr = new JsonParser().parse(string).getAsJsonArray(); jArr.add(string); for (int i = 0; i < jArr.size(); i++) { final JsonObject jObj = jArr.get(i).getAsJsonObject(); if (jObj.get("name").getAsString().trim().equals(TEST_ISSSUETYPE_NAME)) { return jObj.get("id").getAsLong(); } } } catch (IOException e) { ZephyrPlugin.log(String.format("Bad response entity upon receipt of zephyr type id <%s>", url), e); } } else if (statusCode == 401 || statusCode == 404) { return status; } else { ZephyrPlugin.log(String.format("Unexpected response status <%s> upon receipt of zephyr type id <%s>", statusCode, url)); } } catch (IOException e) { throw new IllegalStateException("Failed to get " + url, e); } return status; }
Source:
private void testGetInvalidityInfo_PersonName() { invalidityInfoFor_validName_shouldBeEmptyString(); invalidityInfoFor_emptyName_shouldReturnErrorString(); }

Target:
private void testGetInvalidityInfo_PersonName() { invalidityInfoFor_validName_shouldReturnEmptyString(); invalidityInfoFor_emptyName_shouldReturnErrorString(); }
Source:
public void testTrace() { assumeTrue(testTrace.exists()); Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID); perf.tagAsSummary(pm, "LTTng Kernel Analysis", Dimension.CPU_TIME); perf.tagAsGlobalSummary(pm, "LTTng Kernel Analysis", Dimension.CPU_TIME); for (int i = 0; i < LOOP_COUNT; i++) { try (IAnalysisModule module = new LttngKernelAnalysisModule(); LttngKernelTrace trace = new LttngKernelTrace()) { module.setId("test"); trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class); module.setTrace(trace); pm.start(); TmfTestHelper.executeAnalysis(module); pm.stop(); File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace)); for (File file : suppDir.listFiles()) { file.delete(); } } catch (TmfAnalysisException | TmfTraceException e) { fail(e.getMessage()); } pm.commit(); } }

Target:
public void testTrace() { assumeTrue(testTrace.exists()); Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID); perf.tagAsSummary(pm, "LTTng Kernel Analysis", Dimension.CPU_TIME); perf.tagAsGlobalSummary(pm, "LTTng Kernel Analysis", Dimension.CPU_TIME); for (int i = 0; i < LOOP_COUNT; i++) { try (IAnalysisModule module = new LttngKernelAnalysisModule(); LttngKernelTrace trace = new LttngKernelTrace()) { module.setId("test"); trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class); module.setTrace(trace); pm.start(); TmfTestHelper.executeAnalysis(module); pm.stop(); File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace)); for (File file : suppDir.listFiles()) { file.delete(); } } catch (TmfAnalysisException | TmfTraceException e) { fail(e.getMessage()); } } pm.commit(); }
Source:
private void createTypeAlias(Node n, Node parent) { JSDocInfo bestJSDocInfo = NodeUtil.getBestJSDocInfo(n); if (bestJSDocInfo != null && bestJSDocInfo.hasTypedefType()) { String name; if (n.getToken() == Token.NAME) { name = n.getString(); } else if (n.getToken() == Token.GETPROP) { name = n.getSecondChild().getString(); } else { name = n.getFirstChild().getString(); } Node typeDef = Node.newString(Token.TYPE_ALIAS, name); types.put(name, typeDef); typeDef.setJSDocInfo(bestJSDocInfo); replaceExpressionOrAssignment(n, parent, typeDef); } }

Target:
private void createTypeAlias(Node n, Node parent) { JSDocInfo bestJSDocInfo = NodeUtil.getBestJSDocInfo(n); if (bestJSDocInfo != null && bestJSDocInfo.hasTypedefType()) { String name; switch (n.getToken()) { case NAME: name = n.getString(); break; case GETPROP: name = n.getSecondChild().getString(); break; default: name = n.getFirstChild().getString(); break; } Node typeDef = Node.newString(Token.TYPE_ALIAS, name); types.put(name, typeDef); typeDef.setJSDocInfo(bestJSDocInfo); replaceExpressionOrAssignment(n, parent, typeDef); } }
Source:
public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHandle tableHandle) { try (Connection connection = connectionFactory.openConnection(JdbcIdentity.from(session))) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { JdbcTypeHandle typeHandle = new JdbcTypeHandle( resultSet.getInt("DATA_TYPE"), resultSet.getString("TYPE_NAME").contains("UNSIGNED"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); Optional<ReadMapping> columnMapping = toPrestoType(session, typeHandle); if (columnMapping.isPresent()) { String columnName = resultSet.getString("COLUMN_NAME"); boolean nullable = columnNullable == resultSet.getInt("NULLABLE"); columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, columnMapping.get().getType(), nullable)); } } if (columns.isEmpty()) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }

Target:
public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHandle tableHandle) { try (Connection connection = connectionFactory.openConnection(JdbcIdentity.from(session))) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { JdbcTypeHandle typeHandle = new JdbcTypeHandle( resultSet.getInt("DATA_TYPE"), resultSet.getString("TYPE_NAME").toUpperCase().contains("UNSIGNED"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); Optional<ReadMapping> columnMapping = toPrestoType(session, typeHandle); if (columnMapping.isPresent()) { String columnName = resultSet.getString("COLUMN_NAME"); boolean nullable = columnNullable == resultSet.getInt("NULLABLE"); columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, columnMapping.get().getType(), nullable)); } } if (columns.isEmpty()) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
public HaxeModel resolve(FullyQualifiedInfo info) { if (info.className == null) return this; HaxeClassModel classModel = getClassModel(info.className); if (classModel != null) { if (info.memberName != null) { return classModel.getMember(info.memberName); } return classModel; } return null; }

Target:
public HaxeModel resolve(FullyQualifiedInfo info) { if (isReferencingCurrentFile(info)) { if (info.className == null) return this; HaxeClassModel classModel = getClassModel(info.className); if (classModel != null) { if (info.memberName != null) { return classModel.getMember(info.memberName); } return classModel; } } return null; }
Source:
private void visitScriptNode(NodeTraversal t) { Set<String> classNames = new HashSet<>(); for (Map.Entry<String, Node> entry : usages.entrySet()) { String className = entry.getKey(); Node node = entry.getValue(); String outermostClassName = getOutermostClassName(className); String nonNullClassName = outermostClassName != null ? outermostClassName : className; String parentNamespace = null; int separatorIndex = nonNullClassName.lastIndexOf('.'); if (separatorIndex > 0) { parentNamespace = nonNullClassName.substring(0, separatorIndex); } Var scopeVar = t.getScope().getVar(nonNullClassName); boolean notProvidedByConstructors = (constructors == null || (!constructors.contains(className) && !constructors.contains(outermostClassName))); boolean notProvidedByRequires = (requires == null || (!requires.containsKey(className) && !requires.containsKey(outermostClassName) && !requires.containsKey(parentNamespace))); boolean notProvidedByExterns = scopeVar==null || !scopeVar.isExtern(); if (notProvidedByConstructors && notProvidedByRequires && notProvidedByExterns && !classNames.contains(className)) { compiler.report(t.makeError(node, MISSING_REQUIRE_WARNING, className)); classNames.add(className); } } for (Map.Entry<String, Node> entry : requires.entrySet()) { String require = entry.getKey(); Node call = entry.getValue(); Node parent = call.getParent(); if (parent.isAssign()) { continue; } if (!usages.containsKey(require) && !weakUsages.containsKey(require)) { reportExtraRequireWarning(call, require); } } this.usages.clear(); this.weakUsages.clear(); this.requires.clear(); this.constructors.clear(); }

Target:
private void visitScriptNode(NodeTraversal t) { if (isModule) { return; } Set<String> classNames = new HashSet<>(); for (Map.Entry<String, Node> entry : usages.entrySet()) { String className = entry.getKey(); Node node = entry.getValue(); String outermostClassName = getOutermostClassName(className); String nonNullClassName = outermostClassName != null ? outermostClassName : className; String parentNamespace = null; int separatorIndex = nonNullClassName.lastIndexOf('.'); if (separatorIndex > 0) { parentNamespace = nonNullClassName.substring(0, separatorIndex); } Var scopeVar = t.getScope().getVar(nonNullClassName); boolean notProvidedByConstructors = (constructors == null || (!constructors.contains(className) && !constructors.contains(outermostClassName))); boolean notProvidedByRequires = (requires == null || (!requires.containsKey(className) && !requires.containsKey(outermostClassName) && !requires.containsKey(parentNamespace))); boolean notProvidedByExterns = scopeVar == null || !scopeVar.isExtern(); if (notProvidedByConstructors && notProvidedByRequires && notProvidedByExterns && !classNames.contains(className)) { compiler.report(t.makeError(node, MISSING_REQUIRE_WARNING, className)); classNames.add(className); } } for (Map.Entry<String, Node> entry : requires.entrySet()) { String require = entry.getKey(); Node call = entry.getValue(); Node parent = call.getParent(); if (parent.isAssign()) { continue; } if (!usages.containsKey(require) && !weakUsages.containsKey(require)) { reportExtraRequireWarning(call, require); } } }
Source:
public void setup() { MockitoAnnotations.initMocks(this); Mockito.doReturn(false).when(ff4j).check(FeatureList.EFFECTIVE_RULE_DATE); }

Target:
public void setup() { MockitoAnnotations.initMocks(this); }
Source:
private void loadNBlocksToOutputStream( Transaction tx, T streamId, long firstBlock, long numBlocks, OutputStream os) { long position = 0; for (long i = 0; i < numBlocks; i += 4) { loadBlocksToOutputStream(tx, streamId, firstBlock + i, 4, os); position += i; } loadBlocksToOutputStream(tx, streamId, firstBlock + position, numBlocks % 4, os); }

Target:
private void loadNBlocksToOutputStream( Transaction tx, T streamId, long firstBlock, long numBlocks, OutputStream os) { long position = 0; for (; position + BLOCK_BATCH <= numBlocks; position += BLOCK_BATCH) { loadBlocksToOutputStream(tx, streamId, firstBlock + position, BLOCK_BATCH, os); } loadBlocksToOutputStream(tx, streamId, firstBlock + position, numBlocks % BLOCK_BATCH, os); }
Source:
public void stop() throws Exception { LOG.info("Stopping the services worker daemon"); Map<String, WorkerPool> workerPools = appContext.getBeansOfType(WorkerPool.class); for (WorkerPool workerPool : workerPools.values()) { workerPool.end(true); appContext.stop(); } }

Target:
public void stop() throws Exception { LOG.info("Stopping the services worker daemon"); Map<String, WorkerPool> workerPools = appContext.getBeansOfType(WorkerPool.class); for (WorkerPool workerPool : workerPools.values()) { workerPool.end(true); } appContext.stop(); }
Source:
protected boolean canDoAction() { boolean retValue=true; job = getJobDao().get(getParameters().getParentId()); if (job != null) { if (!job.isExternal()) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_NOT_EXTERNAL); } } else { parentStep = getStepDao().get(getParameters().getParentId()); } if (job == null && parentStep == null) { retValue=false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_NO_PARENT); } if (StringUtils.isEmpty(getParameters().getDescription().trim())) { retValue=false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_EMPTY_DESCRIPTION); } if (!retValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_JOB); } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue=true; job = getJobDao().get(getParameters().getParentId()); if (job != null) { if (!job.isExternal()) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_NOT_EXTERNAL); } } else { parentStep = getStepDao().get(getParameters().getParentId()); } if (job == null && parentStep == null) { retValue=false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_NO_PARENT); } if (StringUtils.isBlank(getParameters().getDescription())) { retValue=false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_EMPTY_DESCRIPTION); } if (!retValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_JOB); } return retValue; }
Source:
public static HandshakeMessage fromByteArray(byte[] byteArray, InetSocketAddress peerAddress) throws HandshakeException { if(byteArray == null) { throw new NullPointerException("byte array cannot be null"); } DatagramReader reader = new DatagramReader(byteArray); int curveType = reader.read(CURVE_TYPE_BITS); switch (curveType) { case NAMED_CURVE: int curveId = reader.read(NAMED_CURVE_BITS); int length = reader.read(PUBLIC_LENGTH_BITS); byte[] pointEncoded = reader.readBytes(length); return new EcdhPskServerKeyExchange(curveId, pointEncoded, peerAddress); default: throw new HandshakeException( String.format("Curve type [%s] received in ServerKeyExchange message from peer [%s] is unsupported", curveType, peerAddress), new AlertMessage(AlertLevel.FATAL, AlertDescription.HANDSHAKE_FAILURE, peerAddress)); } }

Target:
public static HandshakeMessage fromByteArray(byte[] byteArray, InetSocketAddress peerAddress) throws HandshakeException { if (byteArray == null) { throw new NullPointerException("byte array cannot be null"); } if (peerAddress == null) { throw new NullPointerException("peer address cannot be null"); } DatagramReader reader = new DatagramReader(byteArray); int hintLength = reader.read(IDENTITY_HINT_LENGTH_BITS); byte[] hintEncoded = reader.readBytes(hintLength); int curveType = reader.read(CURVE_TYPE_BITS); switch (curveType) { case NAMED_CURVE: int curveId = reader.read(NAMED_CURVE_BITS); int length = reader.read(PUBLIC_LENGTH_BITS); byte[] pointEncoded = reader.readBytes(length); return new EcdhPskServerKeyExchange(hintEncoded, curveId, pointEncoded, peerAddress); default: throw new HandshakeException( String.format("Curve type [%s] received in ServerKeyExchange message from peer [%s] is unsupported", curveType, peerAddress), new AlertMessage(AlertLevel.FATAL, AlertDescription.HANDSHAKE_FAILURE, peerAddress)); } }
Source:
public static MultiMap<Type, TypedClassOperation> readSideEffectFreeMethods() { MultiMap<Type, TypedClassOperation> sideEffectFreeJDKMethods; MultiMap<Type, TypedClassOperation> sideEffectFreeUserMethods; try { String sefDefaultsFileName = "/JDK-sef-methods.txt"; InputStream inputStream = GenTests.class.getResourceAsStream(sefDefaultsFileName); sideEffectFreeJDKMethods = OperationModel.readOperations(inputStream, sefDefaultsFileName); sideEffectFreeUserMethods = OperationModel.readOperations(GenInputsAbstract.side_effect_free_methods); } catch (OperationParseException e) { System.out.printf("Incorrectly formatted side-effect-free method: %s%n", e); System.exit(1); throw new Error("dead code"); } MultiMap<Type, TypedClassOperation> result = new MultiMap<>(); result.addAll(sideEffectFreeJDKMethods); result.addAll(sideEffectFreeUserMethods); return result; }

Target:
public static MultiMap<Type, TypedClassOperation> readSideEffectFreeMethods() { MultiMap<Type, TypedClassOperation> sideEffectFreeJDKMethods; String sefDefaultsFileName = "/JDK-sef-methods.txt"; try { InputStream inputStream = GenTests.class.getResourceAsStream(sefDefaultsFileName); sideEffectFreeJDKMethods = OperationModel.readOperations(inputStream, sefDefaultsFileName); } catch (RandoopUsageError e) { throw new RandoopBug( String.format("Incorrectly formatted method in file %s: %s%n", sefDefaultsFileName, e)); } MultiMap<Type, TypedClassOperation> sideEffectFreeUserMethods; try { sideEffectFreeUserMethods = OperationModel.readOperations(GenInputsAbstract.side_effect_free_methods); } catch (OperationParseException e) { throw new RandoopUsageError( String.format( "Incorrectly formatted method in file %s: %s%n", GenInputsAbstract.side_effect_free_methods, e)); } MultiMap<Type, TypedClassOperation> result = new MultiMap<>(); result.addAll(sideEffectFreeJDKMethods); result.addAll(sideEffectFreeUserMethods); return result; }
Source:
protected void setupCloudClient() { try { String projectId = getProperty(PROJECT_ID_PROPERTY); GoogleCredentials credentials = GoogleCredentials.fromStream( new ByteArrayInputStream(getProperty(GOOGLE_APPLICATION_CREDENTIALS).getBytes())) .createScoped(GOOGLE_PLATFORM_SCOPE, GOOGLE_STORAGE_SCOPE); credentials.refreshIfExpired(); storage = StorageOptions.newBuilder() .setCredentials(GoogleCredentials.create(credentials.refreshAccessToken())) .setProjectId(projectId) .build() .getService(); bucketName = getProperty(BUCKET_NAME_PROPERTY); bucket = this.getOrCreateBucket(bucketName); } catch (IOException | StorageException e) { throw new NuxeoException(e); } }

Target:
protected void setupCloudClient() { try { String projectId = getProperty(PROJECT_ID_PROPERTY); GoogleCredentials credentials = GoogleCredentials.fromStream( new ByteArrayInputStream(getProperty(GOOGLE_APPLICATION_CREDENTIALS).getBytes())) .createScoped(GOOGLE_PLATFORM_SCOPE, GOOGLE_STORAGE_SCOPE); credentials.refreshIfExpired(); storage = StorageOptions.newBuilder() .setCredentials(GoogleCredentials.create(credentials.refreshAccessToken())) .setProjectId(projectId) .build() .getService(); bucketName = getProperty(BUCKET_NAME_PROPERTY); bucketPrefix = getProperty(BUCKET_PREFIX_PROPERTY, EMPTY); bucket = getOrCreateBucket(bucketName); if (!isBlank(bucketPrefix) && !bucketPrefix.endsWith(DELIMITER)) { log.warn(String.format("%s %s Google bucket prefix should end with '/' : added automatically.", BUCKET_PREFIX_PROPERTY, bucketPrefix)); bucketPrefix += DELIMITER; } if (isNotBlank(namespace)) { bucketPrefix += namespace; if (!bucketPrefix.endsWith(DELIMITER)) { bucketPrefix += DELIMITER; } } } catch (IOException e) { throw new NuxeoException(e); } }
Source:
public boolean checkForDuplicates(long mid, long did, String[] fields) { return findNote(mid, fields) != null; }

Target:
public boolean checkForDuplicates(long mid, long did, String[] fields) { return findExistingNoteId(mid, fields) != null; }
Source:
public boolean cast(final MagicSpell spell) { if (!ctx.game.tab(Game.Tab.MAGIC)) { return false; } final Component c = component(spell); return c.visible() && (c.click("Cast") || c.click("Reanimate")); }

Target:
public boolean cast(final MagicSpell spell) { if (!ctx.game.tab(Game.Tab.MAGIC)) { return false; } final Component c = component(spell); return c.visible() && c.click(spell.book() == Book.ARCEUUS ? "Reanimate" : "Cast"); }
Source:
public DataSet data() { SimpleDataSet result = new SimpleDataSet(metadata()); Config config = DatabaseDescriptor.getRawConfig(); for (Field f : FIELDS) { try { Object value = f.get(config); if (value != null && value.getClass().isArray()) { value = Arrays.toString((Object[]) value); } result.row(f.getName()); if (value != null) result.column(VALUE, value.toString()); } catch (IllegalAccessException | IllegalArgumentException e) { throw new ServerError(e); } } return result; }

Target:
public DataSet data() { SimpleDataSet result = new SimpleDataSet(metadata()); for (Field setting : FIELDS.values()) { addValue(result, setting); } return result; }
Source:
public static String removeQueryPrefix(final String luceneQuery){ final String cleanedUpQuery; if(luceneQuery.startsWith("query_")){ cleanedUpQuery = luceneQuery.replace( "query_", "" ); } else { cleanedUpQuery = luceneQuery; } return cleanedUpQuery; }

Target:
public static String removeQueryPrefix(final String luceneQuery){ final String cleanedUpQuery; if(luceneQuery.startsWith("query_")){ cleanedUpQuery = luceneQuery.replace( "query_", StringPool.BLANK); } else { cleanedUpQuery = luceneQuery; } return cleanedUpQuery; }
Source:
private void testSearch() { ______TS("search for nothing"); String searchContent = ""; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isPageTitleCorrect()); assertTrue(isSearchPanelPresent()); assertTrue(isEmptyKeyErrorMessageShown()); ______TS("search for student1"); searchPage.clearSearchBox(); searchContent = "student1"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); StudentAttributes student = testData.students.get("student1InCourse1"); InstructorAttributes instructor = testData.instructors.get("instructor1OfCourse1"); assertTrue(isStudentDisplayed(student, instructor)); ______TS("search for student name with special characters"); searchPage.clearSearchBox(); searchContent = "student(1)"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); }

Target:
private void testSearch() { ______TS("search for nothing"); String searchContent = ""; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isPageTitleCorrect()); assertTrue(isSearchPanelPresent()); assertTrue(isEmptyKeyErrorMessageShown()); ______TS("search for student1"); searchPage.clearSearchBox(); searchContent = "student1"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); StudentAttributes student = testData.students.get("student1InCourse1"); InstructorAttributes instructor = testData.instructors.get("instructor1OfCourse1"); assertTrue(isStudentRowDisplayed(student, instructor)); ______TS("search for student name with special characters"); searchPage.clearSearchBox(); searchContent = "student(1)"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); }
Source:
private void reportSchedulingError(@Nonnull Run<?, ?> run, @Nonnull Job<?, ?> jobToTrigger, @Nonnull BuildListener listener) { listener.error("Skipping " + jobToTrigger.getFullName() + "..."); if (LOGGER.isLoggable(Level.CONFIG)) { String message = String.format("Cannot schedule project %s. Job type is not parameterized, " + "or there is no Item/Build permission for the current authentication %s. " + "Skipping...", jobToTrigger, Jenkins.getAuthentication().getName()); LOGGER.log(Level.CONFIG, String.format("%s: %s", run, message), new UnsupportedOperationException("Cannot schedule job " + jobToTrigger.getFullName())); } }

Target:
private void reportSchedulingError(@Nonnull Run<?, ?> run, @Nonnull Job<?, ?> jobToTrigger, @Nonnull BuildListener listener) { listener.error("Skipping " + jobToTrigger.getFullName() + "..."); if (LOGGER.isLoggable(Level.CONFIG)) { String message = String.format("Cannot schedule project %s. Job type is not parameterized, " + "or there is no Job/Build permission for the current authentication %s. " + "Skipping...", jobToTrigger, Jenkins.getAuthentication().getName()); LOGGER.log(Level.CONFIG, String.format("%s: %s", run, message), new UnsupportedOperationException("Cannot schedule job " + jobToTrigger.getFullName())); } }
Source:
private EvaluationContext(EvaluationContext base, DataInstance instance, TreeReference contextNode, Hashtable<String, DataInstance> formInstances) { this.functionHandlers = base.functionHandlers; this.formInstances = formInstances; this.variables = new Hashtable<>(); this.shallowVariablesCopy(base.variables); this.contextNode = contextNode; this.instance = instance; this.isConstraint = base.isConstraint; this.candidateValue = base.candidateValue; this.outputTextForm = base.outputTextForm; this.original = base.original; this.currentContextPosition = base.currentContextPosition; if (base.mAccumulateExprs) { this.mAccumulateExprs = true; this.mDebugCore = base.mDebugCore; } this.queryContext = base.queryContext; queryContext.setTraceRoot(this); }

Target:
private EvaluationContext(EvaluationContext base, DataInstance instance, TreeReference contextNode, Hashtable<String, DataInstance> formInstances) { this.functionHandlers = base.functionHandlers; this.formInstances = formInstances; this.variables = new Hashtable<>(); this.shallowVariablesCopy(base.variables); this.contextNode = contextNode; this.instance = instance; this.isConstraint = base.isConstraint; this.candidateValue = base.candidateValue; this.outputTextForm = base.outputTextForm; this.original = base.original; this.currentContextPosition = base.currentContextPosition; if (base.mAccumulateExprs) { this.mAccumulateExprs = true; this.mDebugCore = base.mDebugCore; } setQueryContext(base.queryContext); }
Source:
public Ordering<Row> getRowOrdering(final boolean granular) { final boolean sortByDimsFirst = getContextSortByDimsFirst(); final Comparator naturalNullsFirst = Ordering.natural().nullsFirst(); return Ordering.from( new Comparator<Row>() { @Override public int compare(Row lhs, Row rhs) { final int timeCompare; if (granular) { timeCompare = Longs.compare( granularity.truncate(lhs.getTimestampFromEpoch()), granularity.truncate(rhs.getTimestampFromEpoch()) ); } else { timeCompare = Longs.compare( lhs.getTimestampFromEpoch(), rhs.getTimestampFromEpoch() ); } if (!sortByDimsFirst && timeCompare != 0) { return timeCompare; } for (DimensionSpec dimension : dimensions) { final int dimCompare = naturalNullsFirst.compare( lhs.getRaw(dimension.getOutputName()), rhs.getRaw(dimension.getOutputName()) ); if (dimCompare != 0) { return dimCompare; } } if (sortByDimsFirst && timeCompare != 0) { return timeCompare; } return 0; } } ); }

Target:
public Ordering<Row> getRowOrdering(final boolean granular) { final boolean sortByDimsFirst = getContextSortByDimsFirst(); final Comparator<Row> timeComparator = getTimeComparator(granular); if (sortByDimsFirst) { return Ordering.from( new Comparator<Row>() { @Override public int compare(Row lhs, Row rhs) { final int cmp = compareDims(dimensions, lhs, rhs); if (cmp != 0) { return cmp; } return timeComparator.compare(lhs, rhs); } } ); } else { return Ordering.from( new Comparator<Row>() { @Override public int compare(Row lhs, Row rhs) { final int timeCompare = timeComparator.compare(lhs, rhs); if (timeCompare != 0) { return timeCompare; } return compareDims(dimensions, lhs, rhs); } } ); } }
Source:
StringBuilder buildQueryString(List<Object> variables, CodecRegistry codecRegistry) { StringBuilder builder = new StringBuilder(); builder.append("SELECT "); if (isJson) builder.append("JSON "); if (isDistinct) builder.append("DISTINCT "); if (columnNames == null) { builder.append('*'); } else { Utils.joinAndAppendNames(builder, codecRegistry, columnNames); } builder.append(" FROM "); if (keyspace != null) Utils.appendName(keyspace, builder).append('.'); Utils.appendName(table, builder); if (!where.clauses.isEmpty()) { builder.append(" WHERE "); Utils.joinAndAppend(builder, codecRegistry, " AND ", where.clauses, variables); } if (orderings != null && !orderings.isEmpty()) { builder.append(" ORDER BY "); Utils.joinAndAppend(builder, codecRegistry, ",", orderings, variables); } if (perPartitionLimit != null) { builder.append(" PER PARTITION LIMIT ").append(perPartitionLimit); } if (limit != null) { builder.append(" LIMIT ").append(limit); } if (allowFiltering) { builder.append(" ALLOW FILTERING"); } return builder; }

Target:
StringBuilder buildQueryString(List<Object> variables, CodecRegistry codecRegistry) { StringBuilder builder = new StringBuilder(); builder.append("SELECT "); if (isJson) builder.append("JSON "); if (isDistinct) builder.append("DISTINCT "); if (columnNames == null) { builder.append('*'); } else { Utils.joinAndAppendNames(builder, codecRegistry, columnNames); } builder.append(" FROM "); if (keyspace != null) Utils.appendName(keyspace, builder).append('.'); Utils.appendName(table, builder); if (!where.clauses.isEmpty()) { builder.append(" WHERE "); Utils.joinAndAppend(builder, codecRegistry, " AND ", where.clauses, variables); } if (groupByColumnNames != null) { builder.append(" GROUP BY "); Utils.joinAndAppendNames(builder, codecRegistry, groupByColumnNames); } if (orderings != null) { builder.append(" ORDER BY "); Utils.joinAndAppend(builder, codecRegistry, ",", orderings, variables); } if (perPartitionLimit != null) { builder.append(" PER PARTITION LIMIT ").append(perPartitionLimit); } if (limit != null) { builder.append(" LIMIT ").append(limit); } if (allowFiltering) { builder.append(" ALLOW FILTERING"); } return builder; }
Source:
protected void doStart() throws Exception { ObjectHelper.notNull(executorService, "executorService", this); ObjectHelper.notNull(scheduledExecutorService, "scheduledExecutorService", this); ObjectHelper.notNull(endpoint, "endpoint", this); log.trace("Using timeout checker interval with millis", endpoint.getRequestTimeoutCheckerInterval()); TimeoutMap<String, ReplyHandler> timeoutMap = new DefaultTimeoutMap<>(scheduledExecutorService, endpoint.getRequestTimeoutCheckerInterval()); correlation = new CorrelationTimeoutMap(timeoutMap, executorService); ServiceHelper.startService(correlation); listenerContainer = createListenerContainer(); listenerContainer.afterPropertiesSet(); log.debug("Starting reply listener container on endpoint: {}", endpoint); endpoint.onListenerContainerStarting(listenerContainer); listenerContainer.start(); }

Target:
protected void doStart() throws Exception { ObjectHelper.notNull(executorService, "executorService", this); ObjectHelper.notNull(scheduledExecutorService, "scheduledExecutorService", this); ObjectHelper.notNull(endpoint, "endpoint", this); log.trace("Using timeout checker interval with millis", endpoint.getRequestTimeoutCheckerInterval()); correlation = new CorrelationTimeoutMap(scheduledExecutorService, endpoint.getRequestTimeoutCheckerInterval(), executorService); ServiceHelper.startService(correlation); listenerContainer = createListenerContainer(); listenerContainer.afterPropertiesSet(); log.debug("Starting reply listener container on endpoint: {}", endpoint); endpoint.onListenerContainerStarting(listenerContainer); listenerContainer.start(); }
Source:
private void loadDictionary() { String dictLanguage = uiPrefs_.spellingDictionaryLanguage().getValue(); String path = "/dictionaries/" + dictLanguage + "/" + dictLanguage; RequestLogEntry affLogEntry = RequestLog.log(dictLanguage + "_aff_request", ""); RequestLogEntry dicLogEntry = RequestLog.log(dictLanguage + "_dic_request", ""); try { new RequestBuilder(RequestBuilder.GET, path + ".aff").sendRequest("", new RequestCallback() { @Override public void onResponseReceived(Request affReq, Response affResp) { try { new RequestBuilder(RequestBuilder.GET, path + ".dic").sendRequest("", new RequestCallback() { @Override public void onResponseReceived(Request dicReq, Response dicResp) { ExternalJavaScriptLoader.Callback loadTypoCallback = () -> typoNative_ = new TypoNative(dictLanguage, affResp.getText(), dicResp.getText(), null); new ExternalJavaScriptLoader(TypoResources.INSTANCE.typojs().getSafeUri().asString()).addCallback(loadTypoCallback); } @Override public void onError(Request res, Throwable throwable) { dicLogEntry.logResponse(RequestLogEntry.ResponseType.Error, throwable.getLocalizedMessage()); } }); } catch (RequestException e) { dicLogEntry.logResponse(RequestLogEntry.ResponseType.Unknown, e.getLocalizedMessage()); } } @Override public void onError(Request res, Throwable throwable) { affLogEntry.logResponse(RequestLogEntry.ResponseType.Error, throwable.getLocalizedMessage()); } }); } catch (RequestException e) { affLogEntry.logResponse(RequestLogEntry.ResponseType.Unknown, e.getLocalizedMessage()); } }

Target:
private void loadDictionary() { String dictLanguage = uiPrefs_.spellingDictionaryLanguage().getValue(); String path = GWT.getHostPageBaseURL() + "dictionaries/" + dictLanguage + "/" + dictLanguage; RequestLogEntry affLogEntry = RequestLog.log(dictLanguage + "_aff_request", ""); RequestLogEntry dicLogEntry = RequestLog.log(dictLanguage + "_dic_request", ""); try { new RequestBuilder(RequestBuilder.GET, path + ".aff").sendRequest("", new RequestCallback() { @Override public void onResponseReceived(Request affReq, Response affResp) { try { new RequestBuilder(RequestBuilder.GET, path + ".dic").sendRequest("", new RequestCallback() { @Override public void onResponseReceived(Request dicReq, Response dicResp) { ExternalJavaScriptLoader.Callback loadTypoCallback = () -> typoNative_ = new TypoNative(dictLanguage, affResp.getText(), dicResp.getText(), null); new ExternalJavaScriptLoader(TypoResources.INSTANCE.typojs().getSafeUri().asString()).addCallback(loadTypoCallback); } @Override public void onError(Request res, Throwable throwable) { dicLogEntry.logResponse(RequestLogEntry.ResponseType.Error, throwable.getLocalizedMessage()); } }); } catch (RequestException e) { dicLogEntry.logResponse(RequestLogEntry.ResponseType.Unknown, e.getLocalizedMessage()); } } @Override public void onError(Request res, Throwable throwable) { affLogEntry.logResponse(RequestLogEntry.ResponseType.Error, throwable.getLocalizedMessage()); } }); } catch (RequestException e) { affLogEntry.logResponse(RequestLogEntry.ResponseType.Unknown, e.getLocalizedMessage()); } }
Source:
public Predicate<String> create(final String resourceGroup, final boolean shouldBePresent) { checkNotNull(resourceGroup, "resourceGroup cannot be null"); return retry(new Predicate<String>() { @Override public boolean apply(final String name) { checkNotNull(name, "name cannot be null"); boolean present = false; checkNotNull(name, "name cannot be null"); List<Vault.DeletedVault> vaults = api.getVaultApi(resourceGroup).listDeletedVaults(); for (Vault.DeletedVault dv : vaults) { if (dv.name().equals(name)) { present = true; break; } } return present == shouldBePresent; } }, operationTimeout, initialPeriod, maxPeriod); }

Target:
public Predicate<String> create(final String resourceGroup, final boolean shouldBePresent) { checkNotNull(resourceGroup, "resourceGroup cannot be null"); return retry(new Predicate<String>() { @Override public boolean apply(final String name) { checkNotNull(name, "name cannot be null"); boolean present = false; List<Vault.DeletedVault> vaults = api.getVaultApi(resourceGroup).listDeletedVaults(); return shouldBePresent == Iterables.any(vaults, new Predicate<Vault.DeletedVault>() { @Override public boolean apply(Vault.DeletedVault input) { return input.name().equals(name); } }); } }, operationTimeout, initialPeriod, maxPeriod); }
Source:
public void testDecode() throws Exception { GpsmtaProtocolDecoder decoder = new GpsmtaProtocolDecoder(new GpsmtaProtocol()); verifyPosition(decoder, text( "3085a94ef459 1446536867 49.81621 24.054207 1 0 22 0 10 12 24 0 0")); verifyPosition(decoder, text( "864528021249771 1446116686 49.85073 24.004438 0 217 6 338 00 59 27 0 0")); verifyPosition(decoder, text( "359144048138856 1442932957 49.85064 24.003979 1 0 40 0 10 110 26 0 0")); verifyPosition(decoder, text( "359144048138856 1442932957 -49.85064 24.003979 1 0 40 0 10 110 26 0 0")); verifyPosition(decoder, text( "359144048138856 1442932957 49.85064 -24.003979 1 0 40 0 10 110 26 0 0")); verifyPosition(decoder, text( "359144048138856 1442932957 -49.85064 -24.003979 1 0 40 0 10 110 26 0 0")); }

Target:
public void testDecode() throws Exception { GpsmtaProtocolDecoder decoder = new GpsmtaProtocolDecoder(new GpsmtaProtocol()); verifyPosition(decoder, text( "3085a94ef459 1446536867 49.81621 24.054207 1 0 22 0 10 12 24 0 0")); verifyPosition(decoder, text( "864528021249771 1446116686 49.85073 24.004438 0 217 6 338 00 59 27 0 0")); verifyPosition(decoder, text( "359144048138856 1442932957 -49.85064 -24.003979 1 0 40 0 10 110 26 0 0")); }
Source:
public static Matcher<Object> visible() { return new BaseMatcher<Object>() { @Override public boolean matches(Object item) { if (item != null && item instanceof DialogFixture) return ((DialogFixture) item).target().isVisible(); if (item != null && item instanceof JDialog) return ((JDialog) item).isVisible(); if (item != null && item instanceof JFileChooserFixture) return ((JFileChooserFixture) item).target().isVisible(); throw new RuntimeException("Invalid matcher for " + item); } @Override public void describeTo(Description description) { description.appendText("visible"); } }; }

Target:
public static Matcher<Object> visible() { return new BaseMatcher<Object>() { @Override public boolean matches(Object item) { if (item instanceof DialogFixture) return ((DialogFixture) item).target().isVisible(); if (item instanceof JDialog) return ((JDialog) item).isVisible(); if (item instanceof JFileChooserFixture) return ((JFileChooserFixture) item).target().isVisible(); throw new RuntimeException("Invalid matcher for " + item); } @Override public void describeTo(Description description) { description.appendText("visible"); } }; }