auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void deleteChecked() { final StringBuilder message = new StringBuilder(); message.append("<b>").append(Gerrit.C.branchDeletionConfirmationMessage()).append("</b>"); message.append("<p>"); final HashSet<Branch.NameKey> ids = new HashSet<Branch.NameKey>(); for (int row = 1; row < table.getRowCount(); row++) { final Branch k = getRowItem(row); if (k != null && table.getWidget(row, 1) instanceof CheckBox && ((CheckBox) table.getWidget(row, 1)).getValue()) { if (!ids.isEmpty()) { message.append(", <br>"); } final String escapedBranchName = <START> new SafeHtmlBuilder().append(k.getName()).asString(); <END> message.append(escapedBranchName); ids.add(k.getNameKey()); } } message.append("</p>"); if (ids.isEmpty()) { return; } ConfirmationDialog confirmationDialog = new ConfirmationDialog(Gerrit.C.branchDeletionDialogTitle(), new HTML(message.toString()), new ConfirmationCallback() { @Override public void onOk() { Util.PROJECT_SVC.deleteBranch(getProjectKey(), ids, new GerritCallback<Set<Branch.NameKey>>() { public void onSuccess(final Set<Branch.NameKey> deleted) { for (int row = 1; row < table.getRowCount();) { final Branch k = getRowItem(row); if (k != null && deleted.contains(k.getNameKey())) { table.removeRow(row); } else { row++; } } } }); } }); confirmationDialog.center(); }</code><technical_language>This is HTML built SafeHtmlBuilder instead of StringBuilder. Instead of SafeHtmlBuilder escape string, please rewrite this method instead of StringBuilder</technical_language>

Target:
void deleteChecked() { final SafeHtmlBuilder b = new SafeHtmlBuilder(); b.openElement("b"); b.append(Gerrit.C.branchDeletionConfirmationMessage()); b.closeElement("b"); b.openElement("p"); final HashSet<Branch.NameKey> ids = new HashSet<Branch.NameKey>(); for (int row = 1; row < table.getRowCount(); row++) { final Branch k = getRowItem(row); if (k != null && table.getWidget(row, 1) instanceof CheckBox && ((CheckBox) table.getWidget(row, 1)).getValue()) { if (!ids.isEmpty()) { b.append(",").br(); } b.append(k.getName()); ids.add(k.getNameKey()); } } b.closeElement("p"); if (ids.isEmpty()) { return; } ConfirmationDialog confirmationDialog = new ConfirmationDialog(Gerrit.C.branchDeletionDialogTitle(), b.toSafeHtml(), new ConfirmationCallback() { @Override public void onOk() { Util.PROJECT_SVC.deleteBranch(getProjectKey(), ids, new GerritCallback<Set<Branch.NameKey>>() { public void onSuccess(final Set<Branch.NameKey> deleted) { for (int row = 1; row < table.getRowCount();) { final Branch k = getRowItem(row); if (k != null && deleted.contains(k.getNameKey())) { table.removeRow(row); } else { row++; } } } }); } }); confirmationDialog.center(); }
Source:
<code>public void staffUserShouldSeeReviewModule() { <START> SpecialJsPage wikiaJs = new SpecialJsPage().open("Wikia"); <END> Assertion.assertTrue(wikiaJs.getReviewModule().isModuleVisible()); }</code><technical_language>Why</technical_language>

Target:
public void staffUserShouldSeeReviewModule() { SpecialJsPage wikiaJs = new SpecialJsPage().open("wikia"); Assertion.assertTrue(wikiaJs.getReviewModule().isModuleVisible()); }
Source:
<code>private BrowserWebDriverContainer startBrowser(TestConfiguration testConfiguration, ExtensionContext extensionContext) { LOGGER.info("(*) Starting browser [{}]...", testConfiguration.getBrowser()); BrowserWebDriverContainer webDriverContainer = new BrowserWebDriverContainer<>() .withDesiredCapabilities(testConfiguration.getBrowser().getCapabilities()) .withNetwork(Network.SHARED) .withNetworkAliases("vnchost") .withRecordingMode(BrowserWebDriverContainer.VncRecordingMode.SKIP, null) <START> .withFileSystemBind(TEST_RESOURCES_HOST_PATH, testConfiguration.getTestResourcesPath()); <END> if (testConfiguration.isVerbose()) { LOGGER.info(String.format("Docker image used: [%s]", BrowserWebDriverContainer.getImageForCapabilities(testConfiguration.getBrowser().getCapabilities()))); webDriverContainer.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(this.getClass()))); } webDriverContainer.start(); if (testConfiguration.vnc()) { LOGGER.info("VNC server address = " + webDriverContainer.getVncAddress()); } saveBrowserWebDriverContainer(extensionContext, webDriverContainer); XWikiWebDriver xwikiWebDriver = new XWikiWebDriver(webDriverContainer.getWebDriver()); saveXWikiWebDriver(extensionContext, xwikiWebDriver); LOGGER.info("(*) Initialize Test Context..."); PersistentTestContext testContext = initializePersistentTestContext(xwikiWebDriver); savePersistentTestContext(extensionContext, testContext); testContext.getUtil().setURLPrefix(computeXWikiURLPrefix( testConfiguration.getServletEngine().getInternalIP(), testConfiguration.getServletEngine().getInternalPort())); testContext.getUtil().rest().setURLPrefix(loadXWikiURL(extensionContext)); DockerTestUtils.followOutput(webDriverContainer, getClass()); testContext.getUtil().recacheSecretToken(); return webDriverContainer; }</code><technical_language>This is performant mac for example, depends volume of data. In case recommend do do for servlet container</technical_language>

