auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUseJSONB() throws Exception { System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, "true"); JsonBindingProvider jbp = new JsonBindingProvider(); boolean result = jbp.isReadable(null, null, null, mediaType); assertFalse(result); }

Target:
public void testUseJSONB() throws Exception { String origValue = System.getProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB); System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, "true"); JsonBindingProvider jbp = new JsonBindingProvider(); boolean result = jbp.isReadable(null, null, null, mediaType); if (origValue == null) { System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, ""); } else { System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, origValue); } assertFalse(result); }
Source:
public String getDefaultMetaVariable() { return "regex"; }

Target:
public String getDefaultMetaVariable() { return "REGEX"; }
Source:
public Token emitEOF() { int cpos = getCharPositionInLine(); int line = getLine(); if ( _token !=null && _token.getLine() == line ) { int n = _token.getStopIndex() - _token.getStartIndex() + 1; cpos = _token.getCharPositionInLine()+n; } Token eof = _factory.create(_tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, _input.index(), _input.index()-1, line, cpos); emit(eof); return eof; }

Target:
public Token emitEOF() { int cpos = getCharPositionInLine(); int line = getLine(); Token eof = _factory.create(_tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, _input.index(), _input.index()-1, line, cpos); emit(eof); return eof; }
Source:
public SetMembers evaluate(CodeSystemURI uri, BranchContext context, Options search) { if (!search.containsKey(OptionKey.SET)) { return SetMemberSearchRequestEvaluator.NOOP.evaluate(uri, context, search); } final String refsetId = search.get(OptionKey.SET, String.class); final Integer limit = search.get(OptionKey.LIMIT, Integer.class); final String searchAfter = search.get(OptionKey.AFTER, String.class); SnomedConcepts concepts = SnomedRequests.prepareSearchConcept() .isActiveMemberOf(refsetId) .setExpand("preferredDescriptions()") .setLimit(limit) .setSearchAfter(searchAfter) .build() .execute(context); return new SetMembers(concepts.stream().map(c -> toMember(c, uri)).collect(Collectors.toList()), concepts.getSearchAfter(), concepts.getLimit(), concepts.getTotal() ); }

Target:
public SetMembers evaluate(CodeSystemURI uri, BranchContext context, Options search) { final Integer limit = search.get(OptionKey.LIMIT, Integer.class); final String searchAfter = search.get(OptionKey.AFTER, String.class); final List<ExtendedLocale> locales = search.getList(OptionKey.AFTER, ExtendedLocale.class); SnomedRefSetMemberSearchRequestBuilder requestBuilder = SnomedRequests.prepareSearchMember(); if (search.containsKey(OptionKey.SET)) { final Collection<String> refsetId = search.getCollection(OptionKey.SET, String.class); requestBuilder.filterByRefSet(refsetId); } SnomedReferenceSetMembers referenceSetMembers = requestBuilder .filterByActive(true) .setLocales(locales) .setExpand("referencedComponent(expand(fsn()))") .setLimit(limit) .setSearchAfter(searchAfter) .build() .execute(context); return new SetMembers(referenceSetMembers.stream().map(m -> toMember(m, uri)).collect(Collectors.toList()), referenceSetMembers.getSearchAfter(), referenceSetMembers.getLimit(), referenceSetMembers.getTotal() ); }
Source:
public InjectionProvider getInjectionProvider(ExternalContext externalContext) { return new MyFacesInjectionProvider(); }

Target:
public InjectionProvider getInjectionProvider(ExternalContext externalContext) { return injectionProvider; }
Source:
public ImportStatus importForms(Configuration config) { try { List<String> formUrls = getFormUrls(config); List<String> xmlFormDefinitions = getXmlFormDefinitions(formUrls, config); List<FormDefinition> formDefinitions = parseXmlFormDefinitions(xmlFormDefinitions, config); modifyFormDefinitionForImplementation(formDefinitions); updateFormDefinitions(formDefinitions, config.getName()); tasksService.updateTasksChannel(); return new ImportStatus(true); } catch (Exception e) { LOGGER.error(e.toString()); return new ImportStatus(false); } }

Target:
public ImportStatus importForms(Configuration config) { try { List<String> formUrls = getFormUrls(config); List<String> xmlFormDefinitions = getXmlFormDefinitions(formUrls, config); List<FormDefinition> formDefinitions = parseXmlFormDefinitions(xmlFormDefinitions, config); modifyFormDefinitionForImplementation(formDefinitions); updateFormDefinitions(formDefinitions, config.getName()); tasksService.updateTasksChannel(); return new ImportStatus(true); } catch (Exception e) { LOGGER.error("Unable to import forms.", e); return new ImportStatus(false); } }
Source:
private int activateTexture (Texture texture) { subImageScaleWidth = texture.getWidth() * invMaxTextureWidth; subImageScaleHeight = texture.getHeight() * invMaxTextureHeight; if (subImageScaleWidth > 1f || subImageScaleHeight > 1f) { throw new IllegalStateException( "Texture " + texture.getTextureObjectHandle() + " is larger than the Array Texture: [" + texture.getWidth() + "," + texture.getHeight() + "] > [" + (int)(1f / invMaxTextureWidth) + "," + (int)(1f / invMaxTextureHeight) + "]"); } invTexWidth = subImageScaleWidth / texture.getWidth(); invTexHeight = subImageScaleHeight / texture.getHeight(); final int textureHandle = texture.getTextureObjectHandle(); for (int i = 0; i < currentTextureLFUSize; i++) { if (textureHandle == usedTextures[i].getTextureObjectHandle()) { usedTexturesLFU[i]++; return i; } } if (currentTextureLFUSize < maxTextureLevels) { usedTextures[currentTextureLFUSize] = texture; usedTexturesLFU[currentTextureLFUSize]++; copyTextureIntoArrayTexture(texture, currentTextureLFUSize); return currentTextureLFUSize++; } else { if (idx > 0) { flush(); } int slot = 0; int slotVal = usedTexturesLFU[0]; int max = 0; int average = 0; for (int i = 0; i < maxTextureLevels; i++) { final int val = usedTexturesLFU[i]; max = Math.max(val, max); average += val; if (val <= slotVal) { slot = i; slotVal = val; } } final int normalizeRange = 100; for (int i = 0; i < maxTextureLevels; i++) { usedTexturesLFU[i] = usedTexturesLFU[i] * normalizeRange / max; } average = (average * normalizeRange) / (max * maxTextureLevels); usedTexturesLFU[slot] = average; usedTextures[slot] = texture; copyTextureIntoArrayTexture(texture, slot); currentTextureLFUSwaps++; return slot; } }

