auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Cleaning all tags.", false); for (final Player player : server.getOnlinePlayers()) { final String playerName = player.getName(); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); final String Tag = playerdata.getTag(); if (Tag != null && !Tag.isEmpty() && !Tag.equalsIgnoreCase(playerName)) { final Matcher matcher = REGEX.matcher(Tag); if (matcher.find()) { final String newTag = matcher.replaceAll(""); playerMsg(ChatColor.RESET + playerName + ": \"" + Tag + ChatColor.RESET + "\" -> \"" + newTag + ChatColor.RESET + "\"."); <START> <END> TFM_PlayerData.getPlayerData(player).setTag(newTag); } } } return true; }</code><technical_language>blank line</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Cleaning all tags.", false); for (final Player player : server.getOnlinePlayers()) { final String playerName = player.getName(); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); final String Tag = playerdata.getTag(); if (Tag != null && !Tag.isEmpty() && !Tag.equalsIgnoreCase(playerName)) { final Matcher matcher = REGEX.matcher(Tag); if (matcher.find()) { final String cleanTag = matcher.replaceAll(""); playerMsg(ChatColor.RESET + playerName + ": \"" + Tag + ChatColor.RESET + "\" -> \"" + cleanTag + ChatColor.RESET + "\"."); TFM_PlayerData.getPlayerData(player).setTag(cleanTag); } } } return true; }
Source:
<code>public IFile findFileName(String partialLoc) { if (partialLoc.equals(cachedFileName) && cachedWorkingDirectory != null && <START> org.eclipse.core.filesystem.URIUtil.equals(getWorkingDirectoryURI(), cachedWorkingDirectory)) <END> return cachedFile; IPath path = new Path(partialLoc.replace('\\', IPath.SEPARATOR)); IFile file = findFileInWorkspace(path); if (file==null) { path = path.setDevice(null); IFile[] files = null; if (fProject != null) { IProject[] prjs = new IProject[] { fProject }; files = ResourceLookup.findFilesByName(path, prjs, false); if (files.length == 0) files = ResourceLookup.findFilesByName(path, prjs, true); } if (files == null || files.length == 0) { IProject[] prjs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); files = ResourceLookup.findFilesByName(path, prjs, false); if (files.length == 0) files = ResourceLookup.findFilesByName(path, prjs, true); } if (files.length == 1) file = files[0]; } if (file==null && isCygwin && path.isAbsolute()) { file = findCygwinFile(partialLoc); } cachedFileName = partialLoc; cachedWorkingDirectory = getWorkingDirectoryURI(); cachedFile = file; return file; }</code><technical_language>Please bring braces back</technical_language>

Target:
public IFile findFileName(String partialLoc) { if (partialLoc.equals(cachedFileName) && cachedWorkingDirectory != null && org.eclipse.core.filesystem.URIUtil.equals(getWorkingDirectoryURI(), cachedWorkingDirectory)) { return cachedFile; } IPath path = new Path(partialLoc.replace('\\', IPath.SEPARATOR)); IFile file = findFileInWorkspace(path); if (file==null) { path = path.setDevice(null); IFile[] files = null; if (fProject != null) { IProject[] prjs = new IProject[] { fProject }; files = ResourceLookup.findFilesByName(path, prjs, false); if (files.length == 0) { files = ResourceLookup.findFilesByName(path, prjs, true); } } if (files == null || files.length == 0) { IProject[] prjs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); files = ResourceLookup.findFilesByName(path, prjs, false); if (files.length == 0) { files = ResourceLookup.findFilesByName(path, prjs, true); } } if (files.length == 1) { file = files[0]; } } if (file==null && isCygwin && path.isAbsolute()) { file = findCygwinFile(partialLoc); } cachedFileName = partialLoc; cachedWorkingDirectory = getWorkingDirectoryURI(); cachedFile = file; return file; }
Source:
<code>public void test_get_revision_task() throws Exception { CouchDB sourceDB = mock(CouchDB.class); String docId = "asdjfsdflkjsd"; String revId = "10-asdfsafsadf"; List<String> expected = Arrays.asList("1-a", "2-b", "3-a"); DocumentRevs.Revisions revs = new DocumentRevs.Revisions(); revs.setIds(expected); List<DocumentRevs> documentRevs = new ArrayList<DocumentRevs>(); DocumentRevs dr = new DocumentRevs(); dr.setRevisions(revs); documentRevs.add(dr); ArrayList<String> revIds = new ArrayList<String>(); revIds.add(revId); ArrayList<String> attsSince = new ArrayList<String>(); when(sourceDB.getRevisions(docId, revIds, attsSince)).thenReturn(documentRevs); GetRevisionTask task = new GetRevisionTask(sourceDB, docId, revIds, attsSince); DocumentRevsList actualDocumentRevs = task.call(); <START> verify(sourceDB).getRevisions(docId, revIds, attsSince); <END> Assert.assertEquals(expected, actualDocumentRevs.get(0).getRevisions().getIds()); }</code><technical_language>Again, cut diff noise a helper require attsSince</technical_language>