Target:
private BrowserWebDriverContainer startBrowser(TestConfiguration testConfiguration, ExtensionContext extensionContext) { BrowserContainerExecutor browserContainerExecutor = new BrowserContainerExecutor(); BrowserWebDriverContainer webDriverContainer = browserContainerExecutor.start(testConfiguration); saveBrowserWebDriverContainer(extensionContext, webDriverContainer); XWikiWebDriver xwikiWebDriver = new XWikiWebDriver(webDriverContainer.getWebDriver()); saveXWikiWebDriver(extensionContext, xwikiWebDriver); LOGGER.info("(*) Initialize Test Context..."); PersistentTestContext testContext = initializePersistentTestContext(xwikiWebDriver); savePersistentTestContext(extensionContext, testContext); testContext.getUtil().setURLPrefix(computeXWikiURLPrefix( testConfiguration.getServletEngine().getInternalIP(), testConfiguration.getServletEngine().getInternalPort())); testContext.getUtil().rest().setURLPrefix(loadXWikiURL(extensionContext)); DockerTestUtils.followOutput(webDriverContainer, getClass()); testContext.getUtil().recacheSecretToken(); return webDriverContainer; }
Source:
<code>public Value toAbsolutePath( Value request ) throws FaultException { Value response = Value.create(); String fileName = request.strValue(); String absolutePath = Paths.get( fileName ).toAbsolutePath().normalize().toString(); if ( absolutePath == null ) { <START> throw new FaultException( "Not a valid path", new IOException() ); <END> } response.setValue( absolutePath ); return response; }</code><technical_language>throw new FaultException( new IOException( "Not a valid path" ) ); for other method</technical_language>

Target:
public Value toAbsolutePath( Value request ) throws FaultException { Value response = Value.create(); String fileName = request.strValue(); Path absolutePath = null; try { absolutePath = Paths.get( fileName ).toAbsolutePath().normalize(); } catch ( InvalidPathException invalidPathException ) { throw new FaultException( invalidPathException ); } response.setValue( absolutePath.toString() ); return response; }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); NightscoutPreferences prefs = new AndroidPreferences( this, mainPreferenceFragment.getPreferenceManager().getSharedPreferences()); if (scanResult != null && scanResult.getContents() != null) { NSBarcodeConfig barcode = new NSBarcodeConfig(scanResult.getContents()); if (barcode.hasMongoConfig()) { prefs.setMongoUploadEnabled(true); if (barcode.getMongoUri().isPresent()) { prefs.setMongoClientUri(barcode.getMongoUri().get()); prefs.setMongoCollection(barcode.getMongoCollection().orNull()); prefs.setMongoDeviceStatusCollection( <START> barcode.getMongoDeviceStatusCollection().orNull()); <END> } } else { prefs.setMongoUploadEnabled(false); } if (barcode.hasApiConfig()) { prefs.setRestApiEnabled(true); prefs.setRestApiBaseUris(barcode.getApiUris()); } else { prefs.setRestApiEnabled(false); } refreshFragments(); } }</code><technical_language>A null deletes key. barcode generator is coded send collection a result I set a default value. URI is present if this code is executed. I suspect mongo uploads fail due defined collections</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); NightscoutPreferences prefs = new AndroidPreferences(this); if (scanResult != null && scanResult.getContents() != null) { NSBarcodeConfig barcode = new NSBarcodeConfig(scanResult.getContents()); if (barcode.hasMongoConfig()) { prefs.setMongoUploadEnabled(true); if (barcode.getMongoUri().isPresent()) { prefs.setMongoClientUri(barcode.getMongoUri().get()); prefs.setMongoCollection(barcode.getMongoCollection().orNull()); prefs.setMongoDeviceStatusCollection( barcode.getMongoDeviceStatusCollection().orNull()); } } else { prefs.setMongoUploadEnabled(false); } if (barcode.hasApiConfig()) { prefs.setRestApiEnabled(true); prefs.setRestApiBaseUris(barcode.getApiUris()); } else { prefs.setRestApiEnabled(false); } refreshFragments(); } }
Source:
<code>private List<URL> addPythonDependency(List<URL> dependencies) { List<URL> newDependencies = new ArrayList<>(dependencies); try { URL location = Class.forName( "org.apache.flink.python.PythonFunctionRunner", false, Thread.currentThread().getContextClassLoader()) .getProtectionDomain().getCodeSource().getLocation(); if (Paths.get(location.toURI()).toFile().isFile()) { newDependencies.add(location); } else { <START> throw new FlinkException("flink-python module detected but is not a jar file: " + location + "."); <END> } } catch (URISyntaxException | ClassNotFoundException | FlinkException e) { LOG.warn("Python UDF detected but flink-python jar not found. " + "If you starts SQL-Client via `sql-client.sh`, " + "please add the flink-python jar via `-j` command option manually.", e); } return newDependencies; }</code><technical_language>SqlExecutionException</technical_language>

Target:
private List<URL> addPythonDependency(List<URL> dependencies) { List<URL> newDependencies = new ArrayList<>(dependencies); try { URL location = Class.forName( "org.apache.flink.python.PythonFunctionRunner", false, Thread.currentThread().getContextClassLoader()) .getProtectionDomain().getCodeSource().getLocation(); if (Paths.get(location.toURI()).toFile().isFile()) { newDependencies.add(location); } } catch (URISyntaxException | ClassNotFoundException e) { throw new SqlExecutionException("Python UDF detected but flink-python jar not found. " + "If you starts SQL-Client via `sql-client.sh`, please add the flink-python jar " + "via `-j` command option manually.", e); } return newDependencies; }
Source:
<code><START> static Map<String, DiscoveryGroupConfiguration> addDiscoveryGroupConfigs(final OperationContext context, final ModelNode model) throws OperationFailedException { <END> Map<String, DiscoveryGroupConfiguration> configs = new HashMap<>(); if (model.hasDefined(CommonAttributes.JGROUP_DISCOVERY_GROUP)) { for (Property prop : model.get(CommonAttributes.JGROUP_DISCOVERY_GROUP).asPropertyList()) { configs.put(prop.getName(), createDiscoveryGroupConfiguration(context, prop.getName(), prop.getValue())); } } if (model.hasDefined(CommonAttributes.SOCKET_DISCOVERY_GROUP)) { for (Property prop : model.get(CommonAttributes.SOCKET_DISCOVERY_GROUP).asPropertyList()) { configs.put(prop.getName(), createDiscoveryGroupConfiguration(context, prop.getName(), prop.getValue())); } } return configs; }</code><technical_language>intermediate step? convert operations non-legacy versions here</technical_language>

