auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static ErrorMessageFactory shouldBeEqualByComparingFieldByFieldRecursive(Object actual, Object other, List<Difference> differences) { List<String> descriptionOfDifferences = new ArrayList<>(differences.size()); for (Difference difference : differences) { descriptionOfDifferences.add(format("%nPath to difference: <%s>%nexpected: <%s>%nbut was: <%s>", join(difference.getPath(), "."), difference.getOther(), difference.getActual())); } return new ShouldBeEqualByComparingFieldByFieldRecursive("Expecting: <%s>%nto equal to: <%s>%nwhen recursively comparing field by field, but found the following difference(s):%n" + join(descriptionOfDifferences, format("%n")), actual, other); }

Target:
public static ErrorMessageFactory shouldBeEqualByComparingFieldByFieldRecursive(Object actual, Object other, List<Difference> differences) { List<String> descriptionOfDifferences = new ArrayList<>(differences.size()); for (Difference difference : differences) { descriptionOfDifferences.add(format("%nPath to difference: <%s>%nexpected: <%s>%nbut was: <%s>", join(difference.getPath()).with("."), difference.getOther(), difference.getActual())); } return new ShouldBeEqualByComparingFieldByFieldRecursive("Expecting: <%s>%nto be equal to: <%s>%nwhen recursively comparing field by field, but found the following difference(s):%n" + join(descriptionOfDifferences).with(format("%n")), actual, other); }
Source:
protected void deactivateGLEntries(GeneralLedgerEntry entry, Document document, Integer capitalAssetLineNumber) { CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(entry.getDocumentNumber(), capitalAssetLineNumber); if (ObjectUtils.isNotNull(capitalAssetInformation)) { List<CapitalAssetAccountsGroupDetails> groupAccountingLines = capitalAssetInformation.getCapitalAssetAccountsGroupDetails(); Collection<GeneralLedgerEntry> documentGlEntries = findAllGeneralLedgerEntry(entry.getDocumentNumber()); if (LOG.isDebugEnabled()) { LOG.debug("deactivateGLEntries, entry.getDocumentNumber(): " + entry.getDocumentNumber() + " documentGlEntries.size(): " + documentGlEntries.size()); } for (CapitalAssetAccountsGroupDetails accountingLine : groupAccountingLines) { Collection<GeneralLedgerEntry> glEntries = findMatchingGeneralLedgerEntries(documentGlEntries, accountingLine); if (LOG.isDebugEnabled()) { LOG.debug("deactivateGLEntries, accountingLine: " + accountingLine + " glEntries.size(): " + glEntries.size()); } for (GeneralLedgerEntry glEntry : glEntries) { KualiDecimal lineAmount = accountingLine.getAmount(); createGeneralLedgerEntryAsset(glEntry, document, capitalAssetLineNumber); updateTransactionSumbitGlEntryAmount(glEntry, lineAmount); } } } }

Target:
protected void deactivateGLEntries(GeneralLedgerEntry entry, Document document, Integer capitalAssetLineNumber) { CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(entry.getDocumentNumber(), capitalAssetLineNumber); if (ObjectUtils.isNotNull(capitalAssetInformation)) { List<CapitalAssetAccountsGroupDetails> groupAccountingLines = capitalAssetInformation.getCapitalAssetAccountsGroupDetails(); Collection<GeneralLedgerEntry> documentGlEntries = findAllGeneralLedgerEntry(entry.getDocumentNumber()); for (CapitalAssetAccountsGroupDetails accountingLine : groupAccountingLines) { Collection<GeneralLedgerEntry> glEntries = findMatchingGeneralLedgerEntries(documentGlEntries, accountingLine); for (GeneralLedgerEntry glEntry : glEntries) { KualiDecimal lineAmount = accountingLine.getAmount(); createGeneralLedgerEntryAsset(glEntry, document, capitalAssetLineNumber); updateTransactionSumbitGlEntryAmount(glEntry, lineAmount); } } } }
Source:
public Serializable execute(TaskResult... results) throws IOException { File file = new File(outputPath); containerURL = AzureStorageConnectorUtils.createContainerURL(accountName, accountKey, containerName); if (blobName != null && !blobName.isEmpty()) { if ((outputPath.lastIndexOf('/') == outputPath.length() - 1)) { createDirIfNotExists(file); String azureBlobLocalRelativePath = Paths.get(outputPath, Paths.get(blobName).getFileName().toString()) .toString(); downloadBlob(new File(azureBlobLocalRelativePath), blobName); } else { downloadBlob(file, blobName); } } else { createDirIfNotExists(file); downloadContainerBlobs(containerURL); } return (Serializable) Arrays.asList(outputPath); }

Target:
public Serializable execute(TaskResult... results) throws IOException { File file = new File(outputPath); containerURL = AzureStorageConnectorUtils.createContainerURL(storageAccount, accountKey, containerName); if (optionalBlobName.isPresent()) { if (outputPath.lastIndexOf('/') == outputPath.length() - 1) { createDirIfNotExists(file); String azureBlobLocalRelativePath = Paths.get(outputPath, Paths.get(optionalBlobName.get()) .getFileName() .toString()) .toString(); downloadBlob(new File(azureBlobLocalRelativePath), optionalBlobName.get()); } else { downloadBlob(file, optionalBlobName.get()); } } else { createDirIfNotExists(file); downloadContainerBlobs(containerURL); } return (Serializable) Arrays.asList(outputPath); }
Source:
public static List<Interval> breakIntervalsAtBandMultiples(final List<Interval> intervals, final int bandMultiple) { final List<Interval> brokenUpIntervals = new ArrayList<Interval>(); for (final Interval i : intervals) { final int startIndex = i.getStart() / bandMultiple; final int endIndex = i.getEnd() / bandMultiple; if (startIndex == endIndex) { brokenUpIntervals.add(i); } else { brokenUpIntervals.addAll(breakIntervalAtBandMultiples(i, bandMultiple)); } } return brokenUpIntervals; }

