auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void processRecord(ComputationContext context, String inputStreamName, Record record) { Codec<DataBucket> codec = BulkCodecs.getDataBucketCodec(); DataBucket in = codec.decode(record.getData()); String commandId = in.getCommandId(); Blob blob = getBlob(in.getDataAsString()); blob = sort(blob, commandId); File blobFile = blob.getFile(); try { BufferedReader br = new BufferedReader(new FileReader(blobFile)); String header = in.getHeaderAsString(); StringBuilder result = StringUtils.isNotEmpty(header) ? new StringBuilder(String.format("%s%n", header)) <START> : new StringBuilder(); <END> String line; while ((line = br.readLine()) != null) { result.append(String.format("%s%n", line)); } String footer = in.getFooterAsString(); if (StringUtils.isNotEmpty(footer)) { result.append(footer); } blobFile.delete(); FileOutputStream fos = new FileOutputStream(blobFile); fos.write(result.toString().getBytes()); fos.flush(); } catch (IOException e) { getLog().error(e, e); } storeBlob(blob, commandId); DataBucket out = new DataBucket(commandId, in.getCount(), getTransientStoreKey(commandId)); context.produceRecord(OUTPUT_1, Record.of(commandId, codec.encode(out))); context.askForCheckpoint(); }</code><technical_language>create stringbuilder append header if empty for footer</technical_language>

Target:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { Codec<DataBucket> codec = BulkCodecs.getDataBucketCodec(); DataBucket in = codec.decode(record.getData()); String commandId = in.getCommandId(); Blob tmpBlob = getBlob(in.getDataAsString()); tmpBlob = sort(tmpBlob, commandId); Path path = createTemp(commandId); try (InputStream is = tmpBlob.getStream(); FileOutputStream os = new FileOutputStream(path.toFile(), true)) { os.write(in.getHeader()); IOUtils.copy(is, os); os.write(in.getFooter()); os.flush(); tmpBlob.getFile().delete(); } catch (IOException e) { getLog().error(e, e); } storeBlob(new FileBlob(path.toFile()), commandId); DataBucket out = new DataBucket(commandId, in.getCount(), getTransientStoreKey(commandId)); context.produceRecord(OUTPUT_1, Record.of(commandId, codec.encode(out))); context.askForCheckpoint(); }
Source:
<code>public void execute(List<String> resources) { final DefaultInfinispanInsertionStrategy defaultInfinispanInsertionStrategy = new DefaultInfinispanInsertionStrategy(); resources.stream() .map(DataSetLoader::resolve) .forEach((InputStream dataset) -> { try { defaultInfinispanInsertionStrategy.insert(() -> infinispanBasicCache, dataset); } catch (Throwable e) { <START> throw new IllegalStateException(e); <END> } }); }</code><technical_language>add a short message circumstances this error happened? Otherwise, obvious stack trace</technical_language>

Target:
public void execute(List<String> resources) { final DefaultInfinispanInsertionStrategy defaultInfinispanInsertionStrategy = new DefaultInfinispanInsertionStrategy(); resources.stream() .map(DataSetLoader::resolve) .forEach((InputStream dataset) -> { try { defaultInfinispanInsertionStrategy.insert(() -> infinispanBasicCache, dataset); } catch (Throwable e) { throw new IllegalStateException(String.format("Error inserting %s resources.", resources), e); } }); }
Source:
<code>protected Control createContents(Composite parent) { getWorkbench().getHelpSystem().setHelp(getControl(), ICDebugHelpContextIds.C_DEBUG_PREFERENCE_PAGE); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); GridData data = new GridData(); data.verticalAlignment = GridData.FILL; data.horizontalAlignment = GridData.FILL; composite.setLayoutData(data); createSpacer(composite, 1); createCharsetSettingPreferences(composite); createSpacer(composite, 1); createBinarySettings(composite); createShowSourceNotFoundEditor(composite); <START> createShowSourceNotFoundAllTime(fButtonGroupForSourceNotFound); <END> setValues(); return composite; }</code><technical_language>this variable "appears" out of nowhere. Reading this method hard understand this field from. I recommend instead createContents calls new method createShowSourceNotFoundGroup(composite) createShowSourceNotFoundGroup creates Group calls createShowSourceNotFoundEditor createShowSourceNotFoundAllTime group a parameter. alternative is do in editor put contents of createShowSourceNotFoundAllTime in createShowSourceNotFoundEditor. way, I need a field for fButtonGroupForSourceNotFound. ---- thought, createShowSourceNotFoundAllTime method is lines of code, sense option 2 for clarity</technical_language>

Target:
protected Control createContents(Composite parent) { getWorkbench().getHelpSystem().setHelp(getControl(), ICDebugHelpContextIds.C_DEBUG_PREFERENCE_PAGE); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); GridData data = new GridData(); data.verticalAlignment = GridData.FILL; data.horizontalAlignment = GridData.FILL; composite.setLayoutData(data); createSpacer(composite, 1); createCharsetSettingPreferences(composite); createSpacer(composite, 1); createBinarySettings(composite); Group fButtonGroupForSourceNotFound = new Group(composite, SWT.SHADOW_ETCHED_IN); createShowSourceNotFoundEditor(fButtonGroupForSourceNotFound); setValues(); return composite; }
Source:
<code>@Override public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { <START> if (EP_BATCH_HANDLER.equalsIgnoreCase(extensionPoint)) { <END> if (BatchHandlerDescriptor.class.isAssignableFrom(contribution.getClass())) { BatchHandlerDescriptor contributionDescriptor = (BatchHandlerDescriptor) contribution; handlers.remove(contributionDescriptor.getName()); } } }</code><technical_language>else throw error invalid class</technical_language>

Target:
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { if (EP_BATCH_HANDLER.equals(extensionPoint)) { if (BatchHandlerDescriptor.class.isAssignableFrom(contribution.getClass())) { BatchHandlerDescriptor contributionDescriptor = (BatchHandlerDescriptor) contribution; String name = contributionDescriptor.getName(); handlers.remove(name); } } }
Source:
<code>public ClaimsParametersImpl( Principal principal, Set<Principal> roles, Map<String, Object> additionalProperties) { this.principal = principal; <START> this.roles = roles; <END> this.additionalProperties = additionalProperties; }</code><technical_language>recommend defensive copies of roles additionalProperties collections callers modify addAll putAll new collections</technical_language>