Target:
static Map<String, DiscoveryGroupConfiguration> addDiscoveryGroupConfigs(final OperationContext context, final ModelNode model) throws OperationFailedException { Map<String, DiscoveryGroupConfiguration> configs = new HashMap<>(); if (model.hasDefined(CommonAttributes.JGROUPS_DISCOVERY_GROUP)) { for (Property prop : model.get(CommonAttributes.JGROUPS_DISCOVERY_GROUP).asPropertyList()) { configs.put(prop.getName(), createDiscoveryGroupConfiguration(context, prop.getName(), prop.getValue())); } } if (model.hasDefined(CommonAttributes.SOCKET_DISCOVERY_GROUP)) { for (Property prop : model.get(CommonAttributes.SOCKET_DISCOVERY_GROUP).asPropertyList()) { configs.put(prop.getName(), createDiscoveryGroupConfiguration(context, prop.getName(), prop.getValue())); } } return configs; }
Source:
<code>public void testAllOnlineConfigChange() throws IOException { <START> LOG.debug("Starting the test " + name.getMethodName()); <END> Admin admin = TEST_UTIL.getAdmin(); admin.updateConfiguration(); }</code><technical_language>nit: a habit of logger's format string capability. performs computation necessary build log message if logger is emitting messages target level. java LOG.debug("Starting test {}", name.getMethodName());</technical_language>

Target:
public void testAllOnlineConfigChange() throws IOException { LOG.debug("Starting the test ", name.getMethodName()); Admin admin = TEST_UTIL.getAdmin(); admin.updateConfiguration(); }
Source:
<code>public static MultiCurrencyAmountArray of(Map<Currency, DoubleArray> values) { values.values().stream().reduce((a1, a2) -> checkSize(a1, a2)); <START> return new MultiCurrencyAmountArray(values.size(), values); <END> }</code><technical_language>Here, size is number of currencies</technical_language>

Target:
public static MultiCurrencyAmountArray of(Map<Currency, DoubleArray> values) { values.values().stream().reduce((a1, a2) -> checkSize(a1, a2)); int size = values.isEmpty() ? 0 : values.values().iterator().next().size(); return new MultiCurrencyAmountArray(size, values); }
Source:
<code>public Response deleteToken() { User u; try { u = findUserOrDie(); } catch (WrappedResponse ex) { return ex.getResponse(); } AuthenticatedUser au; try{ au = (AuthenticatedUser) u; } catch (ClassCastException e){ <START> return notFound("Token for " + u.getIdentifier() + " not found."); <END> } if (au == null) { return notFound("Token for " + u.getIdentifier() + " not found."); } authSvc.removeApiToken(au); return ok("Token for " + au.getUserIdentifier() + " deleted."); }</code><technical_language>message "The guest user API token"</technical_language>

Target:
public Response deleteToken() { User u; try { u = findUserOrDie(); } catch (WrappedResponse ex) { return ex.getResponse(); } AuthenticatedUser au; try{ au = (AuthenticatedUser) u; } catch (ClassCastException e){ return notFound("Token for " + u.getIdentifier() + " not eligible for deletion."); } authSvc.removeApiToken(au); return ok("Token for " + au.getUserIdentifier() + " deleted."); }
Source:
<code>public void applyOrderEdit() { OrderEditFixtures.withUpdateableOrderEdit(client(), orderEdit -> { <START> <END> final Address address = Address.of(CountryCode.DE); final SetBillingAddress setBillingAddress = SetBillingAddress.of(address); final OrderEditUpdateCommand orderEditUpdateCommand = OrderEditUpdateCommand.of(orderEdit, AddStagedAction.of(setBillingAddress)) .withExpansionPaths(OrderEditExpansionModel::resource); final OrderEdit updatedOrderEdit = client().executeBlocking(orderEditUpdateCommand); Assertions.assertThat(updatedOrderEdit).isNotNull(); final OrderEditApplyCommand orderEditApplyCommand = OrderEditApplyCommand.of(updatedOrderEdit.getId(), updatedOrderEdit.getResource().getObj().getVersion(), updatedOrderEdit.getVersion()); final OrderEdit appliedOrderEdit = client().executeBlocking(orderEditApplyCommand); Assertions.assertThat(appliedOrderEdit).isNotNull(); final OrderByIdGet orderByIdGet = OrderByIdGet.of(updatedOrderEdit.getResource().getObj().getId()); final Order order = client().executeBlocking(orderByIdGet); Assertions.assertThat(order).isNotNull(); Assertions.assertThat(order.getBillingAddress().getCountry()).isEqualTo(CountryCode.DE); return appliedOrderEdit; }); }</code><technical_language>Add a check country isnt DE</technical_language>

Target:
public void applyOrderEdit() { final Function<OrderEdit, OrderEditApplyCommand> function = (OrderEdit orderEdit) -> OrderEditApplyCommand.of(orderEdit.getId(), orderEdit.getVersion(), orderEdit.getResource().getObj().getVersion()); apply(function); }
Source:
<code>void shutdown() { try { <START> removeTemporaryWs(); <END> } catch (ServerException | ConflictException e) { LOG.warn("Unable to cleanup temporary workspaces on shutdown: " + e.getLocalizedMessage(), e); } }</code><technical_language>Is purpose remove temporary workspaces shutdown if do boostrap? removed shutdown bootstrap</technical_language>

Target:
void shutdown() { try { removeTemporaryWs(); } catch (ServerException e) { LOG.warn("Unable to cleanup temporary workspaces on shutdown: " + e.getLocalizedMessage(), e); } }
Source:
<code>public StubTypes(AnnotatedTypeFactory factory) { this.factory = factory; this.typesFromStubFiles = new HashMap<>(); this.declAnnosFromStubFiles = new HashMap<>(); this.parsing = false; <START> String release = PluginUtil.releaseValue(factory.getProcessingEnv()); <END> this.annotatedJdkVersion = release != null ? release : String.valueOf(PluginUtil.getJreVersion()); this.shouldParseJdk = !factory.getContext().getChecker().hasOption("ignorejdkastub") && PluginUtil.getJreVersion() != 8 && annotatedJdkVersion.equals("11"); }</code><technical_language>Instead of returning a @Nullable string handling fall-back call-site, moving PluginUtil.releaseValue return int</technical_language>