Target:
public void test_get_revision_task() throws Exception { CouchDB sourceDB = mock(CouchDB.class); String docId = "asdjfsdflkjsd"; String revId = "10-asdfsafsadf"; List<String> expected = Arrays.asList("1-a", "2-b", "3-a"); DocumentRevs.Revisions revs = new DocumentRevs.Revisions(); revs.setIds(expected); List<DocumentRevs> documentRevs = new ArrayList<DocumentRevs>(); DocumentRevs dr = new DocumentRevs(); dr.setRevisions(revs); documentRevs.add(dr); ArrayList<String> revIds = new ArrayList<String>(); revIds.add(revId); ArrayList<String> attsSince = new ArrayList<String>(); when(sourceDB.getRevisions(docId, revIds, attsSince, pullAttachmentsInline)).thenReturn(documentRevs); GetRevisionTask task = new GetRevisionTask(sourceDB, docId, revIds, attsSince, pullAttachmentsInline); DocumentRevsList actualDocumentRevs = task.call(); verify(sourceDB).getRevisions(docId, revIds, attsSince, pullAttachmentsInline); Assert.assertEquals(expected, actualDocumentRevs.get(0).getRevisions().getIds()); }
Source:
<code>private void recomputeSize() { Rectangle bounds = getShell().getBounds(); Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolledComposite.setMinSize(size); <START> setSize(size.x, Math.min(getShell().getMonitor().getClientArea().height, size.y)); <END> setLocation(new Point(bounds.x, bounds.y)); if (scrolledComposite.getVerticalBar().isVisible() && commentEditor != null) { Point commentEditorSize = commentEditor.getSize(); commentEditor.setSize(commentEditorSize.x - scrolledComposite.getVerticalBar().getSize().x, commentEditorSize.y); } if (commentEditor != null) { scrolledComposite.setOrigin(0, Integer.MAX_VALUE); } }</code><technical_language>some redundancy calling setSize here. constrain get height call getShell().setSize(width, height); scrolledComposite.setSize(width, height);</technical_language>

Target:
private void recomputeSize() { Rectangle bounds = getShell().getBounds(); Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolledComposite.setMinSize(size); int height = constrain(size.y, MIN_HEIGHT, getShell().getMonitor().getClientArea().height); getShell().setSize(size.x, height); scrolledComposite.setSize(size.x, height); setLocation(new Point(bounds.x, bounds.y)); if (scrolledComposite.getVerticalBar().isVisible() && commentEditor != null) { Point commentEditorSize = commentEditor.getSize(); commentEditor.setSize(commentEditorSize.x - scrolledComposite.getVerticalBar().getSize().x, commentEditorSize.y); } if (commentEditor != null) { scrolledComposite.setOrigin(0, Integer.MAX_VALUE); } }
Source:
<code>public void testBatchBulkGets() throws Exception { List<Get> gets = new ArrayList<>(10); <START> List<Row> responses = new ArrayList<>(9); <END> gets.add(new Get(Bytes.toBytes("key0"))); for (int i=1; i<10; i++){ byte[] row_key = randomBytes(8); gets.add(new Get(Bytes.toBytes("key"+i))); responses.add(Row.newBuilder().setKey(BigtableZeroCopyByteStringUtil.wrap(row_key)).build()); } when(mockFuture.get()).thenReturn(responses); BatchExecutor underTest = createExecutor(new BigtableOptions.Builder().setUseBulkApi(true).build()); final List<? extends org.apache.hadoop.hbase.client.Row> actions = gets; final BatchExecutor executor = underTest; Result[] results = executor.batch(actions); verify(mockAsyncExecutor, times(1)).readRowsAsync(any(ReadRowsRequest.class)); Assert.assertTrue(matchesRow(Result.EMPTY_RESULT).matches(results[0])); }</code><technical_language>10? is clear this test does. arrays length</technical_language>

Target:
public void testBatchBulkGets() throws Exception { List<Get> gets = new ArrayList<>(10); List<Row> responses = new ArrayList<>(9); gets.add(new Get(Bytes.toBytes("key0"))); for (int i = 1; i < 10; i++) { byte[] row_key = randomBytes(8); gets.add(new Get(row_key)); ByteString key = BigtableZeroCopyByteStringUtil.wrap(row_key); ByteString cellValue = ByteString.copyFrom(randomBytes(8)); com.google.bigtable.v1.Cell cell = Cell.newBuilder() .setTimestampMicros(System.nanoTime() / 1000) .setValue(cellValue) .build(); Family family = Family.newBuilder() .setName("family") .addColumns(Column.newBuilder().addCells(cell)) .build(); responses.add(Row.newBuilder().setKey(key).addFamilies(family).build()); } when(mockFuture.get()).thenReturn(responses); BatchExecutor underTest = createExecutor(new BigtableOptions.Builder().setUseBulkApi(true).build()); Result[] results = underTest.batch(gets); verify(mockAsyncExecutor, times(1)).readRowsAsync(any(ReadRowsRequest.class)); Assert.assertTrue(matchesRow(Result.EMPTY_RESULT).matches(results[0])); for (int i = 1; i < results.length; i++) { Result response = Adapters.ROW_ADAPTER.adaptResponse(responses.get(i - 1)); Assert.assertTrue(Bytes.equals(response.getRow(), results[i].getRow())); } }
Source:
<code>public void run(ActionContext context) throws Exception { Path path = new Path(config.path); FileSystem fileSystem = path.getFileSystem(new Configuration()); FileStatus[] listFiles; if (config.fileRegex != null) { PathFilter filter = new PathFilter() { private final Pattern pattern = Pattern.compile(config.fileRegex); @Override public boolean accept(Path path) { return pattern.matcher(path.getName()).matches(); } }; listFiles = fileSystem.listStatus(path, filter); } else { listFiles = fileSystem.listStatus(path); } for (FileStatus file: listFiles) { path = file.getPath(); if (!fileSystem.delete(path, true)) { if (!config.continueOnError) { throw new IOException(String.format("Removal of %s was unsuccessful.", path.toString())); } <START> LOG.error("Removal of was unsuccessful.", path.toString()); <END> } } }</code><technical_language>a warning a error</technical_language>

Target:
public void run(ActionContext context) throws Exception { Path path = new Path(config.path); FileSystem fileSystem = path.getFileSystem(new Configuration()); FileStatus[] listFiles; if (config.fileRegex != null) { PathFilter filter = new PathFilter() { private final Pattern pattern = Pattern.compile(config.fileRegex); @Override public boolean accept(Path path) { return pattern.matcher(path.getName()).matches(); } }; listFiles = fileSystem.listStatus(path, filter); } else { listFiles = fileSystem.listStatus(path); } for (FileStatus file: listFiles) { Path currPath = file.getPath(); removePath(fileSystem, currPath); } if (fileSystem.isDirectory(path) && config.fileRegex == null) { removePath(fileSystem, path); } }
Source:
<code>protected URI getExpectedDestinationUri(final KeycloakSession session) { KeycloakUriInfo info = session.getContext().getUri(); URI baseUri = info.getBaseUri(); <START> return info.getAbsolutePathBuilder().scheme(baseUri.getScheme()).host(baseUri.getHost()).port(baseUri.getPort()).build(); <END> }</code><technical_language>This is work Keycloak exposed a context-path reverse proxy. I.e. frontendUrl "<LINK_0>" while Keycloak is listening "<LINK_1>"</technical_language>