Target:
private int activateTexture (Texture texture) { subImageScaleWidth = texture.getWidth() * invMaxTextureWidth; subImageScaleHeight = texture.getHeight() * invMaxTextureHeight; if (subImageScaleWidth > 1f || subImageScaleHeight > 1f) { throw new IllegalStateException("Texture " + texture.getTextureObjectHandle() + " is larger than the Array Texture: [" + texture.getWidth() + "," + texture.getHeight() + "] > [" + maxTextureWidth + "," + maxTextureHeight + "]"); } invTexWidth = subImageScaleWidth / texture.getWidth(); invTexHeight = subImageScaleHeight / texture.getHeight(); final int textureSlot = findTextureCacheIndex(texture); if (textureSlot >= 0) { if (textureSlot == usedTexturesNextSwapSlot) { usedTexturesNextSwapSlot = (usedTexturesNextSwapSlot + 1) % currentTextureLFUSize; } return textureSlot; } if (currentTextureLFUSize < maxTextureSlots) { usedTextures[currentTextureLFUSize] = texture; copyTextureIntoArrayTexture(texture, currentTextureLFUSize); currentTextureLFUSwaps++; return currentTextureLFUSize++; } else { if (idx > 0) { flush(); } final int slot = usedTexturesNextSwapSlot; usedTexturesNextSwapSlot = (usedTexturesNextSwapSlot + 1) % currentTextureLFUSize; usedTextures[slot] = texture; copyTextureIntoArrayTexture(texture, slot); currentTextureLFUSwaps++; return slot; } }
Source:
public TLSSocketChannel( ByteChannel channel, Logger logger, SSLEngine sslEngine ) throws IOException { this.logger = logger; this.channel = channel; this.sslEngine = sslEngine; this.plainIn = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherIn = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); this.plainOut = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherOut = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); try { runHandshake(); } catch ( SSLHandshakeException e ) { Throwable error = e; if( error.getCause() != null ) { error = e.getCause(); } throw new ClientException( "Failed to establish secured connection with the server: " + error.getMessage(), error.getCause() ); } }

Target:
TLSSocketChannel( ByteChannel channel, Logger logger, SSLEngine sslEngine ) throws IOException { this.logger = logger; this.channel = channel; this.sslEngine = sslEngine; this.plainIn = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherIn = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); this.plainOut = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherOut = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); }
Source:
public List<Class<?>> getCommands() { List<Class<?>> cmdList = new ArrayList<Class<?>>(); cmdList.add(AddNuageVspDeviceCmd.class); cmdList.add(DeleteNuageVspDeviceCmd.class); cmdList.add(ListNuageVspDevicesCmd.class); cmdList.add(IssueNuageVspResourceRequestCmd.class); cmdList.add(UpdateNuageVspDeviceCmd.class); return cmdList; }

Target:
public List<Class<?>> getCommands() { return Lists.<Class<?>>newArrayList(AddNuageVspDeviceCmd.class, DeleteNuageVspDeviceCmd.class, ListNuageVspDevicesCmd.class, IssueNuageVspResourceRequestCmd.class, UpdateNuageVspDeviceCmd.class); }
Source:
public void testExtractCheckConstraints() throws Exception { XContentBuilder builder = XContentFactory.jsonBuilder() .startObject() .startObject(Constants.DEFAULT_MAPPING_TYPE) .startObject("_meta") .startObject("check_constraints") .field("test3_check_1", "id >= 0") .field("test3_check_2", "title != 'Pink Power Ranger'") .endObject() .endObject() .startObject("properties") .startObject("id").field("type", "integer").endObject() .startObject("title").field("type", "string").endObject() .endObject() .endObject() .endObject(); IndexMetaData metaData = getIndexMetaData("test3", builder); DocIndexMetaData md = newMeta(metaData, "test3"); assertThat(md.checkConstraints().size(), is(2)); for (AnalyzedCheckConstraint chk : md.checkConstraints()) { switch (chk.name()) { case "test3_check_1": assertThat(chk.expression(), is(SqlParser.createExpression("id >= 0"))); break; case "test3_check_2": assertThat(chk.expression(), is(SqlParser.createExpression("title <> 'Pink Power Ranger'"))); break; } } }

Target:
public void testExtractCheckConstraints() throws Exception { XContentBuilder builder = XContentFactory.jsonBuilder() .startObject() .startObject(Constants.DEFAULT_MAPPING_TYPE) .startObject("_meta") .startObject("check_constraints") .field("test3_check_1", "id >= 0") .field("test3_check_2", "title != 'Programming Clojure'") .endObject() .endObject() .startObject("properties") .startObject("id").field("type", "integer").endObject() .startObject("title").field("type", "string").endObject() .endObject() .endObject() .endObject(); IndexMetaData metaData = getIndexMetaData("test3", builder); DocIndexMetaData md = newMeta(metaData, "test3"); assertThat(md.checkConstraints().size(), is(2)); assertThat(md.checkConstraints() .stream() .map(CheckConstraint::expressionStr) .collect(Collectors.toList()), containsInAnyOrder( equalTo("id >= 0"), equalTo("title != 'Programming Clojure'") )); }
Source:
private List<Location> flowForNullableMethodParameters(ExplodedGraph.Node node) { if (node.parent() != null || !domains.contains(ObjectConstraint.class)) { return ImmutableList.of(); } ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); trackedSymbols.forEach(symbol -> { SymbolicValue sv = node.programState.getValue(symbol); if (sv == null) { return; } ObjectConstraint startConstraint = node.programState.getConstraint(sv, ObjectConstraint.class); if (startConstraint != null && !isAnnotatedNullable(symbol) && isMethodParameter(symbol)) { String msg = IMPLIES_CAN_BE_NULL_MSG; if (ObjectConstraint.NOT_NULL == startConstraint) { msg = "Implies '%s' can not be null."; } flowBuilder.add(new JavaFileScannerContext.Location(String.format(msg, symbol.name()), ((VariableTree) symbol.declaration()).simpleName())); } }); return flowBuilder.build(); }