Target:
public ClaimsParametersImpl( Principal principal, Set<Principal> roles, Map<String, Object> additionalProperties) { this.principal = principal; this.roles = new HashSet<>(roles); this.additionalProperties = new HashMap<>(additionalProperties); }
Source:
<code>public boolean supports(HandlerResult result) { <START> Assert.notNull(result, "'result' must not be null"); <END> Object handler = result.getHandler(); return handler instanceof HandlerMethod && WebFluxInboundEndpoint.class.isAssignableFrom(((HandlerMethod) handler).getBeanType()); }</code><technical_language>I need this assert; Spring call this a null result</technical_language>

Target:
public boolean supports(HandlerResult result) { Object handler = result.getHandler(); return handler instanceof HandlerMethod && WebFluxInboundEndpoint.class.isAssignableFrom(((HandlerMethod) handler).getBeanType()); }
Source:
<code>public void updateOrganisation(final MetricOrganisation organisation) { if (organisation == null) { return; } <START> final Company company = Company.find(organisation.id()); <END> company.setName(organisation.name()); try { Company.update(company); } catch (final Exception e) { logger.warn("Error updating an Intercom company: - {}", company, e.getMessage()); } }</code><technical_language>if company in this line</technical_language>

Target:
public void updateOrganisation(final MetricOrganisation organisation) { if (organisation == null) { return; } try { final Company company = Company.find(organisation.id()); company.setName(organisation.name()); Company.update(company); } catch (final Exception e) { logger.warn("Error updating an Intercom company: - {}", organisation.id(), e.getMessage()); } }
Source:
<code>public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { if (isCORSSupport) { <START> synchronized (this) { <END> if (initialized) { long now = System.currentTimeMillis(); if (lastInitializationTime + delayBeforeReinit < now) { initialized = false; lastInitializationTime = now; } } } } if (!initialized) { synchronized (this) { if (!initialized) { lazyInit(); initialized = true; } } } if (delegate != null) { delegate.doFilter(request, response, chain); } else { chain.doFilter(request, response); } }</code><technical_language>I concerned this synchronization. means CORS is enabled API calls contend for this lock. works happen if synchronize is multiple threads set "initialized" flag false simultaneously. then, due other synchronization below, of perform call "lazyInit" method. is needed for this work is put "initialized = false" statement a synchronized block change is visible for other threads: if (initialized) { long = ...; if (...) { synchronized (this) { initialized = false; } lastInitializationTime = now; } }</technical_language>

Target:
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { if (delegate != null) { if (initialized) { long now = System.currentTimeMillis(); if (lastInitializationTime + delayBeforeReinit < now) { synchronized (this) { initialized = false; } lastInitializationTime = now; } } } if (!initialized) { synchronized (this) { if (!initialized) { createDelegate(); initialized = true; } } } if (delegate != null) { delegate.doFilter(request, response, chain); } else { chain.doFilter(request, response); } }
Source:
<code>private boolean canBulkCreateNewBranch(Repository[] repositories) { for (Repository repo : repositories) { if (!hasBranches(repo)) { return false; } if (repo.isBare()) { return false; } <START> if (repo.getRepositoryState().isRebasing()) { return false; } if (RepositoryUtil.hasChanges(repo)) { return false; } <END> } return true; }</code><technical_language>check for SAFE better</technical_language>

Target:
private boolean canBulkCreateNewBranch(Repository[] repositories) { for (Repository repo : repositories) { if (!hasBranches(repo)) { return false; } if (repo.isBare()) { return false; } if (repo.getRepositoryState() != RepositoryState.SAFE) { return false; } } return true; }
Source:
<code>RestartWatchJob(IClient client){ <START> super("WatchMananger Job"); <END> this.client = client; }</code><technical_language>good catch, missing job name resulting in a unnamed jobs in progress view - reported QE, out jstack</technical_language>

Target:
RestartWatchJob(IClient client){ super("OpenShift WatchMananger Job"); this.client = client; }
Source:
<code>void open() throws Exception; void open(int maxIO, boolean useExecutor) throws Exception; boolean fits(int size); int calculateBlockStart(int position) throws Exception; String getFileName(); void fill(int size) throws Exception; <START> void delete() throws Exception; <END> void write(ActiveMQBuffer bytes, boolean sync, IOCallback callback) throws Exception; void write(ActiveMQBuffer bytes, boolean sync) throws Exception; void write(EncodingSupport bytes, boolean sync, IOCallback callback) throws Exception; void write(EncodingSupport bytes, boolean sync) throws Exception; void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback); void writeDirect(ByteBuffer bytes, boolean sync) throws Exception; void blockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer) throws Exception; int read(ByteBuffer bytes, IOCallback callback) throws Exception; int read(ByteBuffer bytes) throws Exception; void position(long pos) throws IOException; long position(); void close() throws Exception; default void close(boolean waitSync) throws Exception { close(); }</code><technical_language>revert this explicit exceptions</technical_language>

Target:
void open() throws Exception; void open(int maxIO, boolean useExecutor) throws Exception; boolean fits(int size); int calculateBlockStart(int position) throws Exception; String getFileName(); void fill(int size) throws Exception; void delete() throws IOException, InterruptedException, ActiveMQException; void write(ActiveMQBuffer bytes, boolean sync, IOCallback callback) throws Exception; void write(ActiveMQBuffer bytes, boolean sync) throws Exception; void write(EncodingSupport bytes, boolean sync, IOCallback callback) throws Exception; void write(EncodingSupport bytes, boolean sync) throws Exception; void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback); void writeDirect(ByteBuffer bytes, boolean sync) throws Exception; void blockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer) throws Exception; int read(ByteBuffer bytes, IOCallback callback) throws Exception; int read(ByteBuffer bytes) throws Exception; void position(long pos) throws IOException; long position(); void close() throws Exception; default void close(boolean waitSync) throws Exception { close(); }
Source:
<code><START> public static Admin create(Properties props) { <END> return KafkaAdminClient.createInternal(new AdminClientConfig(props, true), null); }</code><technical_language>This is a breaking change, right? for other create method in this class</technical_language>