Target:
protected URI getExpectedDestinationUri(final KeycloakSession session) { final String realmName = session.getContext().getRealm().getName(); final URI baseUri = session.getContext().getUri().getBaseUri(); return Urls.samlRequestEndpoint(baseUri, realmName); }
Source:
<code><START> public WrapLayoutRow(List<Component> components, List<Component> oppositeAligned, int height, int width) { <END> this.components = components; this.oppositeAligned = oppositeAligned; this.height = height; this.width = width; }</code><technical_language>public constructor in private class package level constructor</technical_language>

Target:
WrapLayoutRow(List<Component> components, List<Component> oppositeAligned, int height, int width) { this.components = components; this.oppositeAligned = oppositeAligned; this.height = height; this.width = width; }
Source:
<code>public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin,":"); String rsType = st.nextToken(); <START> if ("monetaryunitfix".equalsIgnoreCase(rsType)) { <END> BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } String preferedFiatCurrency = FiatCurrency.USD.getCode(); if (st.hasMoreTokens()) { preferedFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate,preferedFiatCurrency); } else if ("coinmarketcap".equalsIgnoreCase(rsType)) { String preferredFiatCurrency = FiatCurrency.USD.getCode(); String apiKey = null; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } if (st.hasMoreTokens()) { apiKey = st.nextToken(); } return new CoinmarketcapRateSource(apiKey, preferredFiatCurrency); } } return null; }</code><technical_language>needed universal fix price rate source is instantiated in Bitcoin Extension</technical_language>

Target:
public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin,":"); String rsType = st.nextToken(); if ("coinmarketcap".equalsIgnoreCase(rsType)) { String preferredFiatCurrency = FiatCurrency.USD.getCode(); String apiKey = null; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } if (st.hasMoreTokens()) { apiKey = st.nextToken(); } return new CoinmarketcapRateSource(apiKey, preferredFiatCurrency); } else if ("coingecko".equalsIgnoreCase(rsType)) { String preferredFiatCurrency = st.hasMoreTokens() ? st.nextToken().toUpperCase() : FiatCurrency.USD.getCode(); return new CoinGeckoRateSource(preferredFiatCurrency); } else if ("coinpaprika".equalsIgnoreCase(rsType)) { String preferredFiatCurrency = st.hasMoreTokens() ? st.nextToken().toUpperCase() : FiatCurrency.USD.getCode(); return new CoinPaprikaRateSource(preferredFiatCurrency); } } return null; }
Source:
<code>public <START> RemoveUnregisteredEntityParameters() <END> { this.setEntityId(Guid.Empty); this.setStorageDomainId(Guid.Empty); this.setStoragePoolId(Guid.Empty); }</code><technical_language>1) move no-arg C'tor C'tor. 2) nice if call 3-arg C'tor: this(Guid.Empty, Guid.Empty, Guid.Empty);</technical_language>

Target:
public RemoveUnregisteredEntityParameters() { this(Guid.Empty, Guid.Empty, Guid.Empty); }
Source:
<code>protected void onScrolled(int oldScrollY, int scrollY) { <START> int opacity = fadeEnabled && scrollY < (pageFragment.getHeaderView().getHeight() - toolbarHeight) ? 0 : FULL_OPACITY; <END> toolbarBackground.setAlpha(opacity); updateChildIconTint(toolbar, opacity); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { pageFragment.requireActivity().getWindow() .setStatusBarColor(calculateStatusBarTintForOpacity(opacity)); } }</code><technical_language>Instead of getHeaderView().getHeight(), DimenUtil.leadImageHeightForDevice()? I fix it</technical_language>

Target:
protected void onScrolled(int oldScrollY, int scrollY) { int opacity = fadeEnabled && scrollY < (DimenUtil.leadImageHeightForDevice() - toolbarHeight) ? 0 : FULL_OPACITY; toolbarBackground.setAlpha(opacity); updateChildIconTint(toolbar, opacity); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { pageFragment.requireActivity().getWindow() .setStatusBarColor(calculateStatusBarTintForOpacity(opacity)); } }
Source:
<code>private static IndexDefinition tryParseBitmap(String definition, boolean ordered) { String[] parts = ARROW_PATTERN.split(definition); if (parts.length == 1) { return null; } if (parts.length != 2) { throw new IllegalArgumentException("Invalid bitmap index definition: " + definition); } parts[0] = canonicalizeAttribute(parts[0]); parts[1] = canonicalizeAttribute(parts[1]); if (parts[0].isEmpty() || parts[1].isEmpty() || parts[0].equals(parts[1])) { throw new IllegalArgumentException("Invalid bitmap index definition: " + definition); } if (parts[0].contains(",") || parts[1].contains(",")) { throw new IllegalArgumentException("Composite bitmap indexes are not supported: " + definition); } <START> return new IndexDefinition(parts[0] + " -> " + parts[1], ordered, parts[1], parts[0]); <END> }</code><technical_language>pass ordered flag index definition here. time, for ordered bitmap indexes supported, exception is thrown IndexImpl.createIndexStore afterwards. sense throw exception earlier? E.g. IndexDefinition.tryParseBitmap MapIndexConfig.validateIndexAttribute, i.e. distributed operation is triggered</technical_language>