Target:
private List<JavaFileScannerContext.Location> flowForNullableMethodParameters(ExplodedGraph.Node node) { if (!node.edges().isEmpty() || !domains.contains(ObjectConstraint.class)) { return ImmutableList.of(); } ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); trackedSymbols.forEach(symbol -> { SymbolicValue sv = node.programState.getValue(symbol); if (sv == null) { return; } ObjectConstraint startConstraint = node.programState.getConstraint(sv, ObjectConstraint.class); if (startConstraint != null && isMethodParameter(symbol)) { String msg = IMPLIES_CAN_BE_NULL_MSG; if (ObjectConstraint.NOT_NULL == startConstraint) { msg = "Implies '%s' can not be null."; } flowBuilder.add(new JavaFileScannerContext.Location(String.format(msg, symbol.name()), ((VariableTree) symbol.declaration()).simpleName())); } }); return flowBuilder.build(); }
Source:
public AuditLogType getAuditLogTypeValue() { if (getSucceeded()) { return AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE; } else { return errorType == null ? AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE_FAILED : errorType; } }

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue(GlusterConstants.UPDATE_REASON, getParameters().getReason()); if (getSucceeded()) { return AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE; } else { return errorType == null ? AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE_FAILED : errorType; } }
Source:
public void execute(CommandCall node, Evaluator evaluator, ResultRecorder resultRecorder) { String exampleName = getExampleName(node); boolean isBeforeExample = isBeforeExample(node); resultRecorder.setSpecificationDescription( specificationDescriber.getDescription(node.getResource(), exampleName)); if (!isBeforeExample) { announceBeforeExample(exampleName, node.getElement(), resultRecorder); } try { if (exampleFilter != null && exampleFilter.shouldSkip(node.getElement())) { resultRecorder.setImplementationStatus(ImplementationStatus.SKIPPED); } else { node.getChildren().processSequentially(evaluator, resultRecorder); } } catch (FailFastException f) { } setupCommandForExample(node, resultRecorder, exampleName); if (!isBeforeExample) { announceAfterExample(exampleName, node.getElement(), resultRecorder); } }

Target:
public void execute(CommandCall node, Evaluator evaluator, ResultRecorder resultRecorder) { String exampleName = getExampleName(node); boolean isBeforeExample = isBeforeExample(node); resultRecorder.setSpecificationDescription( specificationDescriber.getDescription(node.getResource(), exampleName)); ImplementationStatus status = getImplementationStatus(node); if (!isBeforeExample && status != ImplementationStatus.IGNORED) { announceBeforeExample(exampleName, node.getElement(), resultRecorder); } try { resultRecorder.setImplementationStatus(status); if (status == ImplementationStatus.IGNORED) { resultRecorder.record(Result.IGNORED); } else { node.getChildren().processSequentially(evaluator, resultRecorder); } } catch (FailFastException f) { } setupCommandForExample(node, resultRecorder, exampleName); if (!isBeforeExample && status != ImplementationStatus.IGNORED) { announceAfterExample(exampleName, node.getElement(), resultRecorder); } }
Source:
protected void recover(Message message) throws Exception { IndexInfo info = indexInfo.create(message); String uri = info.getId() != null ? String.format( "/%s/%s/%s", info.getIndex(), info.getType(), info.getId()) : String.format( "/%s/%s/", info.getIndex(), info.getType()); String entity = info.getSource() instanceof Map ? jsonMapper.writeValueAsString(info.getSource()) : info.getSource().toString(); HttpResponse response = client.executeWithLoadBalancer( HttpRequest.newBuilder() .verb(HttpRequest.Verb.POST) .setRetriable(true) .uri(uri) .entity(entity) .build()); IOUtils.toByteArray(response.getInputStream()); }

Target:
protected void recover(Message message) throws Exception { IndexInfo info = indexInfo.create(message); String uri = info.getId() != null ? String.format( "/%s/%s/%s", info.getIndex(), info.getType(), info.getId()) : String.format( "/%s/%s/", info.getIndex(), info.getType()); String entity = info.getSource() instanceof Map ? jsonMapper.writeValueAsString(info.getSource()) : info.getSource().toString(); HttpResponse response = null; try { response = client.executeWithLoadBalancer( HttpRequest.newBuilder() .verb(HttpRequest.Verb.POST) .setRetriable(true) .uri(uri) .entity(entity) .build()); if (response.getStatus() / 100 != 2) { Servo.getCounter( MonitorConfig.builder("unrecoverableRow") .withTag(SINK_ID, getSinkId()) .withTag(TagKey.ROUTING_KEY, message.getRoutingKey()) .build()).increment(); } } catch (Exception e) { log.error("Exception while recover: " + e.getMessage(), e); Servo.getCounter("recoverException").increment(); writeTo(new DefaultMessageContainer(message, jsonMapper)); } finally { if (response != null) { response.close(); } } }
Source:
public InputStream getStream() { if (Guard.isStringNullOrEmpty(requestPayload)) { return null; } final byte[] stringBytes = requestPayload.getBytes(); this.size = stringBytes.length; return new ByteArrayInputStream(stringBytes); }

Target:
public InputStream getStream() { if (Guard.isStringNullOrEmpty(requestPayload)) { return null; } final byte[] stringBytes = requestPayload.getBytes(Charset.forName("UTF-8")); this.size = stringBytes.length; return new ByteArrayInputStream(stringBytes); }
Source:
public CompletionTimeProcessing processOneToOne(String tenantId, CompletionTimeProcessing completionTimeProcessing) throws RetryAttemptException{ Span rootSpan = completionTimeProcessing.getRootSpan(); List<Span> trace = spanCache.getTrace(tenantId, rootSpan.getTraceId()); if (trace == null) { throw new RetryAttemptException("trace not present in the cache"); } Annotation lastAnnotation = extractLastAnnotation(trace); if (lastAnnotation == null) { return null; } if (completionTimeProcessing.getLastTimestamp() == null || completionTimeProcessing.getLastTimestamp() < lastAnnotation.getTimestamp()) { completionTimeProcessing.setCompletionTime(null); completionTimeProcessing.setLastTimestamp(lastAnnotation.getTimestamp()); return completionTimeProcessing; } CompletionTime completionTime = CompletionTimeUtil.spanToCompletionTime(rootSpan); completionTime.setProperties(extractProperties(trace)); completionTime.setDuration(getTraceDuration(rootSpan, lastAnnotation.getTimestamp())); completionTimeProcessing.setCompletionTime(completionTime); return completionTimeProcessing; }