Target:
public static List<Interval> breakIntervalsAtBandMultiples(final List<Interval> intervals, final int bandMultiple) { final List<Interval> brokenUpIntervals = new ArrayList<Interval>(); for (final Interval interval : intervals) { if (interval.getEnd() >= interval.getStart()) { final int startIndex = interval.getStart() / bandMultiple; final int endIndex = interval.getEnd() / bandMultiple; if (startIndex == endIndex) { brokenUpIntervals.add(interval); } else { brokenUpIntervals.addAll(breakIntervalAtBandMultiples(interval, bandMultiple)); } } else { brokenUpIntervals.add(interval); } } return brokenUpIntervals; }
Source:
public void build() { List<String> args = new ArrayList<String>(); if (this.configName != null) { args.add("--spring.config.name=" + this.configName); } if (this.input != null) { args.add("--spring.cloud.stream.bindings.input=" + this.input); } if (this.output != null) { args.add("--spring.cloud.stream.binding.output=" + this.output); } this.builder.run(args.toArray(new String[0])); }

Target:
public void build() { List<String> args = new ArrayList<String>(); if (this.configName != null) { args.add("--spring.config.name=" + this.configName); } if (this.input != null) { args.add("--spring.cloud.stream.bindings.input=" + this.input); } if (this.output != null) { args.add("--spring.cloud.stream.bindings.output=" + this.output); } this.builder.run(args.toArray(new String[0])); }
Source:
private void destroyLookedUpResource(final Context globalContext, final String id, final String name) throws NamingException { final String ctx = name.substring(0, name.lastIndexOf("/")); final String objName = name.substring(ctx.length() + 1); final NamingEnumeration<Binding> bindings = globalContext.listBindings(ctx); while (bindings.hasMoreElements()) { final Binding binding = bindings.nextElement(); if (!binding.getName().equals(objName)) { continue; } if (DestroyableResource.class.isInstance(binding.getObject())) { final DestroyableResource destroyableResource = DestroyableResource.class.cast(binding.getObject()); destroyableResource.destroyResource(); globalContext.unbind(name); return; } if (!LazyObjectReference.class.isInstance(binding.getObject())) { continue; } final LazyObjectReference<?> ref = LazyObjectReference.class.cast(binding.getObject()); if (!ref.isInitialized()) { globalContext.unbind(name); removeResourceInfo(id); return; } } final Object object = globalContext.lookup(name); final String clazz; if (object == null) { clazz = "?"; } else { clazz = object.getClass().getName(); } destroyResource(id, clazz, object); globalContext.unbind(name); }

Target:
private void destroyLookedUpResource(final Context globalContext, final String id, final String name) throws NamingException { final Object object; try { object = globalContext.lookup(name); } catch (final NamingException e) { final String ctx = name.substring(0, name.lastIndexOf("/")); final String objName = name.substring(ctx.length() + 1); final NamingEnumeration<Binding> bindings = globalContext.listBindings(ctx); while (bindings.hasMoreElements()) { final Binding binding = bindings.nextElement(); if (!binding.getName().equals(objName)) { continue; } if (!LazyObjectReference.class.isInstance(binding.getObject())) { continue; } final LazyObjectReference<?> ref = LazyObjectReference.class.cast(binding.getObject()); if (! ref.isInitialized()) { globalContext.unbind(name); removeResourceInfo(name); return; } } throw e; } final String clazz; if (object == null) { clazz = "?"; } else { clazz = object.getClass().getName(); } destroyResource(id, clazz, object); globalContext.unbind(name); }
Source:
private boolean checkAppElementByBundleSymbolicNameAndClass(String bundleSymbolicName, String className) { Collection<BundleWiring> wirings = findWirings(bundleSymbolicName, bundleContext); if (!isBundleClassAvailable(wirings, className)) { return false; } return true; }

Target:
private boolean checkAppElementByBundleSymbolicNameAndClass(String bundleSymbolicName, String className) { Collection<BundleWiring> wirings = findWirings(bundleSymbolicName, bundleContext); return isBundleClassAvailable(wirings, className); }
Source:
public boolean add(Flow flow, ManagedWildcardFlow wildFlow) { org.midonet.odp.FlowMatch match = flow.getMatch(); if (log.isDebugEnabled() && dpFlowTable.containsKey(match)) { log.debug("Tried to add a duplicate DP flow"); } wildFlow.dpFlows().add(match); dpFlowTable.put(match, wildFlow); log.debug("Added flow with match that matches wildcard flow {}", flow.getMatch(), wildFlow.getMatch()); if (wildFlow.getIdleExpirationMillis() > 0) { if (null == flow.getLastUsedTime()) wildFlow.setLastUsedTimeMillis(System.currentTimeMillis()); else if (flow.getLastUsedTime() > wildFlow.getLastUsedTimeMillis()) wildFlow.setLastUsedTimeMillis(flow.getLastUsedTime()); } return true; }

Target:
public boolean add(Flow flow, ManagedWildcardFlow wildFlow) { FlowMatch match = flow.getMatch(); if (log.isDebugEnabled() && dpFlowTable.containsKey(match)) { log.debug("Tried to add a duplicate DP flow"); } wildFlow.dpFlows().add(match); dpFlowTable.put(match, wildFlow); log.debug("Added flow with match that matches wildcard flow {}", flow.getMatch(), wildFlow.getMatch()); if (wildFlow.getIdleExpirationMillis() > 0) { if (null == flow.getLastUsedTime()) wildFlow.setLastUsedTimeMillis(System.currentTimeMillis()); else if (flow.getLastUsedTime() > wildFlow.getLastUsedTimeMillis()) wildFlow.setLastUsedTimeMillis(flow.getLastUsedTime()); } return true; }
Source:
public Optional<Handler> buildHandler(Class<?> sqlObjectType, Method method) { if (!WITH_HANDLE.equals(method)) { return Optional.empty(); } return Optional.of((t, a, h) -> h.invokeInContext( new ExtensionMethod(sqlObjectType, method), h.getConfig(), () -> ((HandleCallback<?, RuntimeException>) a[0]).withHandle(h.getHandle()))); }