Target:
public static AdminClient create(Properties props) { return (AdminClient) Admin.create(props); }
Source:
<code>private MapReduceCommand parseMapReduceCommand(String jsonClause) { String collectionName = jsonClause.replaceFirst("(?ms).*?\\.\\s*(.+?)\\s*\\.\\s*mapReduce\\s*\\(.*", "$1"); if (collectionName.contains("getCollection")) { <START> collectionName = collectionName.replaceFirst(".*getCollection\\s*\\(\\s*['\"](.*)['\"]\\s*\\).*", "$1"); <END> } DBCollection collection = mongoDb.getCollection(collectionName); String body = jsonClause.replaceFirst("^(?ms).*?mapReduce\\s*\\(\\s*(.*)\\s*\\)\\s*;?\\s*$", "$1"); String mapFunction = findCommaSeparatedArgument(body, 0).trim(); String reduceFunction = findCommaSeparatedArgument(body, 1).trim(); String query = findCommaSeparatedArgument(body, 2).trim(); DBObject parameters = (DBObject) JSON.parse(query); DBObject mongoQuery; if (parameters.containsField("query")) { mongoQuery = (DBObject) parameters.get("query"); } else { mongoQuery = new BasicDBObject(); } return new MapReduceCommand(collection, mapFunction, reduceFunction, null, MapReduceCommand.OutputType.INLINE, mongoQuery); }</code><technical_language>collectionName = collectionName.replaceFirst(".*getCollection\\s*\\(\\s*(['\"])([^'\"]+)\\1\\s*\\).*", "$2"); I regex matches more robust</technical_language>

Target:
private MapReduceCommand parseMapReduceCommand(String jsonClause) { String collectionName = jsonClause.replaceFirst("(?ms).*?\\.\\s*(.+?)\\s*\\.\\s*mapReduce\\s*\\(.*", "$1"); if (collectionName.contains("getCollection")) { collectionName = collectionName.replaceFirst(".*getCollection\\s*\\(\\s*(['\"])([^'\"]+)\\1\\s*\\).*", "$2"); } DBCollection collection = mongoDb.getCollection(collectionName); String body = jsonClause.replaceFirst("^(?ms).*?mapReduce\\s*\\(\\s*(.*)\\s*\\)\\s*;?\\s*$", "$1"); String mapFunction = findCommaSeparatedArgument(body, 0).trim(); String reduceFunction = findCommaSeparatedArgument(body, 1).trim(); String query = findCommaSeparatedArgument(body, 2).trim(); DBObject parameters = (DBObject) JSON.parse(query); DBObject mongoQuery; if (parameters.containsField("query")) { mongoQuery = (DBObject) parameters.get("query"); } else { mongoQuery = new BasicDBObject(); } return new MapReduceCommand(collection, mapFunction, reduceFunction, null, MapReduceCommand.OutputType.INLINE, mongoQuery); }
Source:
<code>public void setLatLonBoundingBox(CRSEnvelope latLonBoundingBox) { if( latLonBoundingBox.getSRSName() != null ){ String srsName = latLonBoundingBox.getSRSName(); if( !srsName.equals("CRS:84")){ throw new IllegalStateException("Layer LatLonBoundingBox srsName required to be null or CRS:84"); } <START> }else { <END> latLonBoundingBox.setSRSName("CRS:84",false);; } this.latLonBoundingBox = latLonBoundingBox; }</code><technical_language>Formatting, "} else {". I repeat this for occurrences, please check diffs changes (and those) respect coding conventions</technical_language>

Target:
public void setLatLonBoundingBox(CRSEnvelope latLonBoundingBox) { if( latLonBoundingBox.getSRSName() != null ){ String srsName = latLonBoundingBox.getSRSName(); if( !srsName.equals("CRS:84")){ throw new IllegalStateException("Layer LatLonBoundingBox srsName required to be null or CRS:84"); } } else { latLonBoundingBox.setSRSName("CRS:84",false); } this.latLonBoundingBox = latLonBoundingBox; }
Source:
<code>public void emitTuples() { if (currentWindowId <= windowManager.getLargestRecoveryWindow()) { return; } int pollSize = (emitQueue.size() < batchSize) ? emitQueue.size() : batchSize; while (pollSize-- > 0) { <START> T obj = emitQueue.poll(); <END> emitTuple(obj); lastEmittedRecord++; } }</code><technical_language>Check for obj == null, in case queue empty</technical_language>

Target:
public void emitTuples() { if (currentWindowId <= windowManager.getLargestRecoveryWindow()) { return; } int pollSize = (emitQueue.size() < batchSize) ? emitQueue.size() : batchSize; while (pollSize-- > 0) { T obj = emitQueue.poll(); if (obj != null) { emitTuple(obj); } lastEmittedRow++; } }
Source:
<code>public static QcDto asDto(QC from) { QcDto dto = new QcDto(); dto.setId(from.getId()); dto.setDate(getDateString(from.getDate())); dto.setCreator(from.getCreator().getFullName()); dto.setType(asDto(from.getType())); dto.setResults(from.getResults()); <START> dto.setOwnerId(from.getEntity().getId()); <END> dto.setOwnerAlias(from.getEntity().getAlias()); return dto; }</code><technical_language>Other places in MISO owner refer a user, refer QC-able thing. do changing field name DTO owner entity match QC model</technical_language>