Target:
public CompletionTimeProcessing processOneToOne(String tenantId, CompletionTimeProcessing completionTimeProcessing) throws RetryAttemptException{ if (completionTimeProcessing.getCompletionTime() != null) { return null; } Span rootSpan = completionTimeProcessing.getRootSpan(); Set<Span> trace = spanCache.getTrace(tenantId, rootSpan.getTraceId()); if (trace == null) { throw new RetryAttemptException("trace not present in the cache"); } Annotation lastAnnotation = extractLastAnnotation(trace); if (lastAnnotation == null) { throw new RetryAttemptException("No annotation present, cannot calculate completion time - trying retry"); } if (completionTimeProcessing.getLastTimestamp() == null || completionTimeProcessing.getLastTimestamp() < lastAnnotation.getTimestamp()) { completionTimeProcessing.setLastTimestamp(lastAnnotation.getTimestamp()); return completionTimeProcessing; } CompletionTime completionTime = CompletionTimeUtil.spanToCompletionTime(rootSpan); completionTime.setProperties(extractProperties(trace)); completionTime.setDuration(getTraceDuration(rootSpan, lastAnnotation.getTimestamp())); completionTimeProcessing.setCompletionTime(completionTime); return completionTimeProcessing; }
Source:
protected void initRPC() throws IOException { InetSocketAddress bindAddr = getRpcAddressToBindTo(); LOG.info("ZKFC RpcServer binding to " + bindAddr); rpcServer = new ZKFCRpcServer(conf, bindAddr, this, getPolicyProvider()); }

Target:
protected void initRPC() throws IOException { InetSocketAddress bindAddr = getRpcAddressToBindTo(); LOG.info("ZKFC RpcServer binding to {}", bindAddr); rpcServer = new ZKFCRpcServer(conf, bindAddr, this, getPolicyProvider()); }
Source:
public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); Matcher m = PARSE_PATTERN.matcher(filters); while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); boolean exclude = "exclude".equals(m.group("exclude")); String event = m.group("event"); String recipient = m.group("recipient"); String transport = null; String name = null; if ("*".equals(event)) { event = null; } if (!"*".equals(recipient)) { String s[] = recipient.split(":", 2); if (s.length != 2) { throw new RuntimeException( String.format( "Invalid recipient: '%s'", recipient )); } transport = s[0]; name = s[1]; } ret.add(new FilterEntry(event, exclude,transport, name)); } return Collections.unmodifiableList(ret); }

Target:
public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); if (!PATTERN_BLANK.matcher(filters).matches()) { Matcher m = PATTERN_PARSE.matcher(filters); boolean ok = false; int expectedStart = 0; while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); if (m.start() != expectedStart) { throw new RuntimeException("Cannot parse filters"); } expectedStart = m.end(); ok = m.end() == m.regionEnd(); ret.add( new FilterEntry( m.group("anymsg") != null ? null : m.group("message"), m.group("exclude") != null, m.group("anyrecipient") != null ? null : m.group("transport"), m.group("name") ) ); } if (!ok) { throw new IllegalArgumentException("Cannot parse filters"); } } return Collections.unmodifiableList(ret); }
Source:
public void execute(DelegateExecution execution) { ThrowMessage throwMessage = getThrowMessage(execution); boolean isSent = send(execution, throwMessage); if(isSent) dispatchEvent(execution, throwMessage); super.execute(execution); }

Target:
public void execute(DelegateExecution execution) { ThrowMessage throwMessage = getThrowMessage(execution); boolean isSent = send(execution, throwMessage); if(isSent) { dispatchEvent(execution, throwMessage); } super.execute(execution); }
Source:
protected void tearDown() throws Exception { IRemoteServices fRemoteServices; IRemoteConnection fRemoteConnection; fRemoteServices = PTPRemoteCorePlugin.getDefault().getRemoteServices("org.eclipse.ptp.remote.RemoteTools"); assertNotNull(fRemoteServices); IRemoteConnectionManager connMgr = fRemoteServices.getConnectionManager(); assertNotNull(connMgr); fRemoteConnection = connMgr.getConnection(CONNECTION_NAME); final IRemoteFileManager fileManager = fRemoteServices.getFileManager(fRemoteConnection); final IFileStore dstFileStore = fileManager.getResource(CONNECTION_DIR); dstFileStore.delete(EFS.NONE, null); }

Target:
protected void tearDown() { deleteResource(CONNECTION_DIR); }
Source:
private void generateRequestParameterArgsBuilderMethodImplementation(String format, String request, String member, String type) { buffer.addImport(ArrayList.class); buffer.addLine(format, request, member, type); buffer.addLine( "this.%1$s = new ArrayList<>();", member); buffer.addLine( "for (int i = 0; i < %1$s.length; i++) {", member); buffer.addLine( "this.%1$s.add(%1$s[i].build());", member); buffer.addLine( "}"); buffer.addLine( "return this;"); buffer.addLine("}"); buffer.addLine(); }

Target:
private void generateRequestParameterArgsBuilderMethodImplementation(String format, String request, String member, String type) { buffer.addImport(ArrayList.class); buffer.addLine(format, request, member, type); buffer.addLine( "this.%1$s = new ArrayList<>(%1$s.length);", member); buffer.addLine( "for (%1$s element : %2$s) {", type, member); buffer.addLine( "this.%1$s.add(element.build());", member); buffer.addLine( "}"); buffer.addLine( "return this;"); buffer.addLine("}"); buffer.addLine(); }
Source:
private void deleteBucketLifeCycle(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("lifecycle", ""); HttpResponse response = executeDelete(bucketName, "", queryParamMap); response.body().close(); }

Target:
public void deleteBucketLifeCycle(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("lifecycle", ""); HttpResponse response = executeDelete(bucketName, "", queryParamMap); response.body().close(); }
Source:
public String toHaskell() { return String.format("%s%d", Function.ARG_PREFIX, this.getPosition()); }