Target:
private static IndexDefinition tryParseBitmap(String definition, boolean ordered) { if (definition == null || !definition.toUpperCase().startsWith(BITMAP_PREFIX)) { return null; } if (!definition.endsWith(BITMAP_POSTFIX)) { throw makeInvalidBitmapIndexDefinitionException(definition); } String innerText = definition.substring(BITMAP_PREFIX.length(), definition.length() - 1); String[] parts = COMMA_PATTERN.split(innerText, -1); if (parts.length == 0 || parts.length > 3) { throw makeInvalidBitmapIndexDefinitionException(definition); } String attribute = canonicalizeAttribute(parts[0]); String uniqueKey = parts.length >= 2 ? canonicalizeAttribute(parts[1]) : KEY_ATTRIBUTE_NAME.value(); UniqueKeyTransform uniqueKeyTransform = parts.length == 3 ? UniqueKeyTransform.parse(parts[2]) : UniqueKeyTransform.OBJECT; if (attribute.isEmpty() || uniqueKey.isEmpty() || attribute.equals(uniqueKey)) { throw makeInvalidBitmapIndexDefinitionException(definition); } String canonicalName = BITMAP_PREFIX + attribute + ", " + uniqueKey + ", " + uniqueKeyTransform + BITMAP_POSTFIX; return new IndexDefinition(canonicalName, ordered, uniqueKey, uniqueKeyTransform, attribute); }
Source:
<code>public void assertSameContentAs(AssertionInfo info, File actual, File expected) { verifyIsFile(expected); assertIsFile(info, actual); BinaryDiffResult binaryDiffResult = null; try { binaryDiffResult = binaryDiff.diff(actual, java.nio.file.Files.readAllBytes(expected.toPath())); if (binaryDiffResult.hasNoDiff()) return; List<Delta<String>> diffs = diff.diff(actual, expected); if (diffs.isEmpty()) return; throw failures.failure(info, shouldHaveSameContent(actual, expected, diffs)); } catch (MalformedInputException e) { <START> throw failures.failure(info, shouldHaveBinaryContent(actual, binaryDiffResult)); <END> } catch (IOException e) { String msg = String.format("Unable to compare contents of files:<%s> and:<%s>", actual, expected); throw new RuntimeIOException(msg, e); } }</code><technical_language>I is correct return shouldHaveBinaryContent failure, read file content, I treated IOException. WDYT ? If get rid of catch block, binary comparison a liner</technical_language>

Target:
public void assertSameContentAs(AssertionInfo info, File actual, File expected) { verifyIsFile(expected); assertIsFile(info, actual); BinaryDiffResult binaryDiffResult = null; try { binaryDiffResult = binaryDiff.diff(actual, readAllBytes(expected.toPath())); if (binaryDiffResult.hasNoDiff()) return; List<Delta<String>> diffs = diff.diff(actual, expected); if (diffs.isEmpty()) return; throw failures.failure(info, shouldHaveSameContent(actual, expected, diffs)); } catch (MalformedInputException e) { throw failures.failure(info, shouldHaveBinaryContent(actual, binaryDiffResult)); } catch (IOException e) { String msg = String.format("Unable to compare contents of files:<%s> and:<%s>", actual, expected); throw new RuntimeIOException(msg, e); } }
Source:
<code>public void prepare(Object configurationObject) { synchronized (this) { try { if (this.objectMapper == null) <START> this.objectMapper = new ObjectMapper(); <END> if (this.amazonS3Client == null) { AWSCredentials credentials = new BasicAWSCredentials(s3WriterConfiguration.getKey(), s3WriterConfiguration.getSecretKey()); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.valueOf(s3WriterConfiguration.getProtocol().toString())); S3ClientOptions clientOptions = new S3ClientOptions(); clientOptions.setPathStyleAccess(false); this.amazonS3Client = new AmazonS3Client(credentials, clientConfig); if (!Strings.isNullOrEmpty(s3WriterConfiguration.getRegion())) this.amazonS3Client.setRegion(Region.getRegion(Regions.fromName(s3WriterConfiguration.getRegion()))); this.amazonS3Client.setS3ClientOptions(clientOptions); } } catch (Exception e) { LOGGER.error("Exception while preparing the S3 client: {}", e); } Preconditions.checkArgument(this.amazonS3Client != null); } }</code><technical_language>is reason for StreamsJacksonMapper</technical_language>

Target:
public void prepare(Object configurationObject) { synchronized (this) { try { if (this.objectMapper == null) this.objectMapper = new StreamsJacksonMapper(); if (this.amazonS3Client == null) { AWSCredentials credentials = new BasicAWSCredentials(s3WriterConfiguration.getKey(), s3WriterConfiguration.getSecretKey()); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.valueOf(s3WriterConfiguration.getProtocol().toString())); S3ClientOptions clientOptions = new S3ClientOptions(); clientOptions.setPathStyleAccess(false); this.amazonS3Client = new AmazonS3Client(credentials, clientConfig); if (!Strings.isNullOrEmpty(s3WriterConfiguration.getRegion())) this.amazonS3Client.setRegion(Region.getRegion(Regions.fromName(s3WriterConfiguration.getRegion()))); this.amazonS3Client.setS3ClientOptions(clientOptions); } } catch (Exception e) { LOGGER.error("Exception while preparing the S3 client: {}", e); } Preconditions.checkArgument(this.amazonS3Client != null); } }
Source:
<code>protected void afterResourceSaved(ResourceManager mgr, CommandContext context, File resourceFile, SaveReceipt receipt) { String payload = receipt.getPayload(); if (payload != null) { if (payload.contains("cache-size") && context.getAdminManager() != null) { if (logger.isDebugEnabled()) { logger.info("Group payload contains cache-size parameter, so waiting for ML to restart"); } context.getAdminManager().waitForRestart(); } Fragment xml = new Fragment(payload); String groupName = xml.getElementValue("/m:group-properties/m:group-name"); <START> String adminServerPayload = format(ADMIN_SERVER_UPDATE_JSON_TEMPLATE, ADMIN_SERVER_NAME, groupName); <END> ServerManager serverMgr = new ServerManager(context.getManageClient(), groupName); serverMgr.save(adminServerPayload); } }</code><technical_language>I forgot mention this - a class for resource, classes a getJson method. do: Server s = new Server(null, "Admin"); // API param needed for this s.setUrlRewriter("whatever"); s.getJson(); I for commands setters for conceivably change. thinking this - declare a private variable of "private Server adminServerTemplate", constructor for this command initializes a server-name of "Admin" url-rewriter value. add a setter for a client modify Admin object is created (e.g. if user wants a authentication it)</technical_language>