Target:
public StubTypes(AnnotatedTypeFactory factory) { this.factory = factory; this.typesFromStubFiles = new HashMap<>(); this.declAnnosFromStubFiles = new HashMap<>(); this.parsing = false; String release = PluginUtil.getReleaseValue(factory.getProcessingEnv()); this.annotatedJdkVersion = release != null ? release : String.valueOf(PluginUtil.getJreVersion()); this.shouldParseJdk = !factory.getContext().getChecker().hasOption("ignorejdkastub") && PluginUtil.getJreVersion() != 8 && annotatedJdkVersion.equals("11"); }
Source:
<code>private String rewrittenRedirectUri(String originalUri) { <START> String rewrittenRedirectUri = originalUri; <END> try { URL url = new URL(originalUri); Map<String, String> rewriteRules = deployment.getRedirectRewriteRules(); if(rewriteRules != null && !rewriteRules.isEmpty()) { Map.Entry<String, String> rule = rewriteRules.entrySet().iterator().next(); StringBuilder redirectUriBuilder = new StringBuilder(url.getProtocol()); redirectUriBuilder.append("://"+ url.getAuthority()); redirectUriBuilder.append(url.getPath().replaceFirst(rule.getKey(), rule.getValue())); return redirectUriBuilder.toString(); } } catch (MalformedURLException ex) { log.error("Not a valid request url"); } return rewrittenRedirectUri; }</code><technical_language>Creating a URL instance is costly (believe not) suggest checking if deployment.getRedirectRewriteRules() is null return originalUri straight if is</technical_language>

Target:
private String rewrittenRedirectUri(String originalUri) { Map<String, String> rewriteRules = deployment.getRedirectRewriteRules(); if(rewriteRules != null && !rewriteRules.isEmpty()) { try { URL url = new URL(originalUri); Map.Entry<String, String> rule = rewriteRules.entrySet().iterator().next(); StringBuilder redirectUriBuilder = new StringBuilder(url.getProtocol()); redirectUriBuilder.append("://"+ url.getAuthority()); redirectUriBuilder.append(url.getPath().replaceFirst(rule.getKey(), rule.getValue())); return redirectUriBuilder.toString(); } catch (MalformedURLException ex) { log.error("Not a valid request url"); throw new RuntimeException(ex); } } return originalUri; }
Source:
<code>public String getFirstName() { <START> return (firstName == null) ? getPlaceHolderString("message.alternative.first.name") : firstName; <END> }</code><technical_language>I prefer getTranslation("message.alternative.first.name", getSenderNickname()) getTranslation("message.alternative.last.name", getSenderNickname())</technical_language>

Target:
public String getFirstName() { return (firstName == null) ? getTranslation("message.alternative.first.name", getSenderNickname()) : firstName; }
Source:
<code>public AvailabilityType getAvailability() { boolean trace = log.isTraceEnabled(); EmsBean bean = getEmsBean(); try { if (bean != null) { <START> bean.refreshAttributes(); <END> if (bean.getAttribute("CacheStatus").getValue().equals("RUNNING")) { if (trace) log.trace("Cache " + cacheName + " within " + cacheManagerName + " cache manager is running, so it's up."); return AvailabilityType.UP; } } if (trace) log.trace("Cache status for " + cacheName + " within " + cacheManagerName + " cache manager is anything other than running, so it's down."); return AvailabilityType.DOWN; } catch (Exception e) { if (trace) log.trace("There was an exception checking availability, so cache status is down.", e); return AvailabilityType.DOWN; } }</code><technical_language>a refresh single CacheStatus attribute ? a real issue, nicer..</technical_language>

Target:
public AvailabilityType getAvailability() { boolean trace = log.isTraceEnabled(); EmsBean bean = getEmsBean(); try { if (bean != null) { bean.refreshAttributes(AVAILABILITY_ATTRIBUTE); if ("RUNNING".equals(bean.getAttribute(STATUS_ATTRIBUTE_NAME).getValue())) { if (trace) log.trace("Cache " + cacheName + " within " + cacheManagerName + " cache manager is running, so it's up."); return AvailabilityType.UP; } } if (trace) log.trace("Cache status for " + cacheName + " within " + cacheManagerName + " cache manager is anything other than running, so it's down."); return AvailabilityType.DOWN; } catch (Exception e) { if (trace) log.trace("There was an exception checking availability, so cache status is down.", e); return AvailabilityType.DOWN; } }
Source:
<code>public void depositLots(final Integer userId, final Set<Integer> lotIds, final List<LotDepositDto> lotDepositDtoList, final TransactionStatus transactionStatus) { final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotIds(new ArrayList<>(lotIds)); final List<ExtendedLotDto> lots = this.daoFactory.getLotDao().searchLots(lotsSearchDto, null); final Map<String, List<LotDepositDto>> lotDepositDtoMap = lotDepositDtoList.stream().collect(Collectors.groupingBy(LotDepositDto::getLotUID)); <START> for (final ExtendedLotDto extendedLotDto : lots) { <END> final List<LotDepositDto> lotDepositDtos = lotDepositDtoMap.get(extendedLotDto.getLotUUID()); for (final LotDepositDto lotDepositDto : lotDepositDtos) { final Transaction transaction = new Transaction(TransactionType.DEPOSIT, transactionStatus, userId, lotDepositDto.getNotes(), extendedLotDto.getLotId(), lotDepositDto.getAmount()); this.daoFactory.getTransactionDAO().save(transaction); } } }</code><technical_language>@cuenyad 2 for is needed. Iterate lotDepositDtoList a map LotUID key</technical_language>