Target:
public String toHaskell() { return this.name; }
Source:
public String getNextAvailableMacAddress(final long networkConfigId, Integer zoneMacIdentifier) { final SequenceFetcher fetch = SequenceFetcher.getInstance(); long seq = fetch.getNextSequence(Long.class, _tgMacAddress, networkConfigId); if(zoneMacIdentifier!=0){ seq = seq | _prefix << 40 | (long)zoneMacIdentifier << 32 | networkConfigId << 16 & 0x00000000ffff0000l; } else { seq = seq | _prefix << 40 | _rand.nextInt(Short.MAX_VALUE) << 16 & 0x00000000ffff0000l; } return NetUtils.long2Mac(seq); }

Target:
public String getNextAvailableMacAddress(final long networkConfigId, Integer zoneMacIdentifier) { final SequenceFetcher fetch = SequenceFetcher.getInstance(); long seq = fetch.getNextSequence(Long.class, _tgMacAddress, networkConfigId); if(zoneMacIdentifier != null && zoneMacIdentifier.intValue() != 0 ){ seq = seq | _prefix << 40 | (long)zoneMacIdentifier << 32 | networkConfigId << 16 & 0x00000000ffff0000l; } else { seq = seq | _prefix << 40 | _rand.nextInt(Short.MAX_VALUE) << 16 & 0x00000000ffff0000l; } return NetUtils.long2Mac(seq); }
Source:
private Mono<Void> sendMessageForReactiveFlow(MessageChannel requestChannel, Message<?> requestMessage) { if (requestChannel instanceof ReactiveStreamsSubscribableChannel) { return ((ReactiveStreamsSubscribableChannel) requestChannel) .subscribeToUpstream(Mono.just(requestMessage)); } else { long sendTimeout = sendTimeout(requestMessage); boolean sent = sendTimeout >= 0 ? requestChannel.send(requestMessage, sendTimeout) : requestChannel.send(requestMessage); return Mono.just(sent) .filter(Boolean::booleanValue) .switchIfEmpty(Mono.error(new MessageDeliveryException(requestMessage, "Failed to send message to channel '" + requestChannel + "' within timeout: " + sendTimeout))) .then(); } }

Target:
private Mono<Void> sendMessageForReactiveFlow(MessageChannel requestChannel, Message<?> requestMessage) { if (requestChannel instanceof ReactiveStreamsSubscribableChannel) { return ((ReactiveStreamsSubscribableChannel) requestChannel) .subscribeToUpstream(Mono.just(requestMessage)); } else { long sendTimeout = sendTimeout(requestMessage); boolean sent = sendTimeout >= 0 ? requestChannel.send(requestMessage, sendTimeout) : requestChannel.send(requestMessage); return sent ? Mono.empty() : Mono.error(new MessageDeliveryException(requestMessage, "Failed to send message to channel '" + requestChannel + "' within timeout: " + sendTimeout)); } }
Source:
private static Archive<?> deploy() { WebArchive war = TestUtil.prepareArchive(SpringMvcHttpResponseCodesTest.class.getSimpleName()); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/web-secure.xml", "web.xml"); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/jboss-web.xml", "jboss-web.xml"); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/mvc-dispatcher-servlet.xml", "mvc-dispatcher-servlet.xml"); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/applicationContext.xml", "applicationContext.xml"); war.addAsManifestResource(new StringAsset("Dependencies: org.springframework.spring meta-inf\n"), "MANIFEST.MF"); war.addClass(SpringMvcHttpResponseCodesPerson.class); war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new LoggingPermission("control", ""), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers") ), "permissions.xml"); return TestUtil.finishContainerPrepare(war, null, SpringMvcHttpResponseCodesResource.class, TestResource.class); }

Target:
private static Archive<?> deploy() { WebArchive war = TestUtil.prepareArchive(SpringMvcHttpResponseCodesTest.class.getSimpleName()); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/web-secure.xml", "web.xml"); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/jboss-web.xml", "jboss-web.xml"); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/mvc-dispatcher-servlet.xml", "mvc-dispatcher-servlet.xml"); war.addAsWebInfResource(SpringMvcHttpResponseCodesTest.class.getPackage(), "springMvcHttpResponseCodes/applicationContext.xml", "applicationContext.xml"); war.addAsManifestResource(new StringAsset("Dependencies: org.springframework.spring meta-inf\n"), "MANIFEST.MF"); war.addClass(SpringMvcHttpResponseCodesPerson.class); war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new LoggingPermission("control", ""), new ReflectPermission("suppressAccessChecks") ), "permissions.xml"); return TestUtil.finishContainerPrepare(war, null, SpringMvcHttpResponseCodesResource.class, TestResource.class); }
Source:
protected void locateFile() { FileDialog dialog = new FileDialog(getEditorSite().getShell(), SWT.NONE); dialog.setFilterNames(new String[] {SourceLookupUIMessages.CSourceNotFoundEditor_2}); dialog.setFilterExtensions(new String[] {"*." + FilenameUtils.getExtension(missingFile)}); String res = dialog.open(); if (res != null) { if (IOCase.INSENSITIVE.checkEquals(FilenameUtils.getName(missingFile), FilenameUtils.getName(res))) { String compPath = FilenameUtils.getFullPath(missingFile); IPath newSourcePath = new Path(FilenameUtils.getFullPath(res)); if (compPath.length() > 0) { try { if (isDebugElement) addSourceMappingToLaunch(compPath, newSourcePath); else addSourceMappingToCommon(compPath, newSourcePath); } catch (CoreException e) { } } IWorkbenchPage page = getEditorSite().getPage(); if (isDebugElement) { ISourceDisplay adapter = context.getAdapter(ISourceDisplay.class); if (adapter != null) { adapter.displaySource(context, page, true); } } else if (isTranslationUnit) { reopenTranslationUnit(tunit); } closeEditor(); } } }