Target:
protected void afterResourceSaved(ResourceManager mgr, CommandContext context, File resourceFile, SaveReceipt receipt) { String payload = receipt.getPayload(); if (payload != null) { if (payload.contains("cache-size") && context.getAdminManager() != null) { if (logger.isDebugEnabled()) { logger.info("Group payload contains cache-size parameter, so waiting for ML to restart"); } context.getAdminManager().waitForRestart(); } String groupName = new PayloadParser().getPayloadFieldValue(payload, "group-name", true); ServerManager serverMgr = new ServerManager(context.getManageClient(), groupName); serverMgr.save(adminServerTemplate.getJson()); } }
Source:
<code><START> protected void internalSetVariable(final String name, final Object content) { <END> if (!JVMCompiledHelper.isSaveName(name)) throw new RuntimeException("\"" + name + "\" is not a valid Scala variable name"); }</code><technical_language>setting a variable a native engine register variable in a map. is more do a variable. do need check for save names either</technical_language>

Target:
protected void internalSetVariable(final String name, final Object content) { }
Source:
<code>private String[] getTopologyDef(ClusterConfig clusterConfig) { String[] topologyDef; String topologyDefInConfig = clusterConfig.getTopology(); if (topologyDefInConfig == null) { throw new HelixException(String.format("The topology of cluster %s is empty!", clusterConfig.getClusterName())); } <START> topologyDef = Arrays.asList(topologyDefInConfig.trim().split(DELIMITER)).stream() <END> .filter(str -> !str.isEmpty()).collect(Collectors.toList()).toArray(new String[0]); if (topologyDef.length == 0) { throw new HelixException(String.format("The topology of cluster %s is not correctly defined", clusterConfig.getClusterName())); } return topologyDef; }</code><technical_language>example I gave Xiaoyuan for Topology.java change, "/group/ zone/ rack /host", do accept this one? current logic, I return "["group", " zone", " rack ", "host"]". Please mind space in keys. a mismatch in algorithm</technical_language>

Target:
private String[] getTopologyDef(ClusterConfig clusterConfig) { String[] topologyDef; String topologyDefInConfig = clusterConfig.getTopology(); if (topologyDefInConfig == null || !topologyDefInConfig.trim().startsWith(DELIMITER)) { throw new HelixException(String.format("The topology of cluster %s is invalid!", clusterConfig.getClusterName())); } topologyDef = Arrays.asList(topologyDefInConfig.split(DELIMITER)).stream().map(str -> str.trim()) .filter(str -> !str.isEmpty()).collect(Collectors.toList()).toArray(new String[0]); if (topologyDef.length == 0) { throw new HelixException(String.format("The topology of cluster %s is not correctly defined", clusterConfig.getClusterName())); } return topologyDef; }
Source:
<code>public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { final Material mat = adjacentBlockState.getMaterial(); <START> if (mat == Material.GLASS || mat == Materials.GLASS) { <END> if (adjacentBlockState.getRenderType() == state.getRenderType()) { return true; } } return super.isSideInvisible(state, adjacentBlockState, side); }</code><technical_language>I this hella confusing. Material vs. Materials :-D</technical_language>

Target:
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { final Material mat = adjacentBlockState.getMaterial(); if (mat == Material.GLASS || mat == AEMaterials.GLASS) { if (adjacentBlockState.getRenderType() == state.getRenderType()) { return true; } } return super.isSideInvisible(state, adjacentBlockState, side); }
Source:
<code>public Network update(Network incoming) { org.ovirt.engine.core.common.businessentities.Network network = map(incoming, map(get())); network.getCluster().setnetwork_id(network.getId()); network.getCluster().setcluster_id(cluster.getVDSGroup().getId()); performAction(VdcActionType.UpdateNetworkOnCluster, <START> new NetworkClusterAttachmentParameters(network.getCluster())); <END> return get(); }</code><technical_language>UpdateNetworkOnClusterParameters NetworkClusterAttachmentParameters</technical_language>

Target:
public Network update(Network incoming) { org.ovirt.engine.core.common.businessentities.Network network = map(incoming, map(get())); network.getCluster().setnetwork_id(network.getId()); network.getCluster().setcluster_id(cluster.getVDSGroup().getId()); performAction(VdcActionType.UpdateNetworkOnCluster, new NetworkClusterParameters(network.getCluster())); return get(); }
Source:
<code>private static void initFacets(@CheckForNull Fingerprint fingerprint){ if (fingerprint==null) return; <START> for (FingerprintFacet facet : fingerprint.facets) <END> facet._setOwner(fingerprint); }</code><technical_language>Please add curlies</technical_language>

Target:
private static void initFacets(@CheckForNull Fingerprint fingerprint) { if (fingerprint == null) { return; } for (FingerprintFacet facet : fingerprint.facets) { facet._setOwner(fingerprint); } }
Source:
<code>public Set<StreamPartition<Integer>> getAssignment() { Set<TopicPartition> topicPartitions = consumer.assignment(); return topicPartitions .stream() <START> .map((TopicPartition e) -> new StreamPartition<>(e.topic(), e.partition())) <END> .collect(Collectors.toSet()); }</code><technical_language>need (TopicPartition e) here, 'e' sufficient</technical_language>

Target:
public Set<StreamPartition<Integer>> getAssignment() { Set<TopicPartition> topicPartitions = consumer.assignment(); return topicPartitions .stream() .map(e -> new StreamPartition<>(e.topic(), e.partition())) .collect(Collectors.toSet()); }
Source:
<code>public TMapImportDefinition buildMapImportDefinition(String key, Object object) { <START> if (!Objects.nonNull(object)) return null; <END> TMapImportDefinition mapImportDefinition = new TMapImportDefinition(); mapImportDefinition.put(key, buildImportDefinition(object)); return mapImportDefinition; }</code><technical_language>!Objects.nonNull(object) Objects.isNull(object)</technical_language>