Target:
public Optional<Handler> buildHandler(Class<?> sqlObjectType, Method method) { if (!WITH_HANDLE.equals(method)) { return Optional.empty(); } ExtensionMethod extensionMethod = new ExtensionMethod(sqlObjectType, method); return Optional.of((t, a, h) -> h.invokeInContext( extensionMethod, h.getConfig(), () -> ((HandleCallback<?, RuntimeException>) a[0]).withHandle(h.getHandle()))); }
Source:
public void testTransformNullMetacard() throws CatalogTransformerException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); assertThat("Transformer cannot be null", transformer, notNullValue()); Metacard nullCard = null; transformer.transform(nullCard, new HashMap<>()); }

Target:
public void testTransformNullMetacard() throws CatalogTransformerException, MimeTypeParseException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); Metacard nullCard = null; transformer.transform(nullCard, Collections.emptyMap()); }
Source:
public void testDecodingSingleCookieV0() { String cookieString = "myCookie=myValue;expires=" + DateFormatter.format(new Date(System.currentTimeMillis() + 50000)) + ";path=/apathsomewhere;domain=.adomainsomewhere;secure;SameSite=None"; Cookie cookie = ClientCookieDecoder.STRICT.decode(cookieString); assertNotNull(cookie); assertEquals("myValue", cookie.value()); assertEquals(".adomainsomewhere", cookie.domain()); assertNotEquals("maxAge should be defined when parsing cookie " + cookieString, Long.MIN_VALUE, cookie.maxAge()); assertTrue("maxAge should be about 50ms when parsing cookie " + cookieString, cookie.maxAge() >= 40 && cookie.maxAge() <= 60); assertEquals("/apathsomewhere", cookie.path()); assertTrue(cookie.isSecure()); assertThat(cookie, is(instanceOf(DefaultCookie.class))); assertEquals("None", ((DefaultCookie) cookie).sameSite()); }

Target:
public void testDecodingSingleCookieV0() { String cookieString = "myCookie=myValue;expires=" + DateFormatter.format(new Date(System.currentTimeMillis() + 50000)) + ";path=/apathsomewhere;domain=.adomainsomewhere;secure;SameSite=None"; Cookie cookie = ClientCookieDecoder.STRICT.decode(cookieString); assertNotNull(cookie); assertEquals("myValue", cookie.value()); assertEquals(".adomainsomewhere", cookie.domain()); assertNotEquals("maxAge should be defined when parsing cookie " + cookieString, Long.MIN_VALUE, cookie.maxAge()); assertTrue("maxAge should be about 50ms when parsing cookie " + cookieString, cookie.maxAge() >= 40 && cookie.maxAge() <= 60); assertEquals("/apathsomewhere", cookie.path()); assertTrue(cookie.isSecure()); assertThat(cookie, is(instanceOf(DefaultCookie.class))); assertEquals(SameSite.None, ((DefaultCookie) cookie).sameSite()); }
Source:
public int compare(final Account account1, final Account account2) { if (account1.getPreferredEmail() != null && !account1.getPreferredEmail().isEmpty() && account2.getPreferredEmail() != null && !account2.getPreferredEmail().isEmpty()) { return account1.getPreferredEmail().compareTo( account2.getPreferredEmail()); } if (account1.getFullName() != null && !account1.getFullName().isEmpty() && account2.getFullName() != null && !account2.getFullName().isEmpty()) { return account1.getFullName().compareTo(account2.getFullName()); } return Integer.valueOf(account1.getId().get()).compareTo( Integer.valueOf(account2.getId().get())); }

Target:
public int compare(final Account account1, final Account account2) { if (isSet(account1.getPreferredEmail()) && isSet(account2.getPreferredEmail())) { return account1.getPreferredEmail().compareTo( account2.getPreferredEmail()); } if (isSet(account1.getFullName()) && isSet(account2.getFullName())) { return account1.getFullName().compareTo(account2.getFullName()); } return Integer.valueOf(account1.getId().get()).compareTo( Integer.valueOf(account2.getId().get())); }
Source:
public boolean hasIndicatedSections(String courseId) throws EntityDoesNotExistException{ List<StudentAttributes> studentList = getStudentsForCourse(courseId); for(StudentAttributes student : studentList) { if(!student.section.equals("None")){ return true; } } return false; }

Target:
public boolean hasIndicatedSections(String courseId) throws EntityDoesNotExistException{ coursesLogic.verifyCourseIsPresent(courseId); List<StudentAttributes> studentList = getStudentsForCourse(courseId); for(StudentAttributes student : studentList) { if(!student.section.equals(Const.DEFAULT_SECTION)){ return true; } } return false; }
Source:
protected String getConfigurationFileName() { return "configWithSessionVariables.ini"; }

Target:
private String getConfigurationFileName() { return "configWithSessionVariables.ini"; }
Source:
public int removeTaskFromDbByTaskId(final Guid taskId) throws RuntimeException { return TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Integer>() { @Override public Integer runInTransaction() { AsyncTasks asyncTask = DbFacade.getInstance().getAsyncTaskDao().get(taskId); int retVal = DbFacade.getInstance().getAsyncTaskDao().remove(taskId); if (asyncTask != null && !Guid.isNullOrEmpty(asyncTask.getCommandId())) { CommandEntity cmdEntity = coco.getCommandEntity(asyncTask.getCommandId()); if (cmdEntity != null && !cmdEntity.isCallBackEnabled()) { coco.removeCommand(asyncTask.getCommandId()); if (!Guid.isNullOrEmpty(asyncTask.getRootCommandId()) && !coco.hasCommandEntitiesWithRootCommandId(asyncTask.getRootCommandId())) { coco.removeCommand(asyncTask.getRootCommandId()); } } } return retVal; } }); }