Target:
protected void locateFile() { FileDialog dialog = new FileDialog(getEditorSite().getShell(), SWT.NONE); dialog.setFilterNames(new String[] {SourceLookupUIMessages.CSourceNotFoundEditor_2}); CDebugUtils.FileParts missingFileParts = CDebugUtils.getFileParts(missingFile); dialog.setFilterExtensions(new String[] {"*." + missingFileParts.getExtension()}); String res = dialog.open(); if (res != null) { CDebugUtils.FileParts resParts = CDebugUtils.getFileParts(res); if (resParts.getFileName().toLowerCase().equals(missingFileParts.getFileName().toLowerCase())) { String compPath = missingFileParts.getFolder(); IPath newSourcePath = new Path(resParts.getFolder()); if (compPath.length() > 0) { try { if (isDebugElement) addSourceMappingToLaunch(compPath, newSourcePath); else addSourceMappingToCommon(compPath, newSourcePath); } catch (CoreException e) { } } IWorkbenchPage page = getEditorSite().getPage(); if (isDebugElement) { ISourceDisplay adapter = context.getAdapter(ISourceDisplay.class); if (adapter != null) { adapter.displaySource(context, page, true); } } else if (isTranslationUnit) { reopenTranslationUnit(tunit); } closeEditor(); } } }
Source:
public void map(LongWritable key, Text value, OutputCollector<VKmer, Node> output, Reporter reporter) throws IOException { lineCount++; long readID = 0; String mate0GeneLine = null; String mate1GeneLine = null; if (fastqFormat) { } else { String[] rawLine = value.toString().split("\\t"); if (rawLine.length == 2) { readID = Long.parseLong(rawLine[0]); mate0GeneLine = rawLine[1]; } else if (rawLine.length == 3) { readID = Long.parseLong(rawLine[0]); mate0GeneLine = rawLine[1]; mate1GeneLine = rawLine[2]; } else { throw new IllegalStateException( "input format is not true! only support id'\t'readSeq'\t'mateReadSeq or id'\t'readSeq'"); } } Pattern genePattern = Pattern.compile("[AGCT]+"); if (mate0GeneLine != null) { Matcher geneMatcher = genePattern.matcher(mate0GeneLine); if (geneMatcher.matches()) { thisReadSequence.setAsCopy(mate0GeneLine); if (mate1GeneLine != null) { mateReadSequence.setAsCopy(mate1GeneLine); readHeadInfo.set((byte) 0, readID, 0, thisReadSequence, mateReadSequence); } else { readHeadInfo.set((byte) 0, readID, 0, thisReadSequence, null); } SplitReads(readID, mate0GeneLine.getBytes(), output); } } if (mate1GeneLine != null) { Matcher geneMatcher = genePattern.matcher(mate1GeneLine); if (geneMatcher.matches()) { thisReadSequence.setAsCopy(mate1GeneLine); mateReadSequence.setAsCopy(mate0GeneLine); readHeadInfo.set((byte) 1, readID, 0, thisReadSequence, mateReadSequence); SplitReads(readID, mate1GeneLine.getBytes(), output); } } }

Target:
public void map(LongWritable key, Text value, OutputCollector<VKmer, Node> output, Reporter reporter) throws IOException { lineCount++; long readID = 0; String mate0GeneLine = null; String mate1GeneLine = null; String[] rawLine = value.toString().split("\\t"); if (rawLine.length == 2) { readID = Long.parseLong(rawLine[0]); mate0GeneLine = rawLine[1]; } else if (rawLine.length == 3) { readID = Long.parseLong(rawLine[0]); mate0GeneLine = rawLine[1]; mate1GeneLine = rawLine[2]; } else { throw new IllegalStateException( "input format is not true! only support id'\t'readSeq'\t'mateReadSeq or id'\t'readSeq'"); } Pattern genePattern = Pattern.compile("[AGCT]+"); if (mate0GeneLine != null) { Matcher geneMatcher = genePattern.matcher(mate0GeneLine); if (geneMatcher.matches()) { thisReadSequence.setAsCopy(mate0GeneLine); if (mate1GeneLine != null) { mateReadSequence.setAsCopy(mate1GeneLine); readHeadInfo.set((byte) 0, readID, 0, thisReadSequence, mateReadSequence); } else { readHeadInfo.set((byte) 0, readID, 0, thisReadSequence, null); } SplitReads(readID, mate0GeneLine.getBytes(), output); } } else { throw new IllegalStateException("thisReadSequence doesn't exist which is not allowed!"); } if (mate1GeneLine != null) { Matcher geneMatcher = genePattern.matcher(mate1GeneLine); if (geneMatcher.matches()) { thisReadSequence.setAsCopy(mate1GeneLine); mateReadSequence.setAsCopy(mate0GeneLine); readHeadInfo.set((byte) 1, readID, 0, thisReadSequence, mateReadSequence); SplitReads(readID, mate1GeneLine.getBytes(), output); } } }
Source:
public void readPayload(int id, PacketBuffer buffer, Side side, MessageContext ctx) throws IOException { super.readPayload(id, buffer, side, ctx); if(id == NET_RENDER_DATA) { if(buffer.readBoolean()) { recipe = new IntegrationRecipe(buffer); } else { recipe = null; } } }

Target:
public void readPayload(int id, PacketBuffer buffer, Side side, MessageContext ctx) throws IOException { super.readPayload(id, buffer, side, ctx); if(id == NET_GUI_DATA) { if(buffer.readBoolean()) { recipe = new IntegrationRecipe(buffer); } else { recipe = null; } } }
Source:
public boolean equals(final Object other) { if (other instanceof UInt128) { return this.low == ((UInt128) other).low && this.high == ((UInt128) other).high; } return false; }

Target:
public boolean equals(final Object other) { if (other instanceof UInt128) { final UInt128 uInt128Other = (UInt128) other; return this.low == uInt128Other.low && this.high == uInt128Other.high; } return false; }
Source:
private List<String> testGetVariantsByRegionHelper(String testRegion, int expectedVariants, HttpStatus status) throws URISyntaxException { String url = "/v2/regions/" + testRegion + "?species=mmusculus&assembly=grcm38"; ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); assertEquals(status, response.getStatusCode()); Configuration configuration = Configuration.defaultConfiguration() .jsonProvider(new JacksonJsonProvider()) .mappingProvider(new JacksonMappingProvider(objectMapper)) .addOptions(Option.SUPPRESS_EXCEPTIONS); List<Variant> variantList = JsonPath.using(configuration).parse(response.getBody()) .read( "$['_embedded']['variantList']", new TypeRef<List<Variant>>() {}); if (variantList == null) { assertEquals(0,expectedVariants); return null; } assertEquals(expectedVariants,variantList.size()); List<String> chromosomes = new ArrayList<>(); variantList.forEach(variant -> { chromosomes.add(variant.getChromosome()); }); return chromosomes; }