Target:
public TMapImportDefinition buildMapImportDefinition(String key, Object object) { if (Objects.isNull(object)) return null; TMapImportDefinition mapImportDefinition = new TMapImportDefinition(); mapImportDefinition.put(key, buildImportDefinition(object)); return mapImportDefinition; }
Source:
<code>public Module(NinjaProperties ninjaProperties) { if(ninjaProperties == null) { <START> throw new IllegalArgumentException("null properties"); <END> } this.ninjaProperties = ninjaProperties; }</code><technical_language>Please Preconditions Guava (checkNotNull similar). please print out a error message. for rare case wrong this a lot find problem asap... :)</technical_language>

Target:
public Module(NinjaProperties ninjaProperties) { if(ninjaProperties == null) { throw new IllegalArgumentException("Received null as an instance of NinjaProperties"); } this.ninjaProperties = ninjaProperties; }
Source:
<code>public List<ContactTrackingSummaryByCampaignReport> getSummaryByCampaign(String accessToken, String contactId) throws ConstantContactServiceException{ List<ContactTrackingSummaryByCampaignReport> summary = null; try { StringBuilder sb = new StringBuilder(); sb.append(Config.Endpoints.BASE_URL).append(String.format(Config.Endpoints.CONTACTS_TRACKING_REPORTS_BY_CAMPAIGN_SUMMARY, contactId)); String url = sb.toString(); CUrlResponse response = getRestClient().get(url, accessToken); if (response.hasData()) { summary = Component.listFromJSON(response.getBody(), ContactTrackingSummaryByCampaignReport.class); } if (response.isError()) { ConstantContactServiceException constantContactException = new ConstantContactServiceException( ConstantContactServiceException.RESPONSE_ERR_SERVICE); response.getInfo().add(new CUrlRequestError("url", url)); constantContactException.setErrorInfo(response.getInfo()); throw constantContactException; } } catch (ConstantContactServiceException e) { <START> throw new ConstantContactServiceException(e); <END> } catch (Exception e) { throw new ConstantContactServiceException(e); } return summary; }</code><technical_language>ConstantContactServiceException, re-throw it</technical_language>

Target:
public List<ContactTrackingSummaryByCampaignReport> getSummaryByCampaign(String accessToken, String contactId) throws ConstantContactServiceException{ List<ContactTrackingSummaryByCampaignReport> summary = null; try { StringBuilder sb = new StringBuilder(); sb.append(Config.Endpoints.BASE_URL).append(String.format(Config.Endpoints.CONTACTS_TRACKING_REPORTS_BY_CAMPAIGN_SUMMARY, contactId)); String url = sb.toString(); CUrlResponse response = getRestClient().get(url, accessToken); if (response.hasData()) { summary = Component.listFromJSON(response.getBody(), ContactTrackingSummaryByCampaignReport.class); } if (response.isError()) { ConstantContactServiceException constantContactException = new ConstantContactServiceException( ConstantContactServiceException.RESPONSE_ERR_SERVICE); response.getInfo().add(new CUrlRequestError("url", url)); constantContactException.setErrorInfo(response.getInfo()); throw constantContactException; } } catch (Exception e) { throw new ConstantContactServiceException(e); } return summary; }
Source:
<code>public Issue getUpstreamIssue(final PullRequest pullRequest) throws NotFoundException, MalformedURLException { <START> Objects.requireNonNull(pullRequest, "url cannot be null"); <END> checkIssueTrackerExists(); if (this.isUpstreamRequired(pullRequest)) { final String body = pullRequest.getBody(); final String[] url = extractURLs(body, UPSTREAM_ISSUE, false); if (url == null || url.length == 0 || url[0] == null) return null; else return getIssue(new URL(url[0])); } else { return null; } }</code><technical_language>incorrect message "url null"</technical_language>

Target:
public Issue getUpstreamIssue(final PullRequest pullRequest) throws NotFoundException, MalformedURLException { Objects.requireNonNull(pullRequest, "pull request cannot be null"); checkIssueTrackerExists(); if (this.isUpstreamRequired(pullRequest)) { final String body = pullRequest.getBody(); final String[] url = extractURLs(body, UPSTREAM_ISSUE, false); if (url == null || url.length == 0 || url[0] == null) return null; else return getIssue(new URL(url[0])); } else { return null; } }
Source:
<code>public void report() { DSeries request = new DSeries(); addGaugesAndUnregisterOnException(request); counters.values().forEach(request::addCounter); meters.values().forEach(request::addMeter); int totalMetrics = request.getSeries().size(); int fromIndex = 0; while (fromIndex < totalMetrics) { int toIndex = Math.min(fromIndex + maxMetricsPerRequestValue, totalMetrics); try { client.send(new DSeries(request.getSeries().subList(fromIndex, toIndex))); } catch (SocketTimeoutException e) { LOGGER.warn("Failed reporting metrics to Datadog because of socket timeout: {}", e.getMessage()); } catch (Exception e) { LOGGER.warn("Failed reporting metrics to Datadog.", e); } fromIndex = toIndex; } LOGGER.debug("Reported series with size {}.", totalMetrics); <START> counters.values().forEach(DCounter::ackReport); <END> }</code><technical_language>yes; if exception occurred for a sublist contained a counter ack it. a quick solution (which is hacky, I do want this in 1.11.0), add a no-op DMetric#ackReport() method is overridden DCounter. ack in try section iterating DSeries</technical_language>