Target:
public int removeTaskFromDbByTaskId(final Guid taskId) throws RuntimeException { return TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Integer>() { @Override public Integer runInTransaction() { AsyncTask asyncTask = DbFacade.getInstance().getAsyncTaskDao().get(taskId); int retVal = DbFacade.getInstance().getAsyncTaskDao().remove(taskId); if (asyncTask != null && !Guid.isNullOrEmpty(asyncTask.getCommandId())) { CommandEntity cmdEntity = coco.getCommandEntity(asyncTask.getCommandId()); if (cmdEntity != null && !cmdEntity.isCallBackEnabled()) { coco.removeCommand(asyncTask.getCommandId()); if (!Guid.isNullOrEmpty(asyncTask.getRootCommandId()) && !coco.hasCommandEntitiesWithRootCommandId(asyncTask.getRootCommandId())) { coco.removeCommand(asyncTask.getRootCommandId()); } } } return retVal; } }); }
Source:
private String pushImages() throws IOException { final StringBuilder resultBuilder = new StringBuilder(); for (String tagToUse : tagsToUse) { if (!tagToUse.toLowerCase().equals(tagToUse)) { listener.getLogger().println("ERROR: Docker will refuse to push tag name " + tagToUse + " because it uses upper case."); } Identifier identifier = Identifier.fromCompoundString(tagToUse); PushImageResultCallback resultCallback = new PushImageResultCallback() { public void onNext(PushResponseItem item) { resultBuilder.append(item.toString()); super.onNext(item); } }; getClient().pushImageCmd(identifier).exec(resultCallback).awaitSuccess(); } return resultBuilder.toString(); }

Target:
private void pushImages() throws IOException { for (String tagToUse : tagsToUse) { if (!tagToUse.toLowerCase().equals(tagToUse)) { listener.getLogger().println("ERROR: Docker will refuse to push tag name " + tagToUse + " because it uses upper case."); } Identifier identifier = Identifier.fromCompoundString(tagToUse); PushImageResultCallback resultCallback = new PushImageResultCallback() { public void onNext(PushResponseItem item) { listener.getLogger().println(item.toString()); super.onNext(item); } }; getClient().pushImageCmd(identifier).exec(resultCallback).awaitSuccess(); } }
Source:
private static Map<TableReference, SweepStrategy> getSweepStrategiesForWarmingCache( KeyValueService kvs, CacheWarming cacheWarming) { switch (cacheWarming) { case FULL: return Maps.transformValues(kvs.getMetadataForTables(), SweepStrategyManagers::getSweepStrategy); case LIMITED: return Maps.transformValues( kvs.getLimitedMetadataForTables(50), SweepStrategyManagers::getSweepStrategy); case NONE: default: return Collections.emptyMap(); } }

Target:
private static Map<TableReference, SweepStrategy> getSweepStrategiesForWarmingCache( KeyValueService kvs, CacheWarming cacheWarming) { switch (cacheWarming) { case FULL: return Maps.transformValues(kvs.getMetadataForTables(), SweepStrategyManagers::getSweepStrategy); case NONE: default: return Collections.emptyMap(); } }
Source:
public void checkVolumesTab() { String volumeName = "project"; String newVolumeName = "projects"; String volumePath = "/project"; String newVolumePath = "/projects"; workspaceDetails.selectTabInWorkspaceMenu(VOLUMES); workspacesVolumes.clickOnAddVolumeButton(); workspacesVolumes.enterVolumeName(volumeName); workspacesVolumes.enterVolumePath(volumePath); workspaceDetails.clickOnAddButtonInDialogWindow(); workspacesVolumes.checkVolumeExists(volumeName, volumePath); clickOnSaveButton(); workspacesVolumes.clickOnEditVolumeButton(volumeName); workspacesVolumes.enterVolumeName(newVolumeName); workspacesVolumes.enterVolumePath(newVolumePath); workspaceDetails.clickOnUpdateButtonInDialogWindow(); workspacesVolumes.checkVolumeExists(newVolumeName, newVolumePath); clickOnSaveButton(); workspacesVolumes.clickOnRemoveVolumeButton(newVolumeName); workspaceDetails.clickOnDeleteButtonInDialogWindow(); workspacesVolumes.waitVolumeNotExists(newVolumeName); clickOnSaveButton(); }

Target:
public void checkVolumesTab() { String volumeName = "prj"; String volumePath = "/" + volumeName; String renamedVolumeName = "project"; String renamedVolumePath = "/" + renamedVolumeName; workspaceDetails.selectTabInWorkspaceMenu(VOLUMES); workspacesVolumes.clickOnAddVolumeButton(); workspacesVolumes.enterVolumeName(volumeName); workspacesVolumes.enterVolumePath(volumePath); workspaceDetails.clickOnAddButtonInDialogWindow(); assertTrue(workspacesVolumes.checkVolumeExists(volumeName, volumePath)); clickOnSaveButton(); workspacesVolumes.clickOnEditVolumeButton(volumeName); workspacesVolumes.enterVolumeName(renamedVolumeName); workspacesVolumes.enterVolumePath(renamedVolumePath); workspaceDetails.clickOnUpdateButtonInDialogWindow(); assertTrue(workspacesVolumes.checkVolumeExists(renamedVolumeName, renamedVolumePath)); clickOnSaveButton(); workspacesVolumes.clickOnRemoveVolumeButton(renamedVolumeName); workspaceDetails.clickOnDeleteButtonInDialogWindow(); workspacesVolumes.waitVolumeNotExists(renamedVolumeName); clickOnSaveButton(); }
Source:
public static void copy(String message, File source, File target) { if (!source.exists()) return; target.getParentFile().mkdirs(); if (source.isDirectory()) { if (target.exists() && target.isFile()) target.delete(); if (!target.exists()) target.mkdirs(); File[] children = source.listFiles(); for (File children1 : children) { copy(message, children1, new File(target, children1.getName())); } return; } try (InputStream input = new BufferedInputStream(new FileInputStream(source)); OutputStream output = new BufferedOutputStream(new FileOutputStream(target))) { byte[] buffer = new byte[8192]; int bytesRead = 0; while ((bytesRead = input.read(buffer)) != -1) output.write(buffer, 0, bytesRead); } catch (IOException e) { fail(message + ": " + e); } }