Target:
public static QcDto asDto(QC from) { QcDto dto = new QcDto(); dto.setId(from.getId()); dto.setDate(formatDate(from.getDate())); dto.setCreator(from.getCreator().getFullName()); dto.setType(asDto(from.getType())); dto.setResults(from.getResults()); dto.setEntityId(from.getEntity().getId()); dto.setEntityAlias(from.getEntity().getAlias()); return dto; }
Source:
<code>private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Community").withLogo("logo_community") <START> .build(); <END> String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/bitstreams/" + parentCommunity.getLogo().getID(), expectedStatus); }</code><technical_language>a context.restoreAuthSystemState(); here. I need get in habit of turning authorization create test content. In this specific test matter much, more of a safety net tests specifically testing *authorization* accidentally disabling important parts of test</technical_language>

Target:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Community").withLogo("logo_community") .build(); context.restoreAuthSystemState(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/bitstreams/" + parentCommunity.getLogo().getID(), expectedStatus); }
Source:
<code>private void setAccount() throws OrmException, IOException, UnloggedFailure { user = genericUserFactory.create(id); rsrc = new AccountResource(user); try { for (String email : addEmails) { addEmail(email); } for (String email : deleteEmails) { deleteEmail(email); } if (preferredEmail != null) { if <START> (isRegistered(preferredEmail)) { putPreferred(preferredEmail); <END> } else { System.err.println("WARNING: preferred email not set, " + preferredEmail + " not registered"); } } if (fullName != null) { PutName.Input in = new PutName.Input(); in.name = fullName; putName.apply(rsrc, in); } if (httpPassword != null || clearHttpPassword) { PutHttpPassword.Input in = new PutHttpPassword.Input(); in.httpPassword = httpPassword; putHttpPassword.apply(rsrc, in); } if (active) { putActive.apply(rsrc, null); } else if (inactive) { try { deleteActive.apply(rsrc, null); } catch (ResourceNotFoundException e) { } } addSshKeys = readSshKey(addSshKeys); if (!addSshKeys.isEmpty()) { addSshKeys(addSshKeys); } deleteSshKeys = readSshKey(deleteSshKeys); if (!deleteSshKeys.isEmpty()) { deleteSshKeys(deleteSshKeys); } } catch (RestApiException e) { throw die(e.getMessage()); } }</code><technical_language>verbose logic is preaded in places. return, method: putPreferred do there: search for preferred mail, change return issue warning found</technical_language>

Target:
private void setAccount() throws OrmException, IOException, UnloggedFailure { user = genericUserFactory.create(id); rsrc = new AccountResource(user); try { for (String email : addEmails) { addEmail(email); } for (String email : deleteEmails) { deleteEmail(email); } if (preferredEmail != null) { putPreferred(preferredEmail); } if (fullName != null) { PutName.Input in = new PutName.Input(); in.name = fullName; putName.apply(rsrc, in); } if (httpPassword != null || clearHttpPassword) { PutHttpPassword.Input in = new PutHttpPassword.Input(); in.httpPassword = httpPassword; putHttpPassword.apply(rsrc, in); } if (active) { putActive.apply(rsrc, null); } else if (inactive) { try { deleteActive.apply(rsrc, null); } catch (ResourceNotFoundException e) { } } addSshKeys = readSshKey(addSshKeys); if (!addSshKeys.isEmpty()) { addSshKeys(addSshKeys); } deleteSshKeys = readSshKey(deleteSshKeys); if (!deleteSshKeys.isEmpty()) { deleteSshKeys(deleteSshKeys); } } catch (RestApiException e) { throw die(e.getMessage()); } }
Source:
<code>public void testSearchParamsQueryCustomExpression() { <START> this.gateway.setSearchArgs("new SearchParameters('foo' + payload).count(5).sinceId(11)"); <END> Tweet tweet = new Tweet(1L, "foo", new Date(), "bar", "baz", 0L, 0L, "qux", "fiz"); SearchMetadata searchMetadata = mock(SearchMetadata.class); final SearchResults searchResults = new SearchResults(Collections.singletonList(tweet), searchMetadata); doAnswer(new Answer<SearchResults>() { @Override public SearchResults answer(InvocationOnMock invocation) throws Throwable { SearchParameters searchParameters = (SearchParameters) invocation.getArguments()[0]; assertEquals("foobar", searchParameters.getQuery()); assertEquals(Integer.valueOf(5), searchParameters.getCount()); assertEquals(Long.valueOf(11), searchParameters.getSinceId()); return searchResults; } }).when(this.searchOps).search(Matchers.any(SearchParameters.class)); this.gateway.handleMessage(new GenericMessage<String>("bar")); Message<?> reply = this.outputChannel.receive(0); assertNotNull(reply); @SuppressWarnings("unchecked") List<Tweet> tweets = (List<Tweet>) reply.getPayload(); assertEquals(1, tweets.size()); assertSame(tweet, tweets.get(0)); assertSame(searchMetadata, reply.getHeaders().get(TwitterHeaders.SEARCH_METADATA)); }</code><technical_language>#searchParams() SpEL-function instead of new SearchParameters() ?. need registerImport("org.springframework.social.twitter.api")</technical_language>