Target:
public void depositLots(final Integer userId, final Set<Integer> lotIds, final List<LotDepositDto> lotDepositDtoList, final TransactionStatus transactionStatus) { final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotIds(new ArrayList<>(lotIds)); final List<ExtendedLotDto> lots = this.daoFactory.getLotDao().searchLots(lotsSearchDto, null); final Map<String, ExtendedLotDto> extendedLotDtoMap = lots.stream().collect(Collectors.toMap(ExtendedLotDto::getLotUUID, extendedLotDto -> extendedLotDto)); for (final LotDepositDto lotDepositDto : lotDepositDtoList) { final ExtendedLotDto extendedLotDto = extendedLotDtoMap.get(lotDepositDto.getLotUID()); final Transaction transaction = new Transaction(TransactionType.DEPOSIT, transactionStatus, userId, lotDepositDto.getNotes(), extendedLotDto.getLotId(), lotDepositDto.getAmount()); this.daoFactory.getTransactionDAO().save(transaction); } }
Source:
<code><START> private String runtimeClassPath() throws UnsupportedEncodingException { <END> StringBuilder runtimeClassPath = new StringBuilder(); for (URL url : ((URLClassLoader) LocalScriptTestDriveService.class.getClassLoader()).getURLs()) { if (url.getPath().contains("ngrinder-runtime") || url.getPath().contains("ngrinder-groovy")) { runtimeClassPath.append(URLDecoder.decode(url.getFile(), "UTF-8")).append(File.pathSeparator); } } return runtimeClassPath.toString(); }</code><technical_language>eat this exception silently</technical_language>

Target:
private String runtimeClassPath() { StringBuilder runtimeClassPath = new StringBuilder(); for (URL url : ((URLClassLoader) LocalScriptTestDriveService.class.getClassLoader()).getURLs()) { if (url.getPath().contains("ngrinder-runtime") || url.getPath().contains("ngrinder-groovy")) { runtimeClassPath.append(decodePathWithUTF8(url.getFile())).append(File.pathSeparator); } } return runtimeClassPath.toString(); }
Source:
<code><START> public void trackTagLoaded(ReaderTag tag) { <END> AnalyticsTracker.Stat stat = null; if (tag.isFreshlyPressed()) { stat = AnalyticsTracker.Stat.READER_FRESHLY_PRESSED_LOADED; } else if (tag.isTagTopic()) { stat = AnalyticsTracker.Stat.READER_TAG_LOADED; } else if (tag.isListTopic()) { stat = AnalyticsTracker.Stat.READER_LIST_LOADED; } if (stat == null) return; Map<String, String> properties = new HashMap<>(); properties.put("tag", tag.getTagName()); AnalyticsTracker.track(stat, properties); }</code><technical_language>Minor nit: this method private public</technical_language>

Target:
private void trackTagLoaded(ReaderTag tag) { AnalyticsTracker.Stat stat = null; if (tag.isFreshlyPressed()) { stat = AnalyticsTracker.Stat.READER_FRESHLY_PRESSED_LOADED; } else if (tag.isTagTopic()) { stat = AnalyticsTracker.Stat.READER_TAG_LOADED; } else if (tag.isListTopic()) { stat = AnalyticsTracker.Stat.READER_LIST_LOADED; } if (stat == null) return; Map<String, String> properties = new HashMap<>(); properties.put("tag", tag.getTagName()); AnalyticsTracker.track(stat, properties); }
Source:
<code>public void prefixKeyWithSalt(final byte[] row_key, final int bucket) { if (salt_width == 1) { row_key[0] = (byte) bucket; return; } int shift = 0; for (int i = 0; i <= salt_width; i++) { <START> row_key[salt_width - i] = 0; <END> row_key[salt_width - i] = (byte) (bucket >>> shift); shift += 8; } }</code><technical_language>This replace byte of metric name i = 0. Also, total iterations salt_width + 1. Starting i = 1 fix it</technical_language>

Target:
public void prefixKeyWithSalt(final byte[] row_key, final int bucket) { if (salt_width == 1) { row_key[0] = (byte) bucket; return; } int shift = 0; for (int i = 0; i < salt_width; i++) { row_key[salt_width - i - 1] = 0; row_key[salt_width - i - 1] = (byte) (bucket >>> shift); shift += 8; } }
Source:
<code>public void testUpdateProject() throws SQLException{ ProjectInfo projectInfo = new ProjectInfo(); projectInfo.name = "TEST_PROJECT_NAME"; projectInfo.displayName = "TEST_PROJECT_DISPLAYNAME"; projectInfo.common = "TEST_PROJECT_COMMON"; projectInfo.manager = "TEST_PROJECT_MANAGER"; projectInfo.attachFileSize = 2048L; <START> long projectId = mProjectMapper.createProject(projectInfo.name, projectInfo); <END> assertTrue(projectId > 0); projectInfo.displayName = "TEST_PROJECT_DISPLAYNAME_NEW"; projectInfo.common = "TEST_PROJECT_COMMON_NEW"; projectInfo.manager = "TEST_PROJECT_MANAGER_NEW"; projectInfo.attachFileSize = 1024L; mProjectMapper.updateProject(projectId, projectInfo); IQueryValueSet valueSet = new MySQLQuerySet(); valueSet.addTableName(ProjectEnum.TABLE_NAME); valueSet.addEqualCondition(ProjectEnum.ID, projectId); String query = valueSet.getSelectQuery(); ResultSet resultSet = mControl.executeQuery(query); if (resultSet.next()) { ProjectObject project = ProjectDAO.getInstance().convertProject(resultSet); assertEquals(projectInfo.displayName, project.getDisplayName()); assertEquals(projectInfo.common, project.getComment()); assertEquals(projectInfo.manager, project.getManager()); assertEquals(projectInfo.attachFileSize, project.getAttachFileSize()); } }</code><technical_language>avoid other method</technical_language>