Target:
public static void copy(String message, File source, File target) { if (!source.exists()) return; target.getParentFile().mkdirs(); if (source.isDirectory()) { if (target.exists() && target.isFile()) target.delete(); if (!target.exists()) target.mkdirs(); File[] children = source.listFiles(); for (File child : children) { copy(message, child, new File(target, child.getName())); } return; } try (InputStream input = new BufferedInputStream(new FileInputStream(source)); OutputStream output = new BufferedOutputStream(new FileOutputStream(target))) { byte[] buffer = new byte[8192]; int bytesRead = 0; while ((bytesRead = input.read(buffer)) != -1) output.write(buffer, 0, bytesRead); } catch (IOException e) { fail(message + ": " + e); } }
Source:
public String format(String json) { String result = null; if (json != null){ Gson gson = new GsonBuilder().setPrettyPrinting().create(); JsonParser jsonParser = new JsonParser(); if (json.startsWith("{")) { return gson.toJson(jsonParser.parse(json).getAsJsonObject()); } else if (json.startsWith("[")) { result = gson.toJson(jsonParser.parse(json).getAsJsonArray()); } } return result; }

Target:
public String format(String json) { String result = null; if (json != null){ Gson gson = new GsonBuilder().setPrettyPrinting().create(); JsonParser jsonParser = new JsonParser(); if (json.startsWith("{")) { result = gson.toJson(jsonParser.parse(json).getAsJsonObject()); } else if (json.startsWith("[")) { result = gson.toJson(jsonParser.parse(json).getAsJsonArray()); } } return result; }
Source:
public int writeTruncatedObject(ByteBuffer output) throws IOException { output.position(PBDSegment.ENTRY_HEADER_BYTES); int bytesWritten = PBDUtils.writeDeferredSerialization(output, m_ds); m_crc32.update(bytesWritten); m_crc32.update(PBDSegment.NO_FLAGS); output.position(PBDSegment.ENTRY_HEADER_BYTES); m_crc32.update(output); output.putLong(PBDSegment.ENTRY_HEADER_CRC_OFFSET, m_crc32.getValue()); output.putInt(PBDSegment.ENTRY_HEADER_TOTAL_BYTES_OFFSET, bytesWritten); output.putInt(PBDSegment.ENTRY_HEADER_FLAG_OFFSET, PBDSegment.NO_FLAGS); if (m_truncationCallback != null) { m_truncationCallback.bytesWritten(bytesWritten); } return bytesWritten; }

Target:
public int writeTruncatedObject(ByteBuffer output) throws IOException { output.position(PBDSegment.ENTRY_HEADER_BYTES); int bytesWritten = MiscUtils.writeDeferredSerialization(output, m_ds); output.position(PBDSegment.ENTRY_HEADER_BYTES); ByteBuffer header = output.duplicate(); header.position(PBDSegment.ENTRY_HEADER_CRC_OFFSET); PBDUtils.writeEntryHeader(m_crc32, header, output, bytesWritten, PBDSegment.NO_FLAGS); if (m_truncationCallback != null) { m_truncationCallback.bytesWritten(bytesWritten); } return bytesWritten; }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.REPR_EXPRESSION, ctx -> { PyReprExpression node = (PyReprExpression) ctx.syntaxNode(); ctx.addIssue(node.getNode().getPsi(), "Use \"repr\" instead."); }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.REPR_EXPRESSION, ctx -> ctx.addIssue(ctx.syntaxNode(), "Use \"repr\" instead.")); }
Source:
public Result listSubscriptions(@Nullable final String owningApplication, @Nullable final Set<String> eventTypes, final boolean showStatus, final int limit, final int offset) { if (limit < 1 || limit > 1000) { final Problem problem = Problem.valueOf(Response.Status.BAD_REQUEST, "'limit' parameter should have value from 1 to 1000"); return Result.problem(problem); } if (offset < 0) { final Problem problem = Problem.valueOf(Response.Status.BAD_REQUEST, "'offset' parameter can't be lower than 0"); return Result.problem(problem); } try { final Set<String> eventTypesFilter = eventTypes == null ? ImmutableSet.of() : eventTypes; final Optional<String> owningAppOption = Optional.ofNullable(owningApplication); final List<Subscription> subscriptions = subscriptionRepository.listSubscriptions(eventTypesFilter, owningAppOption, offset, limit); final PaginationLinks paginationLinks = SubscriptionsUriHelper.createSubscriptionPaginationLinks( owningAppOption, eventTypesFilter, offset, limit, subscriptions.size()); final PaginationWrapper<Subscription> paginationWrapper = new PaginationWrapper<>(subscriptions, paginationLinks); if (showStatus) { final List<Subscription> items = paginationWrapper.getItems(); items.forEach(s -> s.setStats(createSubscriptionStat(s, false))); } return Result.ok(paginationWrapper); } catch (final ServiceTemporarilyUnavailableException e) { LOG.error("Error occurred during listing of subscriptions", e); return Result.problem(Problem.valueOf(Response.Status.SERVICE_UNAVAILABLE, e.getMessage())); } }

Target:
public Result listSubscriptions(@Nullable final String owningApplication, @Nullable final Set<String> eventTypes, final boolean showStatus, final int limit, final int offset) { if (limit < 1 || limit > 1000) { final Problem problem = Problem.valueOf(Response.Status.BAD_REQUEST, "'limit' parameter should have value from 1 to 1000"); return Result.problem(problem); } if (offset < 0) { final Problem problem = Problem.valueOf(Response.Status.BAD_REQUEST, "'offset' parameter can't be lower than 0"); return Result.problem(problem); } try { final Set<String> eventTypesFilter = eventTypes == null ? ImmutableSet.of() : eventTypes; final Optional<String> owningAppOption = Optional.ofNullable(owningApplication); final List<Subscription> subscriptions = subscriptionRepository.listSubscriptions(eventTypesFilter, owningAppOption, offset, limit); final PaginationLinks paginationLinks = SubscriptionsUriHelper.createSubscriptionPaginationLinks( owningAppOption, eventTypesFilter, offset, limit, showStatus, subscriptions.size()); final PaginationWrapper<Subscription> paginationWrapper = new PaginationWrapper<>(subscriptions, paginationLinks); if (showStatus) { final List<Subscription> items = paginationWrapper.getItems(); items.forEach(s -> s.setStatus(createSubscriptionStat(s, false))); } return Result.ok(paginationWrapper); } catch (final ServiceTemporarilyUnavailableException e) { LOG.error("Error occurred during listing of subscriptions", e); return Result.problem(Problem.valueOf(Response.Status.SERVICE_UNAVAILABLE, e.getMessage())); } }
Source:
private void fillContextMenu(IMenuManager manager) { manager.add(openAction); IPluginModelBase selectedPluginModel = getSelectedPluginModel(); if (selectedPluginModel != null) { Action dependenciesAction = new OpenPluginDependenciesAction(selectedPluginModel); manager.add(dependenciesAction); dependenciesAction.setText(PDEUIMessages.PluginsView_openDependencies); dependenciesAction.setImageDescriptor(PDEPluginImages.DESC_CALLEES); } manager.add(new Separator()); manager.add(copyAction); }