Target:
public void testSearchParamsQueryCustomExpression() { this.gateway.setSearchArgsExpression(new SpelExpressionParser() .parseExpression("new SearchParameters('foo' + payload).count(5).sinceId(11)")); Tweet tweet = new Tweet(1L, "foo", new Date(), "bar", "baz", 0L, 0L, "qux", "fiz"); SearchMetadata searchMetadata = mock(SearchMetadata.class); final SearchResults searchResults = new SearchResults(Collections.singletonList(tweet), searchMetadata); doAnswer(new Answer<SearchResults>() { @Override public SearchResults answer(InvocationOnMock invocation) throws Throwable { SearchParameters searchParameters = (SearchParameters) invocation.getArguments()[0]; assertEquals("foobar", searchParameters.getQuery()); assertEquals(Integer.valueOf(5), searchParameters.getCount()); assertEquals(Long.valueOf(11), searchParameters.getSinceId()); return searchResults; } }).when(this.searchOps).search(Matchers.any(SearchParameters.class)); this.gateway.handleMessage(new GenericMessage<String>("bar")); Message<?> reply = this.outputChannel.receive(0); assertNotNull(reply); @SuppressWarnings("unchecked") List<Tweet> tweets = (List<Tweet>) reply.getPayload(); assertEquals(1, tweets.size()); assertSame(tweet, tweets.get(0)); assertSame(searchMetadata, reply.getHeaders().get(TwitterHeaders.SEARCH_METADATA)); }
Source:
<code>ArraySchema.Builder load() { ArraySchema.Builder builder = ArraySchema.builder(); ls.schemaJson().maybe("minItems").map(JsonValue::requireInteger).ifPresent(builder::minItems); ls.schemaJson().maybe("maxItems").map(JsonValue::requireInteger).ifPresent(builder::maxItems); ls.schemaJson().maybe("uniqueItems").map(JsonValue::requireBoolean).ifPresent(builder::uniqueItems); if (config.useDefaults) <START> ls.schemaJson().maybe("default").map(JsonValue::deepToOrgJson).ifPresent(builder::defaultValue); <END> ls.schemaJson().maybe("additionalItems").ifPresent(maybe -> { maybe.canBe(Boolean.class, builder::additionalItems) .or(JsonObject.class, obj -> builder.schemaOfAdditionalItems(defaultLoader.loadChild(obj).build())) .requireAny(); }); ls.schemaJson().maybe("items").ifPresent(items -> { items.canBeSchema(itemSchema -> builder.allItemSchema(defaultLoader.loadChild(itemSchema).build())) .or(JsonArray.class, arr -> buildTupleSchema(builder, arr)) .requireAny(); }); if (config.specVersion == DRAFT_6) { ls.schemaJson().maybe("contains").ifPresent(containedRawSchema -> addContainedSchema(builder, containedRawSchema)); } return builder; }</code><technical_language>notes in #buildBooleanSchema()</technical_language>

Target:
ArraySchema.Builder load() { ArraySchema.Builder builder = ArraySchema.builder(); ls.schemaJson().maybe("minItems").map(JsonValue::requireInteger).ifPresent(builder::minItems); ls.schemaJson().maybe("maxItems").map(JsonValue::requireInteger).ifPresent(builder::maxItems); ls.schemaJson().maybe("uniqueItems").map(JsonValue::requireBoolean).ifPresent(builder::uniqueItems); ls.schemaJson().maybe("additionalItems").ifPresent(maybe -> { maybe.canBe(Boolean.class, builder::additionalItems) .or(JsonObject.class, obj -> builder.schemaOfAdditionalItems(defaultLoader.loadChild(obj).build())) .requireAny(); }); ls.schemaJson().maybe("items").ifPresent(items -> { items.canBeSchema(itemSchema -> builder.allItemSchema(defaultLoader.loadChild(itemSchema).build())) .or(JsonArray.class, arr -> buildTupleSchema(builder, arr)) .requireAny(); }); if (config.specVersion == DRAFT_6) { ls.schemaJson().maybe("contains").ifPresent(containedRawSchema -> addContainedSchema(builder, containedRawSchema)); } return builder; }
Source:
<code>private ExtendSANStorageDomainParameters createParameters(Guid storageDomainId, List<LogicalUnit> newLuns, boolean force) { ExtendSANStorageDomainParameters params = new ExtendSANStorageDomainParameters(); params.setStorageDomainId(storageDomainId); <START> ArrayList<String> lunIds = newLuns.stream().map(LogicalUnit::getId).collect(Collectors.toCollection(ArrayList::new)); <END> params.setLunIds(lunIds); params.setForce(force); return params; }</code><technical_language>nice change parameters class List instead of ArrayList, "toList"</technical_language>

Target:
private ExtendSANStorageDomainParameters createParameters(Guid storageDomainId, List<LogicalUnit> newLuns, boolean force) { ExtendSANStorageDomainParameters params = new ExtendSANStorageDomainParameters(); params.setStorageDomainId(storageDomainId); ArrayList<String> lunIds = newLuns.stream().map(LogicalUnit::getId).collect(toCollection(ArrayList::new)); params.setLunIds(lunIds); params.setForce(force); return params; }
Source:
<code>private void notifyLocalListener(Collection<CacheEntryEvent<? extends K, ? extends V>> evts, @Nullable IgniteClosure<CacheEntryEvent<? extends K, ? extends V>, ?> trans) { EventListener locTransLsnr = localTransformedEventListener(); <START> if (F.isEmpty(evts)) <END> return; if (locLsnr != null) locLsnr.onUpdated(evts); if (locTransLsnr != null) locTransLsnr.onUpdated(transform(trans, evts)); }</code><technical_language>This assertion fired locLsnr locTransLsnr null. dropped this case</technical_language>

Target:
private void notifyLocalListener(Collection<CacheEntryEvent<? extends K, ? extends V>> evts, @Nullable IgniteClosure<CacheEntryEvent<? extends K, ? extends V>, ?> trans) { EventListener locTransLsnr = localTransformedEventListener(); assert locLsnr == null || locTransLsnr == null; if (F.isEmpty(evts)) return; if (locLsnr != null) locLsnr.onUpdated(evts); if (locTransLsnr != null) locTransLsnr.onUpdated(transform(trans, evts)); }
Source:
<code>public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription description = null; if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { description = new DelegatingResourceDescription(); <START> <END> description.addProperty("identifierType"); description.addProperty("location"); description.addProperty("source"); description.addProperty("manualEntryEnabled"); description.addProperty("automaticGenerationEnabled"); } return description; }</code><technical_language>need support platform 2.1.*</technical_language>

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription description = null; if (rep instanceof RefRepresentation) { description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addSelfLink(); } if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("identifierType"); description.addProperty("source"); description.addProperty("manualEntryEnabled"); description.addProperty("automaticGenerationEnabled"); description.addSelfLink(); if (rep instanceof DefaultRepresentation) { description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); } } return description; }
Source:
<code>private void forkRepo(String repoToForkName) { System.out.println("Forking repository:"); String repoToForkOwner = "openmrs"; GitHubClient client = new GitHubClient(); System.out.print("- Client authentication"); client.setCredentials(githubUsername, githubPassword); System.out.println(" - DONE"); RepositoryService service = new RepositoryService(); System.out.print("- Service authentication"); service.getClient().setCredentials(githubUsername, githubPassword); System.out.println(" - DONE"); RepositoryId toBeForked = new RepositoryId(repoToForkOwner, repoToForkName); try { System.out.print("- Forking"); service.forkRepository(toBeForked); System.out.println(" - DONE"); } catch (IOException e) { e.printStackTrace(); <START> throw new IllegalStateException("Failed to fork repository \"" + repoToForkOwner + "/" + repoToForkName+ "\""); <END> } }</code><technical_language>include original exception arguemtn is displayed "caused by"</technical_language>