Target:
private List<String> testGetVariantsByRegionHelper(String testRegion, int expectedVariants, HttpStatus status) throws URISyntaxException { String url = "/v2/regions/" + testRegion + "/variants?species=mmusculus&assembly=grcm38"; ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); assertEquals(status, response.getStatusCode()); Configuration configuration = Configuration.defaultConfiguration() .jsonProvider(new JacksonJsonProvider()) .mappingProvider(new JacksonMappingProvider(objectMapper)) .addOptions(Option.SUPPRESS_EXCEPTIONS); List<Variant> variantList = JsonPath.using(configuration).parse(response.getBody()) .read( "$['_embedded']['variantList']", new TypeRef<List<Variant>>() {}); if (variantList == null) { assertEquals(0,expectedVariants); return null; } assertEquals(expectedVariants,variantList.size()); List<String> chromosomes = new ArrayList<>(); variantList.forEach(variant -> { chromosomes.add(variant.getChromosome()); }); return chromosomes; }
Source:
public void setCurrentHeading(double headingInDegrees){ currentHeading.setValue(headingInDegrees); }

Target:
public void setCurrentHeading(double headingInDegrees){ double rawHeading = getRobotYaw().getValue(); headingOffset = -rawHeading + headingInDegrees; }
Source:
private void autofillFromBuildConfig() { String userName = BuildConfig.DOTCOM_LOGIN_USERNAME; String password = BuildConfig.DOTCOM_LOGIN_PASSWORD; if (!TextUtils.isEmpty(userName)) { mUsernameEditText.setText(userName); AppLog.d(T.NUX, "Autofilled username from build config"); } if (!TextUtils.isEmpty(password)) { mPasswordEditText.setText(password); AppLog.d(T.NUX, "Autofilled password from build config"); } }

Target:
private void autofillFromBuildConfig() { if (!BuildConfig.DEBUG) return; String userName = (String) WordPress.getBuildConfigValue(getActivity().getApplication(), "DEBUG_DOTCOM_LOGIN_USERNAME"); String password = (String) WordPress.getBuildConfigValue(getActivity().getApplication(), "DEBUG_DOTCOM_LOGIN_PASSWORD"); if (!TextUtils.isEmpty(userName)) { mUsernameEditText.setText(userName); AppLog.d(T.NUX, "Autofilled username from build config"); } if (!TextUtils.isEmpty(password)) { mPasswordEditText.setText(password); AppLog.d(T.NUX, "Autofilled password from build config"); } }
Source:
public Collection<ArticleRevision> getArticlesRevisedOn(LocalDate fromDate, LocalDate toDate) { return hibernateTemplate.execute(session -> { Query query = session.createQuery("" + "SELECT ar " + "FROM ArticleRevision ar " + "INNER JOIN ar.ingestion ai " + "INNER JOIN ar.ingestion.article at " + "WHERE ai.revisionDate >= :fromDate AND ai.revisionDate < :toDate " + "AND ar.revisionId IS NOT NULL"); query.setParameter("fromDate", java.sql.Date.valueOf(fromDate)); query.setParameter("toDate", java.sql.Date.valueOf(toDate.plusDays(1))); return (Collection<ArticleRevision>) query.list(); }); }

Target:
public Collection<ArticleRevision> getArticlesRevisedOn(LocalDate fromDate, LocalDate toDate) { return hibernateTemplate.execute(session -> { Query query = session.createQuery("" + "SELECT ar " + "FROM ArticleRevision ar " + "INNER JOIN ar.ingestion ai " + "INNER JOIN ar.ingestion.article at " + "WHERE ai.revisionDate >= :fromDate AND ai.revisionDate <= :toDate " + "AND ar.revisionId IS NOT NULL"); query.setParameter("fromDate", java.sql.Date.valueOf(fromDate)); query.setParameter("toDate", java.sql.Date.valueOf(toDate)); return (Collection<ArticleRevision>) query.list(); }); }
Source:
private Response responseWithInvalidCardDetails() { return ResponseUtil.badResponse(String.format("Values do not match expected format/length.")); }

Target:
private Response responseWithInvalidCardDetails() { return ResponseUtil.badResponse("Values do not match expected format/length."); }
Source:
protected void setUp() throws Exception { super.setUp(); activator.setProfileActivationFilePathInterpolator( new ProfileActivationFilePathInterpolator().setPathTranslator( new DefaultPathTranslator() ) ); context.setProjectDirectory( new File( PATH ) ); File file = new File( PATH + FILE ); if ( !file.exists() ) { if ( !file.createNewFile() ) { throw new RuntimeException( String.format( "Can't create %s", file ) ); } } }

Target:
protected void setUp() throws Exception { super.setUp(); activator.setProfileActivationFilePathInterpolator( new ProfileActivationFilePathInterpolator().setPathTranslator( new DefaultPathTranslator() ) ); context.setProjectDirectory( new File( PATH ) ); File file = new File( PATH + FILE ); if ( !file.exists() ) { if ( !file.createNewFile() ) { throw new IOException( "Can't create " + file ); } } }
Source:
private static void checkSuspiciousCall(CallExpression callExpression, Symbol calleeSymbol, SubscriptionContext ctx) { Tree parent = TreeUtils.firstAncestorOfKind(callExpression, Tree.Kind.ASSIGNMENT_STMT, Tree.Kind.CALL_EXPR); if (parent == null) { return; } if (parent.is(Tree.Kind.ASSIGNMENT_STMT)) { AssignmentStatement parentAssignment = (AssignmentStatement) parent; if (parentAssignment.lhsExpressions().get(0).expressions().get(0) instanceof HasSymbol) { Symbol symbol = ((HasSymbol) parentAssignment.lhsExpressions().get(0).expressions().get(0)).symbol(); if (symbol == null) { return; } if(hasUnsafeContextUsage(calleeSymbol, symbol)) { ctx.addIssue(callExpression, MESSAGE); } } } else if (opensUnsecureConnection(calleeSymbol, (CallExpression) parent)) { ctx.addIssue(callExpression, MESSAGE); } }