Target:
private void fillContextMenu(IMenuManager manager) { manager.add(fOpenAction); IPluginModelBase selectedPluginModel = getSelectedPluginModel(); if (selectedPluginModel != null) { Action dependenciesAction = new OpenPluginDependenciesAction(selectedPluginModel); manager.add(dependenciesAction); } manager.add(new Separator()); manager.add(fCopyAction); }
Source:
private static TmfCommonXAxisModel extractModelFromChart(Chart chart) { ILineSeries readSeries = (ILineSeries) chart.getSeriesSet().getSeries(READ_SERIES_NAME); ILineSeries writeSeries = (ILineSeries) chart.getSeriesSet().getSeries(WRITE_SERIES_NAME); assertNotNull(readSeries); assertNotNull(writeSeries); double[] xRead = readSeries.getXSeries(); double[] yRead = readSeries.getYSeries(); double[] xWrite = writeSeries.getXSeries(); double[] yWrite = writeSeries.getYSeries(); assertTrue(Arrays.equals(xRead, xWrite)); @NonNull Map<@NonNull String, @NonNull IYModel> yModels = new LinkedHashMap<>(); yModels.put(READ_SERIES_NAME, new YModel(READ_SERIES_NAME, yRead)); yModels.put(WRITE_SERIES_NAME, new YModel(WRITE_SERIES_NAME, yWrite)); long[] x = Longs.toArray(Doubles.asList(xRead)); assertNotNull(x); return new TmfCommonXAxisModel(TITLE, x, yModels); }

Target:
private static TmfCommonXAxisModel extractModelFromChart(Chart chart) { ILineSeries readSeries = (ILineSeries) chart.getSeriesSet().getSeries(READ_SERIES_NAME); ILineSeries writeSeries = (ILineSeries) chart.getSeriesSet().getSeries(WRITE_SERIES_NAME); assertNotNull(readSeries); assertNotNull(writeSeries); double[] xRead = readSeries.getXSeries(); double[] yRead = readSeries.getYSeries(); double[] xWrite = writeSeries.getXSeries(); double[] yWrite = writeSeries.getYSeries(); assertTrue("Series should have the same x axis values", Arrays.equals(xRead, xWrite)); @NonNull Map<@NonNull String, @NonNull IYModel> yModels = new LinkedHashMap<>(); yModels.put(READ_SERIES_NAME, new YModel(READ_SERIES_NAME, Objects.requireNonNull(yRead))); yModels.put(WRITE_SERIES_NAME, new YModel(WRITE_SERIES_NAME, Objects.requireNonNull(yWrite))); long[] x = Longs.toArray(Doubles.asList(xRead)); assertNotNull(x); return new TmfCommonXAxisModel(TITLE, x, yModels); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.switch_logs: mSyncthingLog = !mSyncthingLog; if (mSyncthingLog) { item.setTitle(R.string.log_android_title); } else { item.setTitle(R.string.log_syncthing_title); } updateLog(); return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.switch_logs: mSyncthingLog = !mSyncthingLog; item.setTitle(mSyncthingLog ? R.string.log_android_title : R.string.log_syncthing_title); updateLog(); return true; default: return super.onOptionsItemSelected(item); } }
Source:
default Component getHelperComponent() { Optional<Element> element = getElement().getChildren() .filter(child -> "helper".equals(child.getAttribute("slot"))) .findFirst(); if (element.isPresent()) { return element.get().getComponent().orElse(null); } return null; }

Target:
default Component getHelperComponent() { Optional<Component> component = getElement().getChildren() .filter(child -> "helper".equals(child.getAttribute("slot"))) .map(Element::getComponent) .findFirst().orElse(Optional.empty()); return component.orElse(null); }
Source:
public boolean validate() throws IOException, ServletException { String urlParameters = "?api_key=" + apiKey; HttpURLConnection conn = null; boolean status = true; try { conn = getHttpURLConnection(new URL(url + VALIDATE + urlParameters)); conn.setRequestMethod("GET"); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); StringBuilder result = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { result.append(line); } rd.close(); JSONObject json = (JSONObject) JSONSerializer.toJSON(result.toString()); if (!json.getBoolean("valid")) { status = false; } } catch (Exception e) { if (conn != null && conn.getResponseCode() == HTTP_FORBIDDEN) { logger.severe("Hmmm, your API key may be invalid. We received a 403 error."); StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); logger.severe(sw.toString()); } else { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); logger.severe(String.format("Client error: %s", sw.toString())); } status = false; } finally { if (conn != null) { conn.disconnect(); } } return status; }