Target:
private void forkRepo(String repoToForkName) { wizard.showMessage("Forking repository:"); String repoToForkOwner = "openmrs"; GitHubClient client = new GitHubClient(); System.out.print("- Client authentication"); client.setCredentials(githubUsername, githubPassword); wizard.showMessage(" - DONE"); RepositoryService service = new RepositoryService(); System.out.print("- Service authentication"); service.getClient().setCredentials(githubUsername, githubPassword); wizard.showMessage(" - DONE"); RepositoryId toBeForked = new RepositoryId(repoToForkOwner, repoToForkName); try { System.out.print("- Forking"); service.forkRepository(toBeForked); wizard.showMessage(" - DONE"); } catch (IOException e) { throw new IllegalStateException("Failed to fork repository \"" + repoToForkOwner + "/" + repoToForkName+ "\"", e); } }
Source:
<code>public Faction read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; } <START> return Faction.fromFaValue(Integer.parseInt(in.nextString())); <END> }</code><technical_language>I prefer meaningful strings "aeon" stored in preferences numbers, of human readability (vs. magic numbers). Therefore, I suggest value.getString() write instead</technical_language>

Target:
public Faction read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; } return Faction.fromString(in.nextString()); }
Source:
<code>protected boolean requiresQuotes(final String identifier, final boolean precededByDot) { if (NON_UNDERSCORE_ALPHA_NUMERIC.matchesAnyOf(identifier)) { return true; <START> } else if (precededByDot && isUnquotedReservedWordsAsIdentifierSupported()) { <END> return false; } else { return isReservedWord(identifier); } }</code><technical_language>Consider field</technical_language>

Target:
protected boolean requiresQuotes(final String identifier, final boolean precededByDot) { if (NON_UNDERSCORE_ALPHA_NUMERIC.matchesAnyOf(identifier)) { return true; } else if (precededByDot && supportsUnquotedReservedWordsAsIdentifier) { return false; } else { return isReservedWord(identifier); } }
Source:
<code>private void addPLCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie plCookie = null; if (httpRequest.getCookies() != null) { for (Cookie c : httpRequest.getCookies()) { if (PL.equals(c.getName()) && c.getName() != null) { plCookie = c; break; } } } <START> if (plCookie == null) { <END> plCookie = new Cookie(PL, PL_SETTING.getValue()); plCookie.setPath("/"); response.addCookie(plCookie); } else if (!PL_SETTING.getValue().equalsIgnoreCase(plCookie.getValue())) { plCookie = new Cookie(PL, PL_SETTING.getValue()); plCookie.setPath("/"); response.addCookie(plCookie); } }</code><technical_language>this statement duplicate blocks</technical_language>

Target:
private void addPLCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie plCookie = null; if (httpRequest.getCookies() != null) { for (Cookie c : httpRequest.getCookies()) { if (PL.equals(c.getName()) && c.getName() != null) { plCookie = c; break; } } } if (plCookie == null || !PL_SETTING.getValue().equalsIgnoreCase(plCookie.getValue())) { plCookie = new Cookie(PL, PL_SETTING.getValue()); plCookie.setPath("/"); response.addCookie(plCookie); } }
Source:
<code>private static List<? extends ICodeMining> logCodeMiningProviderException(Throwable e) { String PLUGIN_ID= "org.eclipse.jface.text"; ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e)); <START> return new ArrayList<>(); <END> }</code><technical_language>Still, I this method return a value. context of usage, clear is a return value</technical_language>

Target:
private static void logCodeMiningProviderException(Throwable e) { String PLUGIN_ID= "org.eclipse.jface.text"; ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e)); }
Source:
<code>public JobConfig generateConfig(String executionPlanJson) { Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); if (streamGraph.hasWindowOrJoins() && !config.containsKey(TaskConfig.WINDOW_MS())) { <START> long triggerInterval = computeTriggerInterval(); <END> log.info("Using triggering interval: for jobName: {}", triggerInterval, jobName); configs.put(TaskConfig.WINDOW_MS(), String.valueOf(triggerInterval)); } log.info("Job has generated configs {}", jobName, configs); configs.put(CONFIG_INTERNAL_EXECUTION_PLAN, executionPlanJson); String configPrefix = String.format(CONFIG_JOB_PREFIX, jobName); return new JobConfig(Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix))); }</code><technical_language>windowInterval/timerInterval in this class (this is for triggers)</technical_language>

Target:
public JobConfig generateConfig(String executionPlanJson) { Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); if (streamGraph.hasWindowOrJoins()) { if ("-1".equals(config.get(TaskConfig.WINDOW_MS(), "-1"))) { long triggerInterval = computeTriggerInterval(); log.info("Using triggering interval: for jobName: {}", triggerInterval, jobName); configs.put(TaskConfig.WINDOW_MS(), String.valueOf(triggerInterval)); } } log.info("Job has generated configs {}", jobName, configs); configs.put(CONFIG_INTERNAL_EXECUTION_PLAN, executionPlanJson); String configPrefix = String.format(CONFIG_JOB_PREFIX, jobName); return new JobConfig(Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix))); }
Source:
<code>private String getProgressText(GlusterVolumeSizeInfo sizeStats) { if(sizeStats == null) { <START> return ConstantsManager.getInstance().getConstants().unknown(); <END> } else { return ConstantsManager.getInstance().getMessages().volumeCapacityUsedPercentage((int)((sizeStats.getUsedSize().floatValue() / sizeStats.getTotalSize().floatValue()) * 100)); } }</code><technical_language>"unknown" bigger accommodate, "?"</technical_language>