Target:
private static void checkSuspiciousCall(CallExpression callExpression, Symbol calleeSymbol, SubscriptionContext ctx) { Tree parent = TreeUtils.firstAncestorOfKind(callExpression, Tree.Kind.ASSIGNMENT_STMT, Tree.Kind.CALL_EXPR); if (parent == null) { return; } if (parent.is(Tree.Kind.ASSIGNMENT_STMT)) { Expression lhs = ((AssignmentStatement) parent).lhsExpressions().get(0).expressions().get(0); if (lhs instanceof HasSymbol) { Symbol symbol = ((HasSymbol) lhs).symbol(); if (symbol == null) { return; } if (isUnsafeContext(calleeSymbol, symbol)) { ctx.addIssue(callExpression, MESSAGE); } } } else if (opensUnsecureConnection(calleeSymbol, (CallExpression) parent)) { ctx.addIssue(callExpression, MESSAGE); } }
Source:
public void updateComments(String courseId, CommentSendingState oldState, CommentSendingState newState) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); List<Comment> comments = getCommentEntitiesForSendingState(courseId, oldState); for (Comment comment : comments) { if (!JDOHelper.isDeleted(comment)) { comment.setSendingState(newState); } } log.info(Const.SystemParams.COURSE_BACKUP_LOG_MSG + courseId); getPM().close(); }

Target:
public void updateComments(String courseId, CommentSendingState oldState, CommentSendingState newState) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); List<Comment> comments = getCommentEntitiesForSendingState(courseId, oldState); for (Comment comment : comments) { comment.setSendingState(newState); } log.info(Const.SystemParams.COURSE_BACKUP_LOG_MSG + courseId); getPM().close(); }
Source:
public Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration) { Function precision = args.getQuick(1); if (precision.isConstant()) { int precisionValue = precision.getInt(null); return (precisionValue != Numbers.INT_NaN && precisionValue * precisionValue <= Numbers.pow10max * Numbers.pow10max) ? new FuncConst(position, args.getQuick(0), precision) : new DoubleConstant(position, Double.NaN); } return new Func(position, args.getQuick(0), args.getQuick(1)); }

Target:
public Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration) { Function scale = args.getQuick(1); if (scale.isConstant()) { int scaleValue = scale.getInt(null); if (scaleValue != Numbers.INT_NaN) { if (scaleValue > -1 && scaleValue < Numbers.pow10max) { return new FuncPosConst(position, args.getQuick(0), scaleValue); } if (scaleValue < 0 && scaleValue > -Numbers.pow10max) { return new FuncNegConst(position, args.getQuick(0), -scaleValue); } } return new DoubleConstant(position, Double.NaN); } return new Func(position, args.getQuick(0), args.getQuick(1)); }
Source:
protected void getAllParametersTest(String url, String mimeType, String fileType, Profile profile, boolean isPostable) throws Exception { when(fetchService.fetch(any(String.class), any(URL.class))).thenReturn(getNldiSites()); String filteredUrl = HttpConstants.SUMMARY_ORGANIZATION_ENDPOINT + "?summaryYears=" + SummaryOrganizationStreamingIT.SUMMARY_YEARS_12_MONTHS + "&mimeType=" + GEOJSON; assertEquals("", filteredHeaderCheck(callMockHead(filteredUrl, mimeType, getContentDisposition(profile, fileType))).andReturn().getResponse().getContentAsString()); MvcResult rtn = filteredHeaderCheck(callMockGet(filteredUrl, mimeType, getContentDisposition(profile, fileType))).andReturn(); assertThat(new JSONObject(getCompareFile(profile, fileType, "Filtered")), sameJSONObjectAs(new JSONObject(rtn.getResponse().getContentAsString())).allowingAnyArrayOrdering()); if (isPostable) { rtn = filteredHeaderCheck(callMockPostJson(url, getSourceFile("summaryPostParameters.json").replace("[DATA_PROFILE]", profile.toString()), mimeType, getContentDisposition(profile, fileType))).andReturn(); assertThat(new JSONObject(getCompareFile(profile, fileType, "Filtered")), sameJSONObjectAs(new JSONObject(rtn.getResponse().getContentAsString())).allowingAnyArrayOrdering()); rtn = unFilteredHeaderCheck(callMockPostEmptyForm(url, mimeType, getContentDisposition(profile, fileType))).andReturn(); assertThat(new JSONObject(getCompareFile(profile, fileType, null)), sameJSONObjectAs(new JSONObject(rtn.getResponse().getContentAsString())).allowingAnyArrayOrdering()); } }

Target:
protected void getAllParametersTest(String url, String mimeType, String fileType, Profile profile, boolean isPostable) throws Exception { String filteredUrl = HttpConstants.SUMMARY_ORGANIZATION_ENDPOINT + "?summaryYears=" + SummaryOrganizationStreamingIT.SUMMARY_YEARS_12_MONTHS + "&mimeType=" + JSON + "&organization=" + TEST_MONITORING_LOCACTION_1 + "&organization=" + TEST_MONITORING_LOCACTION_2; assertEquals("", filteredHeaderCheck(callMockHead(filteredUrl, mimeType, getContentDisposition(profile, fileType))).andReturn().getResponse().getContentAsString()); MvcResult rtn = filteredHeaderCheck(callMockGet(filteredUrl, mimeType, getContentDisposition(profile, fileType))).andReturn(); assertThat(new JSONObject(getCompareFile(profile, fileType, "Filtered")), sameJSONObjectAs(new JSONObject(rtn.getResponse().getContentAsString())).allowingAnyArrayOrdering()); if (isPostable) { rtn = filteredHeaderCheck(callMockPostJson(url, getSourceFile("summaryPostParameters.json").replace("[DATA_PROFILE]", profile.toString()), mimeType, getContentDisposition(profile, fileType))).andReturn(); assertThat(new JSONObject(getCompareFile(profile, fileType, "Filtered")), sameJSONObjectAs(new JSONObject(rtn.getResponse().getContentAsString())).allowingAnyArrayOrdering()); rtn = unFilteredHeaderCheck(callMockPostEmptyForm(url, mimeType, getContentDisposition(profile, fileType))).andReturn(); assertThat(new JSONObject(getCompareFile(profile, fileType, null)), sameJSONObjectAs(new JSONObject(rtn.getResponse().getContentAsString())).allowingAnyArrayOrdering()); } }