Target:
public void testUpdateProject() throws SQLException{ ProjectInfo newProjectInfo = new ProjectInfo(); newProjectInfo.displayName = "TEST_PROJECT_DISPLAYNAME_NEW"; newProjectInfo.common = "TEST_PROJECT_COMMON_NEW"; newProjectInfo.manager = "TEST_PROJECT_MANAGER_NEW"; newProjectInfo.attachFileSize = 1024L; mProjectMapper.updateProject(mProjectId, newProjectInfo); IQueryValueSet valueSet = new MySQLQuerySet(); valueSet.addTableName(ProjectEnum.TABLE_NAME); valueSet.addEqualCondition(ProjectEnum.ID, mProjectId); String query = valueSet.getSelectQuery(); ResultSet resultSet = mControl.executeQuery(query); if (resultSet.next()) { ProjectObject project = ProjectDAO.getInstance().convertProject(resultSet); assertEquals(newProjectInfo.displayName, project.getDisplayName()); assertEquals(newProjectInfo.common, project.getComment()); assertEquals(newProjectInfo.manager, project.getManager()); assertEquals(newProjectInfo.attachFileSize, project.getAttachFileSize()); } }
Source:
<code>public boolean hostileTakeover() { LeadershipState leadershipState = determineLeadershipState(); StillLeadingStatus status = leadershipState.status(); switch (status) { case LEADING: <START> return true; <END> case NOT_LEADING: try { proposer.propose(getNextSequenceNumber(leadershipState.greatestLearnedValue()), null); StillLeadingStatus newStatus = determineLeadershipState().status(); if (newStatus == StillLeadingStatus.LEADING) { log.info("Successfully took over", SafeArg.of("newStatus", newStatus)); return true; } else { log.info("Failed to take over", SafeArg.of("newStatus", newStatus)); return false; } } catch (PaxosRoundFailureException e) { log.info("Couldn't takeover leadership because a quorum could not be obtained.", SafeArg.of("lastObservedState", leadershipState)); return false; } case NO_QUORUM: log.info("Couldn't takeover leadership because a quorum could not be obtained: NO_QUORUM"); return false; default: throw new IllegalStateException("Unexpected value: " + status); } }</code><technical_language>This agree API of hostileTakeover (I gain leadership forcefully, I leader). API reworded true iff this node leader some point method call (bearing in mind leader, a successful proposal + GC another node this method returns)</technical_language>

Target:
public boolean hostileTakeover() { LeadershipState leadershipState = determineLeadershipState(); StillLeadingStatus status = leadershipState.status(); switch (status) { case LEADING: return true; case NOT_LEADING: try { proposer.propose( getNextSequenceNumber(leadershipState.greatestLearnedValue()), LEADERSHIP_PROPOSAL_VALUE); StillLeadingStatus newStatus = determineLeadershipState().status(); if (newStatus == StillLeadingStatus.LEADING) { log.info("Successfully took over", SafeArg.of("newStatus", newStatus)); return true; } else { log.info("Failed to take over", SafeArg.of("newStatus", newStatus)); return false; } } catch (PaxosRoundFailureException e) { log.info("Couldn't takeover leadership because a quorum could not be obtained.", SafeArg.of("lastObservedState", leadershipState)); return false; } case NO_QUORUM: log.info("Couldn't takeover leadership because a quorum could not be obtained: NO_QUORUM"); return false; default: throw new IllegalStateException("Unexpected value: " + status); } }
Source:
<code>public Response signup(@FormParam("courseId") String courseId, @FormParam("components")Set<String> components, @FormParam("email")String email, @FormParam("message")String message) { if (UserDirectoryService.getAnonymousUser().equals(UserDirectoryService.getCurrentUser())) { throw new WebAppForbiddenException(); } try { CourseSignup entity = courseService.signup(courseId, components, email, message); ResponseBuilder builder = Response.status(Response.Status.CREATED); builder.status(201); builder.entity(entity); return builder.build(); } catch (IllegalStateException e) { <START> Map<String, String> myMap = new HashMap<String, String>(); <END> myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } catch (IllegalArgumentException e) { Map<String, String> myMap = new HashMap<String, String>(); myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } }</code><technical_language>discuss attempting signup a module signup return 400 (bad request) attempting signup a module exist return 404. moment returning error for exceptions</technical_language>

Target:
public Response signup(@FormParam("courseId") String courseId, @FormParam("components")Set<String> components, @FormParam("email")String email, @FormParam("message")String message) { if (UserDirectoryService.getAnonymousUser().equals(UserDirectoryService.getCurrentUser())) { throw new WebAppForbiddenException(); } try { CourseSignup entity = courseService.signup(courseId, components, email, message); ResponseBuilder builder = Response.status(Response.Status.CREATED); builder.status(201); builder.entity(entity); return builder.build(); } catch (NotFoundException e) { throw new WebAppNotFoundException(); } catch (IllegalStateException e) { Map<String, String> myMap = new HashMap<String, String>(); myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } catch (IllegalArgumentException e) { Map<String, String> myMap = new HashMap<String, String>(); myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } }
Source:
<code>public void updateIndexSettings(String indexPattern, Map<String, ?> settings) { if (!isElasticsearchAvailable()) { return; } final String url = corePlugin.getElasticsearchUrl() + "/" + indexPattern + "/_settings?ignore_unavailable=true"; <START> logger.info("Updating index settings {}\n{}", corePlugin.removeUserInfo(url), settings); <END> httpClient.sendAsJson("PUT", url, settings, CONTENT_TYPE_JSON); }</code><technical_language>HttpClient.removeUserInfo</technical_language>

Target:
public void updateIndexSettings(String indexPattern, Map<String, ?> settings) { if (!isElasticsearchAvailable()) { return; } final String url = corePlugin.getElasticsearchUrl() + "/" + indexPattern + "/_settings?ignore_unavailable=true"; logger.info("Updating index settings {}\n{}", HttpClient.removeUserInfo(url), settings); httpClient.sendAsJson("PUT", url, settings, CONTENT_TYPE_JSON); }
Source:
<code>public AsyncJobStatusDTO hypervisorUpdateAsync( @Verify(value = Owner.class, require = Access.READ_ONLY, subResource = SubResource.HYPERVISOR) String ownerKey, Boolean createMissing, String reporterId, String hypervisorJson) { if (hypervisorJson == null || hypervisorJson.isEmpty()) { log.debug("Host/Guest mapping provided during hypervisor update was null."); throw new BadRequestException( i18n.tr("Host to guest mapping was not provided for hypervisor update.")); } <START> Principal principal = (this.principalProvider == null ? null : this.principalProvider.get()); <END> log.info("Hypervisor update by principal: {}", principal); Owner owner = this.getOwner(ownerKey); JobConfig config = HypervisorUpdateJob.createJobConfig() .setOwner(owner) .setData(hypervisorJson) .setCreateMissing(createMissing.booleanValue()) .setPrincipal(principal) .setReporter(reporterId); try { AsyncJobStatus status = jobManager.queueJob(config); return translator.translate(status, AsyncJobStatusDTO.class); } catch (JobException e) { String errmsg = this.i18n.tr("An unexpected exception occurred while scheduling job \"{0}\"", config.getJobKey()); throw new IseException(errmsg, e); } }</code><technical_language>here, need for null check</technical_language>