Target:
private String getProgressText(GlusterVolumeSizeInfo sizeStats) { if(sizeStats == null) { return ConstantsManager.getInstance().getConstants().noValue(); } else { return ConstantsManager.getInstance().getMessages().volumeCapacityUsedPercentage((int)((sizeStats.getUsedSize().floatValue() / sizeStats.getTotalSize().floatValue()) * 100)); } }
Source:
<code><START> public void afterTextChanged(Editable s) { <END> if (mModifiedText == null) { return; } SpanRange spanRange; if (mModifiedText.toString().contains("<")) { spanRange = restyleForChangedOpeningSymbol(s, "<"); } else if (mModifiedText.toString().contains(">")) { spanRange = restyleForChangedClosingSymbol(s, ">"); } else if (mModifiedText.toString().contains("&")) { spanRange = restyleForChangedOpeningSymbol(s, "&"); } else if (mModifiedText.toString().contains(";")) { spanRange = restyleForChangedClosingSymbol(s, ";"); } else { spanRange = restyleNormalTextIfWithinSymbols(s, "<", ">"); if (spanRange == null) { spanRange = restyleNormalTextIfWithinSymbols(s, "&", ";"); } } if (spanRange != null) { updateSpans(s, spanRange); } mModifiedText = null; mLastOperation = Operation.NONE; }</code><technical_language>Do need s is null empty and, if so, return</technical_language>

Target:
public void afterTextChanged(Editable s) { if (mModifiedText == null || s == null) { return; } SpanRange spanRange; if (mModifiedText.toString().contains("<")) { spanRange = getRespanRangeForChangedOpeningSymbol(s, "<"); } else if (mModifiedText.toString().contains(">")) { spanRange = getRespanRangeForChangedClosingSymbol(s, ">"); } else if (mModifiedText.toString().contains("&")) { spanRange = getRespanRangeForChangedOpeningSymbol(s, "&"); } else if (mModifiedText.toString().contains(";")) { spanRange = getRespanRangeForChangedClosingSymbol(s, ";"); } else { spanRange = getRespanRangeForNormalText(s, "<"); if (spanRange == null) { spanRange = getRespanRangeForNormalText(s, "&"); } } if (spanRange != null) { updateSpans(s, spanRange); } mModifiedText = null; mLastOperation = Operation.NONE; }
Source:
<code>public PlayerInfoBean getPlayerForUsername(String username) { PlayerInfoBean playerInfoBean = players.get(username); if(playerInfoBean == null) <START> logger.warn("Error returning playerInfoBean of {}", username); <END> return playerInfoBean; }</code><technical_language>"Error returning.." sounds "something wrong" in sense of exception so, "Unknown user: {}"</technical_language>

Target:
public PlayerInfoBean getPlayerForUsername(String username) { PlayerInfoBean playerInfoBean = players.get(username); if (playerInfoBean == null) { logger.warn("Unknown user: {}", username); } return playerInfoBean; }
Source:
<code>public void testFandomUniversityLink() { HomePage homePage = new HomePage(); GlobalNavigation globalNav = homePage.getGlobalNavigation(); globalNav = globalNav.openWikisMenu(); <START> homePage = globalNav.clickFandomUniversityLink(); <END> Assertion.assertEquals(homePage.getCurrentUrl(), urlBuilder.getUrlForPage("community", "/wiki/Fandom_University")); }</code><technical_language>homePage in homePage.getCurrentUrl() driver.getCurrentUrl()</technical_language>

Target:
public void testFandomUniversityLink() { new HomePage() .getGlobalNavigation() .openWikisMenu() .clickFandomUniversityLink(); Assertion.assertEquals(driver.getCurrentUrl(), urlBuilder.getUrlForPage("community", "/wiki/Fandom_University")); }
Source:
<code>public void debugRender (Sprite sprite, Color color) { tempColor = renderer.getColor(); renderer.setColor(color); renderer.rect(sprite.getBoundingRectangle().x, sprite.getBoundingRectangle().y, sprite.getBoundingRectangle().width, <START> sprite.getBoundingRectangle().height); <END> renderer.setColor(tempColor); }</code><technical_language>I for debug, calling getBoundingRectangle times great</technical_language>

Target:
public void debugRender (Sprite sprite, Color color) { tempColor = renderer.getColor(); tempBounds = sprite.getBoundingRectangle(); renderer.setColor(color); renderer.rect(tempBounds.x, tempBounds.y, tempBounds.width, tempBounds.height); renderer.setColor(tempColor); }
Source:
<code><START> String sanitized(String url) { <END> if (url != null) { final Matcher matcher = GIT_HTTP_URL_PATTERN.matcher(url); if (matcher.find()) { return matcher.group(1); } } return url; }</code><technical_language>happen</technical_language>

Target:
String sanitized(String url) { if (url != null) { final Matcher matcher = GIT_HTTP_URL_PATTERN.matcher(url); if (matcher.find()) { return matcher.group("sanitized"); } } return url; }
Source:
<code>public CoordinatorDynamicConfig( @JsonProperty("millisToWaitBeforeDeleting") long millisToWaitBeforeDeleting, @JsonProperty("mergeBytesLimit") long mergeBytesLimit, @JsonProperty("mergeSegmentsLimit") int mergeSegmentsLimit, @JsonProperty("maxSegmentsToMove") int maxSegmentsToMove, @JsonProperty("replicantLifetime") int replicantLifetime, @JsonProperty("replicationThrottleLimit") int replicationThrottleLimit, <START> @JsonProperty("balancerComputeThreads") int balancerComputeThreads, <END> @JsonProperty("emitBalancingStats") boolean emitBalancingStats ) { this.maxSegmentsToMove = maxSegmentsToMove; this.millisToWaitBeforeDeleting = millisToWaitBeforeDeleting; this.mergeSegmentsLimit = mergeSegmentsLimit; this.mergeBytesLimit = mergeBytesLimit; this.replicantLifetime = replicantLifetime; this.replicationThrottleLimit = replicationThrottleLimit; this.emitBalancingStats = emitBalancingStats; this.balancerComputeThreads = balancerComputeThreads; }</code><technical_language>I this a parameter set dynamically. I a JVM argument for coordinator</technical_language>