Target:
public void report() { DSeries request = new DSeries(); addGaugesAndUnregisterOnException(request); counters.values().forEach(request::addCounter); meters.values().forEach(request::addMeter); int totalMetrics = request.getSeries().size(); int fromIndex = 0; while (fromIndex < totalMetrics) { int toIndex = Math.min(fromIndex + maxMetricsPerRequestValue, totalMetrics); try { DSeries chunk = new DSeries(request.getSeries().subList(fromIndex, toIndex)); client.send(chunk); chunk.getSeries().forEach(DMetric::ackReport); LOGGER.debug("Reported series with size {}.", chunk.getSeries().size()); } catch (SocketTimeoutException e) { LOGGER.warn("Failed reporting metrics to Datadog because of socket timeout: {}", e.getMessage()); } catch (Exception e) { LOGGER.warn("Failed reporting metrics to Datadog.", e); } fromIndex = toIndex; } }
Source:
<code>public void testImportElementOnlyAppearsInTopLevel() throws IOException { File config1 = createConfigFile("hz1", ".yaml"); FileOutputStream os1 = new FileOutputStream(config1); String config1Yaml = "" + "hazelcast-client:\n" + " instance-name: my-instance"; writeStringToStreamAndClose(os1, config1Yaml); String yaml = "" + "hazelcast-client:\n" + " network:\n" + " import:\n" + " - file:/ ClientConfig clientConfig = buildConfig(yaml); <START> assertNotEquals("my-instance", clientConfig.getInstanceName()); <END> }</code><technical_language>Minor: check is expected here</technical_language>

Target:
public void testImportElementOnlyAppearsInTopLevel() throws IOException { File config1 = createConfigFile("hz1", ".yaml"); FileOutputStream os1 = new FileOutputStream(config1); String config1Yaml = "" + "hazelcast-client:\n" + " instance-name: my-instance"; writeStringToStreamAndClose(os1, config1Yaml); String yaml = "" + "hazelcast-client:\n" + " network:\n" + " import:\n" + " - file:/ ClientConfig clientConfig = buildConfig(yaml); assertNull(clientConfig.getInstanceName()); }
Source:
<code>public boolean isNewerJenkinsServer() { <START> return Type.JENKINS.equals(type) && HudsonServerInfo.JENKINS_1_511.compareTo(version) < 0; <END> }</code><technical_language>need qualify access JENKINS_1_511 type name</technical_language>

Target:
public boolean isNewerJenkinsServer() { return Type.JENKINS.equals(type) && JENKINS_1_511.compareTo(version) < 0; }
Source:
<code>protected AnyFieldRegexFilter(final Builder builder) { <START> super("*", builder.filter); <END> pattern = Pattern.compile(filter.trim()); }</code><technical_language>*</technical_language>

Target:
protected AnyFieldRegexFilter(final Builder builder) { super(".*", builder.filter); pattern = Pattern.compile(filter.trim()); }
Source:
<code>public ListenableFuture<R> apply(T argument) { <START> checkState(!closed, "AsyncTimelockRefresher is already shut down"); <END> SettableFuture<R> result = SettableFuture.create(); buffer.publishEvent((refresh, sequence) -> { refresh.result = result; refresh.argument = argument; }); return result; }</code><technical_language>nit: artifact of this written (this is RBTS)</technical_language>

Target:
public ListenableFuture<R> apply(T argument) { checkState(!closed, "Autobatcher is already shut down"); SettableFuture<R> result = SettableFuture.create(); buffer.publishEvent((refresh, sequence) -> { refresh.result = result; refresh.argument = argument; }); return result; }
Source:
<code>public void initChannel(SocketChannel socket) throws IOException, NoSuchAlgorithmException, CertificateException { ChannelPipeline pipeline = socket.pipeline(); if(enableSSL) { SslHandler sslHandler = sslBuilder.build(socket.alloc()); pipeline.addLast(SSL_HANDLER, sslHandler); } pipeline.addLast(idleExecutorGroup, IDLESTATE_HANDLER, new IdleStateHandler(clientInactivityTimeoutSeconds, IDLESTATE_WRITER_IDLE_TIME_SECONDS , clientInactivityTimeoutSeconds)); pipeline.addLast(BEATS_ACKER, new AckEncoder()); pipeline.addLast(KEEP_ALIVE_HANDLER, new KeepAliveHandler()); pipeline.addLast(BEATS_PARSER, new BeatsParser()); <START> pipeline.addLast(new DefaultEventExecutorGroup(DEFAULT_BEATS_HANDLER_THREAD), BEATS_HANDLER, new BeatsHandler(this.message)); <END> }</code><technical_language>Need create ExecutorGroup in created idleExecutorGroup, new connection create executor group</technical_language>

Target:
public void initChannel(SocketChannel socket) throws IOException, NoSuchAlgorithmException, CertificateException { ChannelPipeline pipeline = socket.pipeline(); if(enableSSL) { SslHandler sslHandler = sslBuilder.build(socket.alloc()); pipeline.addLast(SSL_HANDLER, sslHandler); } pipeline.addLast(idleExecutorGroup, IDLESTATE_HANDLER, new IdleStateHandler(clientInactivityTimeoutSeconds, IDLESTATE_WRITER_IDLE_TIME_SECONDS , clientInactivityTimeoutSeconds)); pipeline.addLast(BEATS_ACKER, new AckEncoder()); pipeline.addLast(KEEP_ALIVE_HANDLER, new KeepAliveHandler()); pipeline.addLast(BEATS_PARSER, new BeatsParser()); pipeline.addLast(beatsHandlerExecutorGroup, BEATS_HANDLER, new BeatsHandler(this.message)); }
Source:
<code>public void updateNewVendorStatusInPaymentWorks(List<PaymentWorksNewVendorUpdateVendorStatus> paymentWorksUpdateNewVendorStatus) { String jsonString = new PaymentWorksUtil().pojoToJsonString(paymentWorksUpdateNewVendorStatus); Client client = buildClient(); String URL = (new StringBuilder(getPaymentworksApiUrl()).append(NEW_VENDOR_REQUEST_UPDATE_STATUS)).toString(); LOG.info("updateNewVendorStatusInPaymentWorks. json string: " + jsonString); ClientResponse response = client.handle(buildClientRequest(URL, jsonString)); LOG.debug("updateNewVendorStatusInPaymentWorks, Status: " + response.getStatus()); if (response.getStatus() == 200) { LOG.debug("updateNewVendorStatusInPaymentWorks, New Vendor Request status updated"); } else { <START> LOG.error("updateNewVendorStatusInPaymentWorks, Failed to update New Vendor Request status: " + response.getEntity(String.class)); <END> } }</code><technical_language>again, logging error is sufficient</technical_language>

Target:
public void updateNewVendorStatusInPaymentWorks( List<PaymentWorksNewVendorUpdateVendorStatus> paymentWorksUpdateNewVendorStatus) { String jsonString = getPaymentWorksUtilityService().pojoToJsonString(paymentWorksUpdateNewVendorStatus); Client client = buildClient(); String URL = (new StringBuilder(getPaymentworksApiUrl()).append(NEW_VENDOR_REQUEST_UPDATE_STATUS)).toString(); LOG.info("updateNewVendorStatusInPaymentWorks. json string: " + jsonString); ClientResponse response = client.handle(buildClientRequest(URL, jsonString)); if (response.getStatus() == HttpURLConnection.HTTP_OK) { LOG.debug("updateNewVendorStatusInPaymentWorks, New Vendor Request status updated"); } else { LOG.error("updateNewVendorStatusInPaymentWorks, Failed to update New Vendor Request status: " + response.getEntity(String.class)); throw new RuntimeException("Unable to update new vendor status in PaymentWorks"); } }
Source:
<code>public void showShipMenu(final Spaceship ship) { final CharSequence orders[] = new CharSequence[]{ SpacecraftOrder.MOVE.name(), SpacecraftOrder.ATTACK.name(), SpacecraftOrder.COLONISE.name(), SpacecraftOrder.ENTER_WORMHOLE.name() }; AlertDialog.Builder builder = new AlertDialog.Builder(ctxt); builder.setTitle(ship.getClass().getSimpleName()); builder.setItems(orders, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: selectedShip = ship; SELECT_MODE = (selectedShip != null) ? 1 : 0; CURRENTLY_ORDERING = true; break; case 1: setSelectedShipForOnClick(); UnitActions.attackSystem(selectedShip, globalGameData); break; case 2: setSelectedShipForOnClick(); if (selectedShip instanceof ColonyShip) { if (sectors[currentX][currentY].hasSystem()) { if (!sectors[currentX][currentY].getSystem().hasOwner()) { selectedShip.clearCourse(); ((ColonyShip) selectedShip).colonise(); makeToast("Colonising..."); } else { showError("This system is already colonised " + sectors[currentX][currentY].getSystem().getOwner()); } } else { showError("This system cannot be colonised"); } } break; case 3: setSelectedShipForOnClick(); Sector selectedSector = getSelectedSector(currentX, currentY); if (selectedSector instanceof Wormhole) { selectedShip.enterWormhole(); makeToast("Entering wormhole"); } else { makeToast("No wormhole to enter"); } <START> <END> default: Log.wtf("Clicked ", "" + which); } } }); AlertDialog shipDialog = builder.create(); int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT; shipDialog.getWindow().setLayout(100, WRAP_CONTENT); shipDialog.show(); sound_yessir.start(); }</code><technical_language>This blank line (624) is unnecessary</technical_language>