Target:
public boolean validate() throws IOException, ServletException { String urlParameters = "?api_key=" + apiKey; HttpURLConnection conn = null; boolean status = true; try { conn = getHttpURLConnection(new URL(url + VALIDATE + urlParameters)); conn.setRequestMethod("GET"); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); StringBuilder result = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { result.append(line); } rd.close(); JSONObject json = (JSONObject) JSONSerializer.toJSON(result.toString()); if (!json.getBoolean("valid")) { status = false; } } catch (Exception e) { if (conn != null && conn.getResponseCode() == HTTP_FORBIDDEN) { logger.severe("Hmmm, your API key may be invalid. We received a 403 error."); DatadogUtilities.severe(logger, e, null); } else { DatadogUtilities.severe(logger, e, "Client error: "); } status = false; } finally { if (conn != null) { conn.disconnect(); } } return status; }
Source:
private BlobStoreCompactor getCompactor(Log log, DiskIOScheduler ioScheduler) throws IOException, StoreException { closeOrExceptionInduced = false; if (doDirectIO) { state.properties.put("store.compaction.enable.direct.io", "true"); } if (withUndelete) { state.properties.put("store.compaction.filter", "IndexSegmentValidEntryWithUndelete"); } if (alwaysEnableTargetIndexDuplicateChecking) { state.properties.put(StoreConfig.storeAlwaysEnableTargetIndexDuplicateCheckingName, "true"); } else { state.properties.put(StoreConfig.storeAlwaysEnableTargetIndexDuplicateCheckingName, "false"); } StoreConfig config = new StoreConfig(new VerifiableProperties(state.properties)); metricRegistry = new MetricRegistry(); StoreMetrics metrics = new StoreMetrics(metricRegistry); return new BlobStoreCompactor(tempDirStr, STORE_ID, STORE_KEY_FACTORY, config, metrics, metrics, ioScheduler, StoreTestUtils.DEFAULT_DISK_SPACE_ALLOCATOR, log, state.time, state.sessionId, state.incarnationId, accountService); }

Target:
private BlobStoreCompactor getCompactor(Log log, DiskIOScheduler ioScheduler) throws IOException, StoreException { closeOrExceptionInduced = false; if (doDirectIO) { state.properties.put("store.compaction.enable.direct.io", "true"); } if (withUndelete) { state.properties.put("store.compaction.filter", "IndexSegmentValidEntryWithUndelete"); } state.properties.put(StoreConfig.storeAlwaysEnableTargetIndexDuplicateCheckingName, Boolean.toString(alwaysEnableTargetIndexDuplicateChecking)); StoreConfig config = new StoreConfig(new VerifiableProperties(state.properties)); metricRegistry = new MetricRegistry(); StoreMetrics metrics = new StoreMetrics(metricRegistry); return new BlobStoreCompactor(tempDirStr, STORE_ID, STORE_KEY_FACTORY, config, metrics, metrics, ioScheduler, StoreTestUtils.DEFAULT_DISK_SPACE_ALLOCATOR, log, state.time, state.sessionId, state.incarnationId, accountService); }
Source:
public void onModelFound(Request request) { if (!request.getState().equals(Request.State.PENDING)) finish(); else { onPendingRequest(request); } }

Target:
public void onModelFound(Request request) { if (!request.getState().equals(Request.State.OPEN)) finish(); else { onOpenRequest(request); } }
Source:
public void put(K k, V v, Metadata metadata) { boolean l1Entry = false; if (metadata instanceof L1WriteSynchronizer.L1Metadata) { metadata = ((L1WriteSynchronizer.L1Metadata) metadata).metadata(); l1Entry = true; } InternalCacheEntry<K, V> e = entries.get(k); if (trace) { log.tracef("Creating new ICE for writing. Existing=%s, metadata=%s, new value=%s", e, metadata, v); } if (e != null) { e = entryFactory.update(e, v, metadata); } else { e = entryFactory.create(k, v, metadata); } if (trace) log.tracef("Store %s in container", e); e.setL1Entry(l1Entry); extendedMap.putAndActivate(e); }

Target:
public void put(K k, V v, Metadata metadata) { boolean l1Entry = false; if (metadata instanceof L1Metadata) { metadata = ((L1Metadata) metadata).metadata(); l1Entry = true; } InternalCacheEntry<K, V> e = entries.get(k); if (trace) { log.tracef("Creating new ICE for writing. Existing=%s, metadata=%s, new value=%s", e, metadata, v); } if (l1Entry) { e = entryFactory.createL1(k, v, metadata); } else if (e != null) { e = entryFactory.update(e, v, metadata); } else { e = entryFactory.create(k, v, metadata); } if (trace) log.tracef("Store %s in container", e); extendedMap.putAndActivate(e); }
Source:
private TokenCacheItem(final String authority, final AuthenticationResult authenticationResult) { if (authenticationResult == null) { throw new IllegalArgumentException("authenticationResult"); } if (StringExtensions.IsNullOrBlank(authority)) { throw new IllegalArgumentException("authority"); } mAuthority = authority; mExpiresOn = authenticationResult.getExpiresOn(); mIsMultiResourceRefreshToken = authenticationResult.getIsMultiResourceRefreshToken(); mTenantId = authenticationResult.getTenantId(); mUserInfo = authenticationResult.getUserInfo(); mRawIdToken = authenticationResult.getIdToken(); mRefreshtoken = authenticationResult.getRefreshToken(); mFamilyClientId = authenticationResult.getFamilyClientId(); if (authenticationResult.getExtendedExpiresOn() != null) { mExtendedExpiresOn = authenticationResult.getExtendedExpiresOn(); } }

Target:
private TokenCacheItem(final String authority, final AuthenticationResult authenticationResult) { if (authenticationResult == null) { throw new IllegalArgumentException("authenticationResult"); } if (StringExtensions.IsNullOrBlank(authority)) { throw new IllegalArgumentException("authority"); } mAuthority = authority; mExpiresOn = authenticationResult.getExpiresOn(); mIsMultiResourceRefreshToken = authenticationResult.getIsMultiResourceRefreshToken(); mTenantId = authenticationResult.getTenantId(); mUserInfo = authenticationResult.getUserInfo(); mRawIdToken = authenticationResult.getIdToken(); mRefreshtoken = authenticationResult.getRefreshToken(); mFamilyClientId = authenticationResult.getFamilyClientId(); mExtendedExpiresOn = authenticationResult.getExtendedExpiresOn(); }
Source:
public void should_replace_old_job_with_regex() { String oldJobName = "MyJob01"; String newJobName = "MyJob02"; String renameRegex = "/MyJob\\d+/"; jenkins.jobs.create(FreeStyleJob.class, oldJobName); String jobDslScript = String.format("job('%s') { previousNames( %s ) }", newJobName, renameRegex); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, newJobName); assertThat(job, pageObjectExists()); assertEquals(newJobName, job.name); }