Target:
public AsyncJobStatusDTO hypervisorUpdateAsync( @Verify(value = Owner.class, require = Access.READ_ONLY, subResource = SubResource.HYPERVISOR) String ownerKey, Boolean createMissing, String reporterId, String hypervisorJson) { if (hypervisorJson == null || hypervisorJson.isEmpty()) { log.debug("Host/Guest mapping provided during hypervisor update was null."); throw new BadRequestException( i18n.tr("Host to guest mapping was not provided for hypervisor update.")); } Principal principal = this.principalProvider.get(); log.info("Hypervisor update by principal: {}", principal); Owner owner = this.getOwner(ownerKey); JobConfig config = HypervisorUpdateJob.createJobConfig() .setOwner(owner) .setData(hypervisorJson) .setCreateMissing(createMissing.booleanValue()) .setPrincipal(principal) .setReporter(reporterId); try { AsyncJobStatus status = jobManager.queueJob(config); return translator.translate(status, AsyncJobStatusDTO.class); } catch (JobException e) { String errmsg = this.i18n.tr("An unexpected exception occurred while scheduling job \"{0}\"", config.getJobKey()); log.error(errmsg, e); throw new IseException(errmsg, e); } }
Source:
<code><START> protected BigInteger calculateBalanceForAddress(Address address, boolean calculateClientSide) throws BlockStoreException { <END> maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getBalanceSelectSQL()); s.setString(1, address.toString()); ResultSet rs = s.executeQuery(); BigInteger balance = BigInteger.ZERO; while (rs.next()) { if(calculateClientSide) { balance = balance.add(new BigInteger(rs.getBytes(1))); } else { return BigInteger.valueOf(rs.getLong(1)); } } return balance; } catch (SQLException ex) { throw new BlockStoreException(ex); } finally { if (s != null) try { s.close(); } catch (SQLException e) { throw new BlockStoreException("Could not close statement"); } } }</code><technical_language>prefer convert Coin Monetary soon in method signatures etc., passing BigInteger</technical_language>

Target:
protected BigInteger calculateBalanceForAddress(Address address, boolean calculateClientSide) throws BlockStoreException { maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getBalanceSelectSQL()); s.setString(1, address.toString()); ResultSet rs = s.executeQuery(); BigInteger balance = BigInteger.ZERO; while (rs.next()) { if(calculateClientSide) { balance = balance.add(new BigInteger(rs.getBytes(1))); } else { return BigInteger.valueOf(rs.getLong(1)); } } return balance; } catch (SQLException ex) { throw new BlockStoreException(ex); } finally { if (s != null) { try { s.close(); } catch (SQLException e) { throw new BlockStoreException("Could not close statement"); } } } }
Source:
<code>protected ConfigurableObject getInputType(Object input) { <START> if (input instanceof EditPart) { input = ((EditPart) input).getModel(); } if (input instanceof ConfigurableObject) { return (ConfigurableObject) input; } <END> return null; }</code><technical_language>put this in if condition? if (input instanceof EditPart && ((EditPart) input).getModel() instanceof ConfigurableObject)</technical_language>

Target:
protected ConfigurableObject getInputType(Object input) { if (input instanceof EditPart && ((EditPart) input).getModel() instanceof ConfigurableObject) { return (ConfigurableObject) input; } return null; }
Source:
<code>protected Control getRegisteredControl() { activate(); WidgetIsFound widgetIsFound = new WidgetIsFound(org.eclipse.swt.custom.StyledText.class, cTabItem.getControl()); new WaitUntil(widgetIsFound, TimePeriod.SHORT, false); if (widgetIsFound.getResult() == null) { return null; <START> } <END> return (org.eclipse.swt.custom.StyledText) widgetIsFound.getResult(); }</code><technical_language>Please add debug message inform user console view console</technical_language>

Target:
protected Control getRegisteredControl() { activate(); WidgetIsFound widgetIsFound = new WidgetIsFound(org.eclipse.swt.custom.StyledText.class, cTabItem.getControl()); new WaitUntil(widgetIsFound, TimePeriod.SHORT, false); if (widgetIsFound.getResult() == null) { log.debug("There is no console in console view."); return null; } return (org.eclipse.swt.custom.StyledText) widgetIsFound.getResult(); }
Source:
<code>public String getResultsVisibleFromText(){ if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_VISIBLE)) { if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_OPENING)) { return TimeHelper.formatTime(bundle.feedbackSession.startTime); } else if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.sessionVisibleFromTime); } } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_LATER) || bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_NOW)) { <START> return "Unspecified (to be published manually)"; <END> } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.resultsVisibleFromTime); } }</code><technical_language>Based code change, I wrong meaning of date. means 'the moment submitted'. case of manual publishing handled already</technical_language>

Target:
public String getResultsVisibleFromText(){ if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_VISIBLE)) { if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_OPENING)) { return TimeHelper.formatTime(bundle.feedbackSession.startTime); } else if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.sessionVisibleFromTime); } } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_LATER)) { return "I want to manually publish the results."; } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.resultsVisibleFromTime); } }
Source:
<code>public List<Player> getNonreadyPlayers() { List<Player> result = new LinkedList<>(); result.addAll(lobbyPlayers); result.removeAll(readyPlayers); <START> result.sort(Comparator.comparing(Player:: getName)); <END> return result; }</code><technical_language>sorting in ArenaImpl. reason getNonreadyPlayers() returns a List a Set is of original call site in notready command, is fed a utility method stringifies a List. laziness more :P I more sense do sorting caller site in here. If else, reduces blast radius of pull request changes "collected" in signs/rendering code</technical_language>