Target:
public void showShipMenu(final Spaceship ship) { final CharSequence orders[] = new CharSequence[]{ SpacecraftOrder.MOVE.name(), SpacecraftOrder.ATTACK.name(), SpacecraftOrder.COLONISE.name(), SpacecraftOrder.ENTER_WORMHOLE.name() }; AlertDialog.Builder builder = new AlertDialog.Builder(ctxt); builder.setTitle(ship.getClass().getSimpleName()); builder.setItems(orders, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { orderShip(ship, which); } }); AlertDialog shipDialog = builder.create(); int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT; shipDialog.getWindow().setLayout(100, WRAP_CONTENT); shipDialog.show(); sound_yessir.start(); }
Source:
<code>public BugzillaRestRepositorySettingsPage(TaskRepository taskRepository, AbstractRepositoryConnector connector, AbstractRepositoryConnectorUi connectorUi) { <START> super("Bugzilla REST Repository Settings", DESCRIPTION, taskRepository, connector == null <END> ? (BugzillaRestConnector.getDefault() == null ? new BugzillaRestConnector() : BugzillaRestConnector.getDefault()) : connector, connectorUi == null ? new BugzillaRestRepositoryConnectorUi() : connectorUi); setNeedsAnonymousLogin(true); setNeedsValidateOnFinish(true); }</code><technical_language>pass parameters instead of null checks</technical_language>

Target:
public BugzillaRestRepositorySettingsPage(TaskRepository taskRepository, AbstractRepositoryConnector connector, AbstractRepositoryConnectorUi connectorUi) { super("Bugzilla REST Repository Settings", DESCRIPTION, taskRepository, connector, connectorUi); setNeedsAnonymousLogin(true); setNeedsValidateOnFinish(true); }
Source:
<code>public void doSystemCancel_chargeStatusDuringAuthorisation_DoesNotNeedCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; Long gatewayAccountId = nextLong(); ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(false); when(mockChargeDao.findByExternalIdAndGatewayAccount(externalChargeId, gatewayAccountId)).thenReturn(Optional.of(chargeEntity)); chargeCancelService.doSystemCancel(externalChargeId, gatewayAccountId); verify(mockPaymentProvider, never()).cancel(any()); verify(chargeService).transitionChargeState(externalChargeId, SYSTEM_CANCELLED); <START> verifyNoMoreInteractions(ignoreStubs(mockChargeDao)); <END> }</code><technical_language>purpose for verifying interactions mockChargeDao</technical_language>

Target:
public void doSystemCancel_chargeStatusDuringAuthorisation_DoesNotNeedCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; Long gatewayAccountId = nextLong(); ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(false); when(mockChargeDao.findByExternalIdAndGatewayAccount(externalChargeId, gatewayAccountId)).thenReturn(Optional.of(chargeEntity)); chargeCancelService.doSystemCancel(externalChargeId, gatewayAccountId); verify(mockPaymentProvider, never()).cancel(any()); verify(chargeService).transitionChargeState(externalChargeId, SYSTEM_CANCELLED); }