Target:
public CoordinatorDynamicConfig( @JsonProperty("millisToWaitBeforeDeleting") long millisToWaitBeforeDeleting, @JsonProperty("mergeBytesLimit") long mergeBytesLimit, @JsonProperty("mergeSegmentsLimit") int mergeSegmentsLimit, @JsonProperty("maxSegmentsToMove") int maxSegmentsToMove, @JsonProperty("replicantLifetime") int replicantLifetime, @JsonProperty("replicationThrottleLimit") int replicationThrottleLimit, @JsonProperty("balancerComputeThreads") int balancerComputeThreads, @JsonProperty("emitBalancingStats") boolean emitBalancingStats ) { this.maxSegmentsToMove = maxSegmentsToMove; this.millisToWaitBeforeDeleting = millisToWaitBeforeDeleting; this.mergeSegmentsLimit = mergeSegmentsLimit; this.mergeBytesLimit = mergeBytesLimit; this.replicantLifetime = replicantLifetime; this.replicationThrottleLimit = replicationThrottleLimit; this.emitBalancingStats = emitBalancingStats; this.balancerComputeThreads = Math.min(balancerComputeThreads, Runtime.getRuntime().availableProcessors() - 1); }
Source:
<code>private OptimizationOrchestrator(final Optimizer optimizer, final PlanExecutor planExecutor, final UserJobInfo userJobInfo) { this.optimizer = optimizer; this.planExecutor = planExecutor; this.stageInfoList = userJobInfo.getStageInfoList(); this.iterationIdToMetrics = new ConcurrentHashMap<>(); <START> this.optimizationThreadPool = Executors.newFixedThreadPool(2); <END> }</code><technical_language>out of curiosity, is a benefit of multiple threads? optimization is done another thread is (L144)</technical_language>

Target:
private OptimizationOrchestrator(final Optimizer optimizer, final PlanExecutor planExecutor, final UserJobInfo userJobInfo) { this.optimizer = optimizer; this.planExecutor = planExecutor; this.stageInfoList = userJobInfo.getStageInfoList(); this.iterationIdToMetrics = new ConcurrentHashMap<>(); this.optimizationThreadPool = Executors.newSingleThreadExecutor(); }
Source:
<code>private static Run setCommonRunValues(NotificationDto from, Run to) { to.setName(from.getRunName()); to.setFilePath(from.getSequencerFolderPath().toString()); to.setHealth(from.getHealthType()); <START> to.setStartDate(Date.from(from.getStartDate().atStartOfDay(ZoneId.systemDefault()).toInstant())); <END> to.setCompletionDate(Date.from(from.getCompletionDate().atStartOfDay(ZoneId.systemDefault()).toInstant())); return to; }</code><technical_language>good add a LimsUtils method if mixing date types is more common</technical_language>

Target:
private static Run setCommonRunValues(NotificationDto from, Run to) { to.setName(from.getRunName()); to.setFilePath(from.getSequencerFolderPath().toString()); to.setHealth(from.getHealthType()); to.setStartDate(LimsUtils.toBadDate(from.getStartDate())); to.setCompletionDate(LimsUtils.toBadDate(from.getCompletionDate())); return to; }
Source:
<code>public void testSTExteriorRing() throws Exception { assertQuery("select ST_AsText(ST_ExteriorRing(ST_GeometryFromText('POLYGON ((1 1, 1 4, 4 1))')))", "select 'LINESTRING (1 1, 4 1, 1 4, 1 1)'"); assertQuery("select ST_AsText(ST_ExteriorRing(ST_GeometryFromText('POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))')))", "select 'LINESTRING (0 0, 5 0, 5 5, 0 5, 0 0)'"); assertQueryFails("select ST_AsText(ST_ExteriorRing(ST_GeometryFromText('LineString(1 1, 2 2, 1 3)')))", "ST_ExteriorRing only applies to Polygon. Input type is: LineString"); <START> assertQueryFails("select ST_AsText(ST_ExteriorRing(ST_GeometryFromText('POLYGON EMPTY')))", "ST_ExteriorRing only applies to Polygon. Input type is: MultiPolygon"); <END> }</code><technical_language>spec, ST_ExteriorRing of empty polygon return null</technical_language>

Target:
public void testSTExteriorRing() throws Exception { assertFunction("ST_AsText(ST_ExteriorRing(ST_GeometryFromText('POLYGON EMPTY')))", VARCHAR, null); assertFunction("ST_AsText(ST_ExteriorRing(ST_GeometryFromText('POLYGON ((1 1, 1 4, 4 1))')))", VARCHAR, "LINESTRING (1 1, 4 1, 1 4, 1 1)"); assertFunction("ST_AsText(ST_ExteriorRing(ST_GeometryFromText('POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))')))", VARCHAR, "LINESTRING (0 0, 5 0, 5 5, 0 5, 0 0)"); assertInvalidFunction("ST_AsText(ST_ExteriorRing(ST_GeometryFromText('LINESTRING (1 1, 2 2, 1 3)')))", "ST_ExteriorRing only applies to POLYGON or MULTI_POLYGON. Input type is: LINE_STRING"); }
Source:
<code><START> public void testsHeaderAvailable() throws IOException { <END> MatcherAssert.assertThat( new RsWithHeader( new RsWithBody("<html>Hello</html>"), "content-encoding: gzip" ), new HmRsHeader(Matchers.hasEntry("content-encoding", "gzip")) ); }</code><technical_language>@ekondrashev here, declare Exception thrown</technical_language>

Target:
public void testsHeaderAvailable() throws Exception { MatcherAssert.assertThat( new RsWithHeader( new RsWithBody("<html>Hello</html>"), "content-encoding: gzip" ), new HmRsHeader(Matchers.hasEntry("content-encoding", "gzip")) ); }