Target:
public List<Player> getNonreadyPlayers() { List<Player> result = new LinkedList<>(); result.addAll(lobbyPlayers); result.removeAll(readyPlayers); return result; }
Source:
<code>public String getPostconditionAnnotation(VariableElement elt, AField f, List<String> preconds) { AnnotatedTypeMirror declaredType = fromElement(elt); if (!(declaredType.hasAnnotation(NULLABLE) || declaredType.hasAnnotation(POLYNULL) || declaredType.hasAnnotation(MONOTONIC_NONNULL))) { return null; } if (declaredType.hasAnnotation(MONOTONIC_NONNULL) && preconds.contains(requiresNonNullAnno(elt))) { return null; } for (scenelib.annotations.Annotation a : f.type.tlAnnotationsHere) { if (a.def.name.equals("org.checkerframework.checker.nullness.qual.NonNull")) { <START> return "@org.checkerframework.checker.nullness.qual.EnsuresNonNull(\"" <END> + elt.getSimpleName() + "\")"; } } return null; }</code><technical_language>I this ...EnsuresNonNull("this. for clarity</technical_language>

Target:
public String getPostconditionAnnotation(VariableElement elt, AField f, List<String> preconds) { AnnotatedTypeMirror declaredType = fromElement(elt); if (!(declaredType.hasAnnotation(NULLABLE) || declaredType.hasAnnotation(POLYNULL) || declaredType.hasAnnotation(MONOTONIC_NONNULL))) { return null; } if (declaredType.hasAnnotation(MONOTONIC_NONNULL) && preconds.contains(requiresNonNullAnno(elt))) { return null; } for (scenelib.annotations.Annotation a : f.type.tlAnnotationsHere) { if (a.def.name.equals("org.checkerframework.checker.nullness.qual.NonNull")) { return "@org.checkerframework.checker.nullness.qual.EnsuresNonNull(\"this." + elt.getSimpleName() + "\")"; } } return null; }
Source:
<code>public AxisService findService(MessageContext mc) throws AxisFault { AxisService service = mc.getAxisService(); if (service == null) { String to = mc.getTo().getAddress(); if (to.startsWith(mc.getConfigurationContext().getServiceContextPath())) { int tenantDelimiterIndex = to.indexOf(TENANT_PATH); if (tenantDelimiterIndex != -1) { AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration(); return ac.getService(MultitenantConstants.MULTITENANT_DISPATCHER_SERVICE); } <START> } else if (to.startsWith(TENANT_PATH)) { <END> AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration(); return ac.getService(MultitenantConstants.MULTITENANT_DISPATCHER_SERVICE); } } return service; }</code><technical_language>Instead of removing add return getService(mc);</technical_language>

Target:
public AxisService findService(MessageContext mc) throws AxisFault { AxisService service = mc.getAxisService(); if (service == null) { String to = mc.getTo().getAddress(); if (to.startsWith(mc.getConfigurationContext().getServiceContextPath())) { int tenantDelimiterIndex = to.indexOf(TENANT_PATH); if (tenantDelimiterIndex != -1) { return getService(mc); } } else if (to.startsWith(TENANT_PATH)) { return getService(mc); } } return service; }
Source:
<code>private static void appendLoginModules(XmlGenerator gen, String tag, List<LoginModuleConfig> loginModuleConfigs) { gen.open(tag); <START> for (LoginModuleConfig lm : loginModuleConfigs) { <END> List<String> attrs = new ArrayList<String>(); attrs.add("class-name"); attrs.add(lm.getClassName()); if (lm.getUsage() != null) { attrs.add("usage"); attrs.add(lm.getUsage().name()); } gen.open("login-module", attrs.toArray()) .appendProperties(lm.getProperties()) .close(); } gen.close(); }</code><technical_language>new ArrayList<></technical_language>

Target:
private static void appendLoginModules(XmlGenerator gen, String tag, List<LoginModuleConfig> loginModuleConfigs) { gen.open(tag); for (LoginModuleConfig lm : loginModuleConfigs) { List<String> attrs = new ArrayList<>(); attrs.add("class-name"); attrs.add(lm.getClassName()); if (lm.getUsage() != null) { attrs.add("usage"); attrs.add(lm.getUsage().name()); } gen.open("login-module", attrs.toArray()) .appendProperties(lm.getProperties()) .close(); } gen.close(); }
Source:
<code>public void assertRequestWithParameters() { String cron = "0 * * * * ?"; String uri = String.format("/job/myGroup/myJob?cron=%s", URLEncoder.encode(cron, "UTF-8")); String description = "Descriptions about this job."; byte[] body = description.getBytes(StandardCharsets.UTF_8); DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri, Unpooled.wrappedBuffer(body)); request.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); HttpUtil.setContentLength(request, body.length); HttpClient.request(HOST, PORT, request, httpResponse -> { assertEquals(200, httpResponse.status().code()); byte[] bytes = ByteBufUtil.getBytes(httpResponse.content()); String json = new String(bytes, StandardCharsets.UTF_8); Gson gson = new Gson(); JobPojo jobPojo = gson.fromJson(json, JobPojo.class); <START> assertEquals(cron, jobPojo.getCron()); <END> assertEquals("myGroup", jobPojo.getGroup()); assertEquals("myJob", jobPojo.getName()); assertEquals(description, jobPojo.getDescription()); }, 10000L); }</code><technical_language>assertThat</technical_language>

Target:
public void assertRequestWithParameters() { String cron = "0 * * * * ?"; String uri = String.format("/job/myGroup/myJob?cron=%s", URLEncoder.encode(cron, "UTF-8")); String description = "Descriptions about this job."; byte[] body = description.getBytes(StandardCharsets.UTF_8); DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri, Unpooled.wrappedBuffer(body)); request.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); HttpUtil.setContentLength(request, body.length); HttpClient.request(HOST, PORT, request, httpResponse -> { assertEquals(200, httpResponse.status().code()); byte[] bytes = ByteBufUtil.getBytes(httpResponse.content()); String json = new String(bytes, StandardCharsets.UTF_8); Gson gson = new Gson(); JobPojo jobPojo = gson.fromJson(json, JobPojo.class); assertThat(jobPojo.getCron(), is(cron)); assertThat(jobPojo.getGroup(), is("myGroup")); assertThat(jobPojo.getName(), is("myJob")); assertThat(jobPojo.getDescription(), is(description)); }, 10000L); }