Target:
public void should_replace_old_job_with_regex() { String oldJobName = "MyJob01"; String newJobName = "MyJob02"; String renameRegex = "/MyJob\\d+/"; jenkins.jobs.create(FreeStyleJob.class, oldJobName); String jobDslScript = String.format("job('%s') { previousNames( %s ) }", newJobName, renameRegex); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, newJobName); Job oldJob = jenkins.jobs.get(Job.class, oldJobName); assertThat(job, pageObjectExists()); assertThat(oldJob, pageObjectDoesNotExist()); assertEquals(newJobName, job.name); }
Source:
public GT_Block_Casings8() { super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE); for (int i = 0; i < 2; i = (i + 1)) { Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Robust HSS-G Machine Casing"); ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0)); ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1)); ItemList.Casing_RobustHSSG.set(new ItemStack(this,1,0)); }

Target:
public GT_Block_Casings8() { super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE); for (int i = 0; i < 3; i = (i + 1)) { Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Robust HSS-G Machine Casing"); ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0)); ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1)); ItemList.Casing_RobustHSSG.set(new ItemStack(this,1,2)); }
Source:
public String getSource(EnvVars env) { return env.expand(source); }

Target:
private String getSource(EnvVars env) { return env.expand(source); }
Source:
protected String[] getMutablePropertyNames() { return new String[] { "dateStopped", "voided", "dateVoided", "voidedBy", "voidReason" }; }

Target:
protected String[] getMutablePropertyNames() { return MUTABLE_PROPERTY_NAMES; }
Source:
public ActionResult execute() { String newCourseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseCreateRequest courseCreateRequest = getAndValidateRequestBody(CourseCreateRequest.class); String newCourseName = courseCreateRequest.getCourseName(); String newCourseTimeZone = courseCreateRequest.getTimeZone(); try { logic.createCourseAndInstructor(userInfo.id, newCourseId, newCourseName, newCourseTimeZone); } catch (EntityAlreadyExistsException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_CONFLICT); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } String statusMessage = "The course has been added. Click <a href=\"/web/instructor/courses/enroll?courseid=" + newCourseId + "\">here</a> to add students to the course or click " + "<a href=\"/web/instructor/courses/edit?courseid=" + newCourseId + "\">here</a> to add other instructors." + "<br>If you don't see the course in the list below, please refresh the page after a few moments."; return new JsonResult(statusMessage); }

Target:
public ActionResult execute() { CourseCreateRequest courseCreateRequest = getAndValidateRequestBody(CourseCreateRequest.class); String newCourseId = courseCreateRequest.getCourseId(); String newCourseName = courseCreateRequest.getCourseName(); String newCourseTimeZone = courseCreateRequest.getTimeZone(); try { logic.createCourseAndInstructor(userInfo.id, newCourseId, newCourseName, newCourseTimeZone); } catch (EntityAlreadyExistsException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_CONFLICT); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return new JsonResult(new CourseData(logic.getCourse(newCourseId))); }
Source:
public void saveOrUpdateShouldBeUnsuccessfulWhenPositionIdIsNotANumber() throws Exception { given(this.messageKeyResolver.resolveMessageOrDefault(COMMON_INVALID_INPUT_MESSAGE_KEY)).willReturn(COMMON_INVALID_INPUT_MESSAGE); given(this.messageKeyResolver.resolveMessageOrDefault(POSITION_NOT_FOUND_ERROR_MESSAGE_KEY)).willReturn(POSITION_NOT_FOUND_ERROR_MESSAGE); this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", STRING_VALUE_ONE) .param("position.id", TEXT).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(REDIRECT_URL_FIELD_ERROR)) .andExpect(flash().attribute("positionErrorMessage", POSITION_NOT_FOUND_ERROR_MESSAGE)); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(1L); then(this.positionService).should().getPositionDtoById(null); then(this.channelService).should().getChannelDtoById(1L); }

Target:
public void saveOrUpdateShouldBeUnsuccessfulWhenPositionIdIsNotANumber() throws Exception { given(this.candidateService.getCandidate(1L)).willReturn(new CandidateDTO()); given(this.positionService.getPositionDtoById(null)).willThrow(new AssertionError()); given(this.channelService.getChannelDtoById(1L)).willReturn(channelDTO); given(this.messageKeyResolver.resolveMessageOrDefault(COMMON_INVALID_INPUT_MESSAGE_KEY)).willReturn(COMMON_INVALID_INPUT_MESSAGE); given(this.messageKeyResolver.resolveMessageOrDefault(POSITION_NOT_FOUND_ERROR_MESSAGE_KEY)).willReturn(POSITION_NOT_FOUND_ERROR_MESSAGE); this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", STRING_VALUE_ONE) .param("position.id", TEXT).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(REDIRECT_URL_FIELD_ERROR)) .andExpect(flash().attributeCount(2)) .andExpect(flash().attribute("positionErrorMessage", POSITION_NOT_FOUND_ERROR_MESSAGE)); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(1L); then(this.positionService).should().getPositionDtoById(null); then(this.channelService).should().getChannelDtoById(1L); }
Source:
public HashSet<Zoie<BoboIndexReader, ?>> getZoieSystems() { return _core.getZoieSystems(); }

Target:
public Collection<Zoie<BoboIndexReader, ?>> getZoieSystems() { return _core.getZoieSystems(); }
Source:
public T hasThisElement(final Object val) { Assert.parametersNotNull("val", val); return addCriteria(FilterOperator.ELEMENT_MATCH, val, not); }

Target:
public T hasThisElement(final Object val) { Assert.parametersNotNull("val", val); return addCriteria(FilterOperator.ELEMENT_MATCH, val, false); }