auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testReplicationRefreshSource() throws Exception { for (int i = 0; i < BATCH; i++) { byte[] r = Bytes.toBytes(i); table1.put(new Put(r).addColumn(famName, famName, r)); } Optional<RegionServerThread> server = UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads() .stream() .filter(rst -> CollectionUtils.isNotEmpty(rst.getRegionServer().getRegions(tablename))) .findAny(); Assert.assertTrue(server.isPresent()); server.get().getRegionServer().abort("stopping for test"); UTIL1.waitFor(60000, () -> UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads().size() == NUM_SLAVES1 - 1); UTIL1.waitTableAvailable(tablename); Replication replication = (Replication) UTIL1.getMiniHBaseCluster() .getLiveRegionServerThreads().get(0).getRegionServer().getReplicationSourceService(); UTIL1.waitFor(60000, () -> !replication.getReplicationManager().getOldSources().isEmpty()); <START> hbaseAdmin.disableReplicationPeer(PEER_ID2); <END> LOG.info("has replicated rows before disable peer", checkReplicationData()); hbaseAdmin.enableReplicationPeer(PEER_ID2); UTIL2.waitFor(30000, () -> { int count = checkReplicationData(); LOG.info("Waiting all logs pushed to slave. Expected , actual {}", BATCH, count); return count == BATCH; }); }</code><technical_language>assert failed if this fix</technical_language>

Target:
public void testReplicationRefreshSource() throws Exception { for (int i = 0; i < BATCH; i++) { byte[] r = Bytes.toBytes(i); table1.put(new Put(r).addColumn(famName, famName, r)); } Optional<RegionServerThread> server = UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads() .stream() .filter(rst -> CollectionUtils.isNotEmpty(rst.getRegionServer().getRegions(tablename))) .findAny(); Assert.assertTrue(server.isPresent()); server.get().getRegionServer().abort("stopping for test"); UTIL1.waitFor(60000, () -> UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads().size() == NUM_SLAVES1 - 1); UTIL1.waitTableAvailable(tablename); Replication replication = (Replication) UTIL1.getMiniHBaseCluster() .getLiveRegionServerThreads().get(0).getRegionServer().getReplicationSourceService(); UTIL1.waitFor(60000, () -> !replication.getReplicationManager().getOldSources().isEmpty()); hbaseAdmin.disableReplicationPeer(PEER_ID2); LOG.info("has replicated rows before disable peer", checkReplicationData()); hbaseAdmin.enableReplicationPeer(PEER_ID2); UTIL2.waitFor(60000, () -> { int count = checkReplicationData(); LOG.info("Waiting all logs pushed to slave. Expected , actual {}", BATCH, count); return count == BATCH; }); }
Source:
<code>private void decrementRequested() { while (true) { <START> long r = requested.get(); <END> if (r == Long.MAX_VALUE) { return; } else if (requested.compareAndSet(r, r - 1)) { return; } } }</code><technical_language>load requested a local variable well</technical_language>

Target:
private void decrementRequested() { AtomicLong localRequested = this.requested; while (true) { long r = localRequested.get(); if (r == Long.MAX_VALUE) { return; } else if (localRequested.compareAndSet(r, r - 1)) { return; } } }
Source:
<code>public static boolean postAndWait(Handler handler, final Runnable r) { <START> if (handler.getLooper().getThread() == Thread.currentThread()) { <END> r.run(); return true; } WaitableRunnable wrapper = new WaitableRunnable(r); if (!handler.post(wrapper)) { return false; } wrapper.join(); return true; }</code><technical_language>Use: Looper.myLooper() == handler.getLooper()</technical_language>

Target:
public static boolean postAndWait(Handler handler, final Runnable r) { if (Looper.myLooper() == handler.getLooper()) { r.run(); return true; } WaitableRunnable wrapper = new WaitableRunnable(r); if (!handler.post(wrapper)) { return false; } wrapper.join(); return true; }
Source:
<code>protected Object executeWithSubject() throws Exception { if (inputOption) { printTransformers(InputTransformer.class, INPUT); return null; } if (metacardOption) { printTransformers(MetacardTransformer.class, METACARD); return null; } <START> printTransformers(InputTransformer.class, INPUT); <END> printTransformers(MetacardTransformer.class, METACARD); return null; }</code><technical_language>This logic a weird me. - -i -m print InputTransformers - -i -m print InputTransformers MetacardTransformers Is intended? java @Override protected Object executeWithSubject() throws Exception { if (!inputOption && !metacardOption) { // print some message expecting --input and/or --metacard options } else { if (inputOption) { printTransformers(InputTransformer.class, INPUT); } if (metacardOption) { printTransformers(MetacardTransformer.class, METACARD); } } return null; } java @Override protected Object executeWithSubject() throws Exception { if (!inputOption && !metacardOption) { inputOption = true; metacardOption = true; } if (inputOption) { printTransformers(InputTransformer.class, INPUT); } if (metacardOption) { printTransformers(MetacardTransformer.class, METACARD); } return null; } work better</technical_language>

Target:
protected Object executeWithSubject() throws Exception { if (!inputOption && !metacardOption) { inputOption = true; metacardOption = true; } if (inputOption) { printTransformers(InputTransformer.class, INPUT); } if (metacardOption) { printTransformers(MetacardTransformer.class, METACARD); } return null; }
Source:
<code><START> public JsonWriter(Sink sink) { <END> this(Okio.buffer(sink)); }</code><technical_language>Do offer necessary APIs flush emit this</technical_language>

Target:
public JsonWriter(Sink sink) { if (sink == null) { throw new NullPointerException("sink == null"); } this.sink = Okio.buffer(sink); }
Source:
<code>private static boolean forcedMove(Path from, Path to) { try { <START> Files.move(from, to); <END> return true; } catch (IOException e) { ControllerLogger.ROOT_LOGGER.cannotRename(e, from, to); return false; } }</code><technical_language>If call method forceMove StandardCopyOption.REPLACE_EXISTING</technical_language>

Target:
private static boolean forcedMove(Path from, Path to) { try { Files.move(from, to, StandardCopyOption.REPLACE_EXISTING); return true; } catch (IOException e) { ControllerLogger.ROOT_LOGGER.cannotRename(e, from, to); return false; } }
Source:
<code>public void testDecimalBackedByINT32() throws Exception { for (int precision = 1; precision <= MAX_PRECISION_INT32; precision++) { <START> int scale = current().nextInt(precision); <END> MessageType parquetSchema = parseMessageType(format("message hive_decimal { optional INT32 test (DECIMAL(%d, %d)); }", precision, scale)); ContiguousSet<Integer> intValues = intsBetween(1, 1_000); ImmutableList.Builder<SqlDecimal> expectedValues = new ImmutableList.Builder<>(); for (Integer value : intValues) { expectedValues.add(SqlDecimal.of(value, precision, scale)); } tester.testRoundTrip(javaIntObjectInspector, intValues, expectedValues.build(), createDecimalType(precision, scale), Optional.of(parquetSchema)); } }</code><technical_language>Static importing ThreadLocalRandom.current() this code hard read current() descriptive all. Please full form ThreadLocalRandom.current()</technical_language>

Target:
public void testDecimalBackedByINT32() throws Exception { for (int precision = 1; precision <= MAX_PRECISION_INT32; precision++) { int scale = ThreadLocalRandom.current().nextInt(precision); MessageType parquetSchema = parseMessageType(format("message hive_decimal { optional INT32 test (DECIMAL(%d, %d)); }", precision, scale)); ContiguousSet<Integer> intValues = intsBetween(1, 1_000); ImmutableList.Builder<SqlDecimal> expectedValues = new ImmutableList.Builder<>(); for (Integer value : intValues) { expectedValues.add(SqlDecimal.of(value, precision, scale)); } tester.testRoundTrip(javaIntObjectInspector, intValues, expectedValues.build(), createDecimalType(precision, scale), Optional.of(parquetSchema)); } }
Source:
<code>public QueryStatistics( Duration cpuTime, Duration wallTime, Duration queuedTime, Optional<Duration> analysisTime, Optional<Duration> distributedPlanningTime, long peakMemoryBytes, long totalBytes, long totalRows, long outputBytes, long outputRows, long writtenBytes, long writtenRows, double cumulativeMemory, int completedSplits, boolean complete, List<StageCpuDistribution> cpuTimeDistribution, List<String> operatorSummaries) { this.cpuTime = requireNonNull(cpuTime, "cpuTime is null"); this.wallTime = requireNonNull(wallTime, "wallTime is null"); this.queuedTime = requireNonNull(queuedTime, "queuedTime is null"); this.analysisTime = requireNonNull(analysisTime, "analysisTime is null"); this.distributedPlanningTime = requireNonNull(distributedPlanningTime, "distributedPlanningTime is null"); this.peakMemoryBytes = requireNonNull(peakMemoryBytes, "peakMemoryBytes is null"); <START> this.totalBytes = requireNonNull(totalBytes, "totalBytes is null"); <END> this.totalRows = requireNonNull(totalRows, "totalRows is null"); this.outputBytes = outputBytes; this.outputRows = outputRows; this.writtenBytes = writtenBytes; this.writtenRows = writtenRows; this.cumulativeMemory = cumulativeMemory; this.completedSplits = requireNonNull(completedSplits, "completedSplits is null"); this.complete = complete; this.cpuTimeDistribution = requireNonNull(cpuTimeDistribution, "cpuTimeDistribution is null"); this.operatorSummaries = requireNonNull(operatorSummaries, "operatorSummaries is null"); }</code><technical_language>add another commit removes silly requireNonNulls? Primitives null</technical_language>

Target:
public QueryStatistics( Duration cpuTime, Duration wallTime, Duration queuedTime, Optional<Duration> analysisTime, Optional<Duration> distributedPlanningTime, long peakMemoryBytes, long totalBytes, long totalRows, long outputBytes, long outputRows, long writtenBytes, long writtenRows, double cumulativeMemory, int completedSplits, boolean complete, List<StageCpuDistribution> cpuTimeDistribution, List<String> operatorSummaries) { this.cpuTime = requireNonNull(cpuTime, "cpuTime is null"); this.wallTime = requireNonNull(wallTime, "wallTime is null"); this.queuedTime = requireNonNull(queuedTime, "queuedTime is null"); this.analysisTime = requireNonNull(analysisTime, "analysisTime is null"); this.distributedPlanningTime = requireNonNull(distributedPlanningTime, "distributedPlanningTime is null"); this.peakMemoryBytes = peakMemoryBytes; this.totalBytes = totalBytes; this.totalRows = totalRows; this.outputBytes = outputBytes; this.outputRows = outputRows; this.writtenBytes = writtenBytes; this.writtenRows = writtenRows; this.cumulativeMemory = cumulativeMemory; this.completedSplits = completedSplits; this.complete = complete; this.cpuTimeDistribution = requireNonNull(cpuTimeDistribution, "cpuTimeDistribution is null"); this.operatorSummaries = requireNonNull(operatorSummaries, "operatorSummaries is null"); }
Source:
<code>public void onRefresh() { <START> EventBus.getDefault().post(new RefreshListener.RefreshEvent()); <END> }</code><technical_language>**RefreshEvent** a generic refresh event clients registered callback. Possibly clients belongs Dashboard. scope of limited Dashboard only</technical_language>

Target:
public void onRefresh() { EventBus.getDefault().post(new CourseDashboardRefreshEvent()); }
Source:
<code>void putCanBeUsedToReplace() { realCache.put("id", 0); realCache.put("id", 1); assertThat(realCache.get("id"), isPresentAndIs(1)); <START> verify(cacheRemovalListener, never()).accept(any()); <END> }</code><technical_language>Thinking suggestion passes a custom executor for tests: This tests gain some extra safety, in case removalListener is executed asynchronously, tests check early missing this critical error</technical_language>

Target:
void putCanBeUsedToReplace() { realCache.put("id", 0); realCache.put("id", 1); assertThat(realCache.get("id"), isPresentAndIs(1)); verify(cacheRemovalListener, never()).accept(any(), any()); }
Source:
<code>public TaskStats(DateTime createTime, DateTime endTime) { this(createTime, null, null, null, endTime, new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), 0, 0, 0, 0, 0, 0, 0.0, new DataSize(0, BYTE), new DataSize(0, BYTE), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), false, ImmutableSet.of(), new DataSize(0, BYTE), 0, new DataSize(0, BYTE), 0, new DataSize(0, BYTE), 0, new DataSize(0, BYTE), <START> ImmutableList.of() <END> ); }</code><technical_language>Revert</technical_language>

Target:
public TaskStats(DateTime createTime, DateTime endTime) { this(createTime, null, null, null, endTime, new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), 0, 0, 0, 0, 0, 0, 0, 0.0, new DataSize(0, BYTE), new DataSize(0, BYTE), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), false, ImmutableSet.of(), new DataSize(0, BYTE), 0, new DataSize(0, BYTE), 0, new DataSize(0, BYTE), 0, new DataSize(0, BYTE), ImmutableList.of()); }
Source:
<code>public void onResume() { super.onResume(); this.setTitle("Switch Instance"); Criteria crit = new Criteria(); crit.setAccuracy(Criteria.ACCURACY_COARSE); userLocation = getBestLocation(crit); RequestGenerator rg = new RequestGenerator(); loadingInstances = ProgressDialog.show(this, "Please Wait", "Loading Instances..."); rg.getInstancesNearLocation(userLocation.getLatitude(), userLocation.getLongitude(), new InstanceListHandler()); updateAccountElements(); findViewById(R.id.login_button).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent(InstanceSwitcherActivity.this, LoginActivity.class)); } }); findViewById(R.id.logout_button).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { App.getLoginManager().logOut(InstanceSwitcherActivity.this); <START> startActivity(new Intent(InstanceSwitcherActivity.this, LoginActivity.class)); <END> } }); }</code><technical_language>This is _definitely_ right anymore, logOut _also_ switches InstanceSwitcherActivity</technical_language>

Target:
public void onResume() { super.onResume(); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); userLocation = getBestLocation(criteria); RequestGenerator rg = new RequestGenerator(); loadingInstances = ProgressDialog.show(this, "Please Wait", "Loading Instances..."); rg.getInstancesNearLocation(userLocation.getLatitude(), userLocation.getLongitude(), new InstanceListHandler()); updateAccountElements(); findViewById(R.id.login_button).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent(InstanceSwitcherActivity.this, LoginActivity.class)); } }); findViewById(R.id.logout_button).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { App.getLoginManager().logOut(InstanceSwitcherActivity.this); startActivity(new Intent(InstanceSwitcherActivity.this, LoginActivity.class)); } }); }
Source:
<code>public void recognizeReceiptSourceUrlWithPngFile(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); <START> receiptPngSourceUrlRunnerTextDetails((sourceUrl, includeTextDetails) -> { <END> SyncPoller<OperationResult, List<RecognizedReceipt>> syncPoller = client.beginRecognizeReceiptsFromUrl( new RecognizeOptions(sourceUrl).setIncludeTextContent(includeTextDetails)).getSyncPoller(); syncPoller.waitForCompletion(); validateReceiptResultData(syncPoller.getFinalResult(), includeTextDetails); }); }</code><technical_language>update includeTextDetails references includeTextContent</technical_language>

Target:
public void recognizeReceiptSourceUrlWithPngFile(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); receiptPngSourceUrlRunnerTextDetails((sourceUrl, includeTextContent) -> { SyncPoller<OperationResult, List<RecognizedReceipt>> syncPoller = client.beginRecognizeReceiptsFromUrl( new RecognizeOptions(sourceUrl).setIncludeTextContent(includeTextContent) .setPollInterval(durationTestMode)) .getSyncPoller(); syncPoller.waitForCompletion(); validateReceiptResultData(syncPoller.getFinalResult(), includeTextContent); }); }
Source:
<code>public int hashCode(){ int hashCode; final int from = this.getFrom(); final int to = this.getTo(); <START> hashCode = new Integer(((from+to+1)*(from+to))/2).intValue()+to; <END> return hashCode; }</code><technical_language>need create a new Integer here</technical_language>

Target:
public int hashCode(){ int hashCode; final int from = this.getFrom(); final int to = this.getTo(); hashCode = ((from+to+1)*(from+to))/2+to; return hashCode; }
Source:
<code><START> public static Object[][] cartesianProduct(Object[][] ... dataProviders){ <END> final List[] lists = Arrays.stream(dataProviders) .map(TestNGUtils::nestedArraysToNestedLists) .toArray(List[]::new); @SuppressWarnings("unchecked") final List<List<List<Object>>> product = Lists.cartesianProduct(lists); final List<List<Object>> mergeProduct = product.stream() .map((List<List<Object>> list) -> { List<Object> result = new ArrayList<>(); list.forEach(result::addAll); return result; }).collect(Collectors.toList()); return nestedListsToNestedArrays(mergeProduct); }</code><technical_language>is write this preserve types (e.g. avoid SuppressWarnings). pretty written generics (vs Object) a chance finish that. public static Object[][] cartesianProduct(Object[][]... dataProviders) { List<List<List<Object>>> lists = Arrays.stream(dataProviders) .map(Main::nestedArraysToNestedLists) .collect(Collectors.toList()); final List<List<List<Object>>> product = Lists.cartesianProduct(lists); final List<List<Object>> mergeProduct = product.stream() .map(list -> { List<Object> result = new ArrayList<>(); list.forEach(result::addAll); return result; }).collect(Collectors.toList()); return nestedListsToNestedArrays(mergeProduct); } /** * @param dataProvider a nested Object array * @return equivalent nested List */ public static<T> List<List<T>> nestedArraysToNestedLists(T[][] dataProvider) { return Arrays.stream(dataProvider) .map(Arrays::asList) .collect(Collectors.toList()); } /** * @param lists a nested List * @return equivalent nested array */ public static Object[][] nestedListsToNestedArrays(List<List<Object>> lists) { return lists.stream().map(List::toArray).toArray(Object[][]::new); }</technical_language>

Target:
public static Object[][] cartesianProduct(Object[][]... dataProviders) { List<List<List<Object>>> lists = Arrays.stream(dataProviders) .map(TestNGUtils::nestedArraysToNestedLists) .collect(Collectors.toList()); final List<List<List<Object>>> product = Lists.cartesianProduct(lists); final List<List<Object>> mergeProduct = product.stream() .map( l -> l.stream() .flatMap(Collection::stream) .collect(Collectors.toList())) .collect(Collectors.toList()); return nestedListsToNestedArrays(mergeProduct); }
Source:
<code>protected void onPostExecute(Boolean hasUnsyncedNotes) { PreferencesFragment fragment = fragmentWeakReference.get(); if (fragment == null) { return; } if (hasUnsyncedNotes) { <START> AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getContext()); <END> builder.setTitle(R.string.unsynced_notes); builder.setMessage(R.string.unsynced_notes_message); builder.setPositiveButton(R.string.delete_notes, fragment.signOutClickListener); builder.setNeutralButton(R.string.visit_web_app, fragment.loadWebAppClickListener); builder.setNegativeButton(R.string.cancel, null); builder.show(); } else { fragment.signOut(); } }</code><technical_language>need for this variable here. this more readable a builder: java new AlertDialog.Builder(fragment.getContext()) .setTitle(R.string.unsynced_notes) .setMessage(R.string.unsynced_notes_message) .setPositiveButton(R.string.delete_notes, fragment.signOutClickListener) .setNeutralButton(R.string.visit_web_app, fragment.loadWebAppClickListener) .setNegativeButton(R.string.cancel, null) .show(); java AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getContext()) .setTitle(R.string.unsynced_notes) .setMessage(R.string.unsynced_notes_message) .setPositiveButton(R.string.delete_notes, fragment.signOutClickListener) .setNeutralButton(R.string.visit_web_app, fragment.loadWebAppClickListener) .setNegativeButton(R.string.cancel, null); builder.show();</technical_language>

Target:
protected void onPostExecute(Boolean hasUnsyncedNotes) { PreferencesFragment fragment = fragmentWeakReference.get(); if (fragment == null) { return; } if (hasUnsyncedNotes) { new AlertDialog.Builder(fragment.getContext()) .setTitle(R.string.unsynced_notes) .setMessage(R.string.unsynced_notes_message) .setPositiveButton(R.string.delete_notes, fragment.signOutClickListener) .setNeutralButton(R.string.visit_web_app, fragment.loadWebAppClickListener) .setNegativeButton(R.string.cancel, null) .show(); } else { fragment.signOut(); } }
Source:
<code>private String generateExtNameAssignment(String[] value, boolean hasInvocation) { String getNameCode = defaultExtName == null ? null : String.format("\"%s\"", defaultExtName); for (int i = value.length - 1; i >= 0; --i) { <START> if ("protocol".equals(value[i])) { <END> getNameCode = String.format("url.getProtocol() == null ? (%s) : url.getProtocol()", getNameCode); } else if (hasInvocation) { getNameCode = String.format("url.getMethodParameter(methodName, \"%s\", \"%s\")", value[i], defaultExtName); } else { getNameCode = String.format("url.getParameter(\"%s\", (String) %s)", value[i], getNameCode); } } return String.format(CODE_EXT_NAME_ASSIGNMENT, getNameCode); }</code><technical_language>dubbo Constants.PROTOCOL_KEY instead **protocol**</technical_language>

Target:
private String generateExtNameAssignment(String[] value, boolean hasInvocation) { String getNameCode = defaultExtName == null ? null : String.format("\"%s\"", defaultExtName); for (int i = value.length - 1; i >= 0; --i) { if (Constants.PROTOCOL_KEY.equals(value[i])) { getNameCode = String.format("url.getProtocol() == null ? (%s) : url.getProtocol()", getNameCode); } else if (hasInvocation) { getNameCode = String.format("url.getMethodParameter(methodName, \"%s\", \"%s\")", value[i], defaultExtName); } else { getNameCode = String.format("url.getParameter(\"%s\", (String) %s)", value[i], getNameCode); } } return String.format(CODE_EXT_NAME_ASSIGNMENT, getNameCode); }
Source:
<code>protected String toString(NSDictionary args) { StringBuilder builder = new StringBuilder(); builder.append(pages.size() + " pages.\n\t"); for (WebkitPage p : pages) { <START> builder.append("[" + p.getPageId() + "],title:" + p.getTitle() + ",url:" + p.getURL() + "\t\tConnection:" <END> + p.getConnection() + "\n\t"); } return builder.toString(); }</code><technical_language>Please append() call append strings a StringBuilder instead of resorting concatenation, kind of defeats purpose of a StringBuilder</technical_language>

Target:
protected String toString(NSDictionary args) { StringBuilder builder = new StringBuilder(); builder.append(pages.size() + " pages.\n\t"); for (WebkitPage p : pages) { builder.append("[").append(p.getPageId()).append("], title: ").append(p.getTitle()).append(", url: ") .append(p.getURL()).append(" \t\tConnection:").append(p.getConnection()).append("\n\t"); } return builder.toString(); }
Source:
<code>private void setValue(Type type, BlockBuilder blockBuilder, String value) { if (value == null) { blockBuilder.appendNull(); return; } boolean handled = true; if (type instanceof FixedWidthType) { completedBytes += ((FixedWidthType) type).getFixedSize(); if (type instanceof BigintType) { type.writeLong(blockBuilder, parseDouble(value).longValue()); } else if (type instanceof IntegerType) { blockBuilder.writeInt(parseDouble(value).intValue()); } else if (type instanceof TinyintType) { blockBuilder.writeByte(parseDouble(value).byteValue()); } else if (type instanceof SmallintType) { blockBuilder.writeShort(parseDouble(value).shortValue()); } else if (type instanceof BooleanType) { type.writeBoolean(blockBuilder, Boolean.valueOf(value)); <START> } <END> else if (type instanceof DecimalType || type instanceof DoubleType) { type.writeDouble(blockBuilder, parseDouble(value).doubleValue()); } else if (type instanceof TimestampType) { type.writeLong(blockBuilder, Long.valueOf(value)); } else { handled = false; } } else if (type instanceof VarcharType) { Slice slice = Slices.utf8Slice(value); blockBuilder.writeBytes(slice, 0, slice.length()).closeEntry(); completedBytes += slice.length(); } else { handled = false; } if (!handled) { throw new PinotException(PinotErrorCode.PINOT_UNSUPPORTED_COLUMN_TYPE, Optional.empty(), "type '" + type + "' not supported"); } }</code><technical_language>instanceof checks in Java is considered anti-pattern. want find ways avoid interfaces inheritance etc. In this case consider leveraging function overloading this code conditionals</technical_language>

Target:
private void setValue(Type type, BlockBuilder blockBuilder, String value) { if (value == null) { blockBuilder.appendNull(); return; } if (!(type instanceof FixedWidthType) && !(type instanceof VarcharType)) { throw new PinotException(PINOT_UNSUPPORTED_COLUMN_TYPE, Optional.empty(), "type '" + type + "' not supported"); } if (type instanceof FixedWidthType) { completedBytes += ((FixedWidthType) type).getFixedSize(); if (type instanceof BigintType) { type.writeLong(blockBuilder, parseDouble(value).longValue()); } else if (type instanceof IntegerType) { blockBuilder.writeInt(parseDouble(value).intValue()); } else if (type instanceof TinyintType) { blockBuilder.writeByte(parseDouble(value).byteValue()); } else if (type instanceof SmallintType) { blockBuilder.writeShort(parseDouble(value).shortValue()); } else if (type instanceof BooleanType) { type.writeBoolean(blockBuilder, parseBoolean(value)); } else if (type instanceof DecimalType || type instanceof DoubleType) { type.writeDouble(blockBuilder, parseDouble(value)); } else if (type instanceof TimestampType) { type.writeLong(blockBuilder, parseLong(value)); } else { throw new PinotException(PINOT_UNSUPPORTED_COLUMN_TYPE, Optional.empty(), "type '" + type + "' not supported"); } } else { Slice slice = Slices.utf8Slice(value); blockBuilder.writeBytes(slice, 0, slice.length()).closeEntry(); completedBytes += slice.length(); } }
Source:
<code>private static void storeInSession(final HttpServletRequest request, final AuthenticationContext authenticationContext) { final HttpSession session = request.getSession(); session.setAttribute(LOGGED_USER_ATTRIBUTE, authenticationContext.getUser()); session.setAttribute(LOGGED_USER_AUTHENTICATION_CONTEXT_ATTRIBUTE, authenticationContext.export()); <START> } <END></code><technical_language>store authenticationContext in session avoid json des/serialisation</technical_language>

Target:
private static void storeInSession(final HttpServletRequest request, final AuthenticationContext authenticationContext) { final HttpSession session = request.getSession(); session.setAttribute(LOGGED_USER_ATTRIBUTE, authenticationContext.getUser()); session.setAttribute(LOGGED_USER_AUTHENTICATION_CONTEXT_ATTRIBUTE, authenticationContext); }
Source:
<code>private static void checkNotIndeterminate(Boolean equalsResult) { if (equalsResult == null) { <START> throw new PrestoException(NOT_SUPPORTED, "contains does not support indeterminate comparison results"); <END> } }</code><technical_language>"indeterminate" is a SQL jargon Presto users familiar with. I do this: contains function support indeterminate arrays. A is indeterminate if null array/map/row contains indeterminate elements</technical_language>

Target:
private static void checkNotIndeterminate(Boolean equalsResult) { if (equalsResult == null) { throw new PrestoException(NOT_SUPPORTED, "contains does not support arrays with elements that are null or contain null"); } }
Source:
<code>public ArrayList<Person> getTechs(boolean noZeroMinute, UUID firstTechId, boolean sorted, boolean eliteFirst) { ArrayList<Person> techs = new ArrayList<>(); Person firstTech = getPerson(firstTechId); if ((firstTech != null) && firstTech.isTech() && firstTech.isActive() && (!noZeroMinute || firstTech.getMinutesLeft() > 0)) { techs.add(firstTech); } for (Person p : getPersonnel()) { if (p.isTech() && p.isActive() && (!p.equals(firstTech)) && (!noZeroMinute || (p.getMinutesLeft() > 0))) { techs.add(p); } } for (Unit u : getUnits()) { if (u.isSelfCrewed() && !(u.getEntity() instanceof Infantry) && null != u.getEngineer()) { techs.add(u.getEngineer()); } } if (sorted) { techs.sort((person1, person2) -> { int retVal = 0; boolean p1Secondary = !person1.isTechPrimary() && person1.isTechSecondary(); boolean p2Secondary = !person2.isTechPrimary() && person2.isTechSecondary(); if (person1.getExperienceLevel(p1Secondary) > person2.getExperienceLevel(p2Secondary)) { retVal = -1; } else if (person1.getExperienceLevel(p1Secondary) < person2.getExperienceLevel(p2Secondary)) { retVal = 1; } <START> return eliteFirst ? retVal *= -1 : retVal; <END> }); } return techs; }</code><technical_language>retVal</technical_language>

Target:
public ArrayList<Person> getTechs(boolean noZeroMinute, UUID firstTechId, boolean sorted, boolean eliteFirst) { ArrayList<Person> techs = new ArrayList<>(); Person firstTech = getPerson(firstTechId); if ((firstTech != null) && firstTech.isTech() && firstTech.isActive() && (!noZeroMinute || firstTech.getMinutesLeft() > 0)) { techs.add(firstTech); } for (Person p : getPersonnel()) { if (p.isTech() && p.isActive() && (!p.equals(firstTech)) && (!noZeroMinute || (p.getMinutesLeft() > 0))) { techs.add(p); } } for (Unit u : getUnits()) { if (u.isSelfCrewed() && !(u.getEntity() instanceof Infantry) && null != u.getEngineer()) { techs.add(u.getEngineer()); } } if (sorted) { techs.sort((person1, person2) -> { int retVal = 0; boolean p1Secondary = !person1.isTechPrimary() && person1.isTechSecondary(); boolean p2Secondary = !person2.isTechPrimary() && person2.isTechSecondary(); if (person1.getExperienceLevel(p1Secondary) > person2.getExperienceLevel(p2Secondary)) { retVal = -1; } else if (person1.getExperienceLevel(p1Secondary) < person2.getExperienceLevel(p2Secondary)) { retVal = 1; } return eliteFirst ? -retVal : retVal; }); } return techs; }
Source:
<code>public Openstack(@Nonnull String endPointUrl, @Nonnull String identity, @Nonnull Secret credential, @CheckForNull String region) { String[] id = identity.split(":", 2); String tenant = id.length > 0 ? id[0] : ""; String username = id.length > 1 ? id[1] : ""; if (Jenkins.getInstance() != null && Jenkins.getInstance().proxy != null){ ProxyConfiguration proxy = Jenkins.getInstance().proxy; <START> LOGGER.info("So we have a proxy defined with the following details:"); <END> LOGGER.info("proxy.name= " +proxy.name); LOGGER.info("proxy.port= " +proxy.port); client = OSFactory.builder().endpoint(endPointUrl).credentials(username, credential.getPlainText()) .tenantName(tenant) .withConfig(Config.newConfig().withSSLVerificationDisabled().withProxy(ProxyHost.of(HTTP_PREFIX +proxy.name,proxy.port,proxy.getUserName(), proxy.getPassword()))) .authenticate() .useRegion(region); } else { client = OSFactory.builder().endpoint(endPointUrl) .credentials(username, credential.getPlainText()) .tenantName(tenant) .authenticate() .useRegion(region); } debug("Openstack client created for " + endPointUrl); }</code><technical_language>Please squash this a single log record debug() instead</technical_language>

Target:
public Openstack(@Nonnull String endPointUrl, @Nonnull String identity, @Nonnull Secret credential, @CheckForNull String region) { String[] id = identity.split(":", 2); String tenant = id.length > 0 ? id[0] : ""; String username = id.length > 1 ? id[1] : ""; Config config = Config.newConfig(); if (Jenkins.getInstance() != null && Jenkins.getInstance().proxy != null) { ProxyConfiguration proxy = Jenkins.getInstance().proxy; debug("Jenkins has a proxy defined with the following details: proxy.name= " +proxy.name +"proxy.port= " +proxy.port); config = Config.newConfig().withProxy(ProxyHost.of(HTTP_PREFIX + proxy.name, proxy.port, proxy.getUserName(), proxy.getPassword())); } client = OSFactory.builder().endpoint(endPointUrl).credentials(username, credential.getPlainText()) .tenantName(tenant) .withConfig(config) .authenticate() .useRegion(region); debug("Openstack client created for " + endPointUrl); }
Source:
<code>public FlightMultiAbility(Player player) { super(player); if (bPlayer.isOnCooldown(this)) { return; } FlightMultiAbility f = getAbility(player, FlightMultiAbility.class); if (f != null) { if (player.isSneaking()) { player.eject(); return; } switch (player.getInventory().getHeldItemSlot()) { case 0: f.manageSoarSpeed(); break; case 3: f.remove(); break; } return; } if (player.isInsideVehicle()) { return; } if (isWater(player.getEyeLocation().getBlock())) { return; } if (player.isOnGround()) { return; } CoreAbility abil = null; if (hasAbility(player, AirSpout.class)) { abil = getAbility(player, AirSpout.class); } else if (hasAbility(player, WaterSpout.class)) { abil = getAbility(player, WaterSpout.class); } else if (hasAbility(player, FireJet.class)) { abil = getAbility(player, FireJet.class); } else if (hasAbility(player, AirScooter.class)) { abil = getAbility(player, AirScooter.class); } if (abil != null) { abil.remove(); } MultiAbilityManager.bindMultiAbility(player, "Flight"); <START> flight = ProjectKorra.flightHandler.createInstance(player, "FlightMultiAbility"); <END> hadGlide = player.isGliding(); flying.add(player.getUniqueId()); prevDir = player.getEyeLocation().getDirection().clone(); duration = getConfig().getLong("Abilities.Air.Flight.Duration"); baseSpeed = getConfig().getDouble("Abilities.Air.Flight.BaseSpeed"); slowSpeed = baseSpeed/2; fastSpeed = baseSpeed*2; multiplier = baseSpeed; start(); }</code><technical_language>getName() store a final String of "FlightMultiAbility" instead</technical_language>

Target:
public FlightMultiAbility(Player player) { super(player); if (bPlayer.isOnCooldown(this)) { return; } FlightMultiAbility f = getAbility(player, FlightMultiAbility.class); if (f != null) { if (player.isSneaking()) { player.eject(); return; } switch (player.getInventory().getHeldItemSlot()) { case 0: f.manageSoarSpeed(); break; case 3: f.remove(); break; } return; } if (player.isInsideVehicle()) { return; } if (isWater(player.getEyeLocation().getBlock())) { return; } if (player.isOnGround()) { return; } CoreAbility abil = null; if (hasAbility(player, AirSpout.class)) { abil = getAbility(player, AirSpout.class); } else if (hasAbility(player, WaterSpout.class)) { abil = getAbility(player, WaterSpout.class); } else if (hasAbility(player, FireJet.class)) { abil = getAbility(player, FireJet.class); } else if (hasAbility(player, AirScooter.class)) { abil = getAbility(player, AirScooter.class); } if (abil != null) { abil.remove(); } MultiAbilityManager.bindMultiAbility(player, "Flight"); ProjectKorra.flightHandler.createInstance(player, ID); hadGlide = player.isGliding(); flying.add(player.getUniqueId()); prevDir = player.getEyeLocation().getDirection().clone(); duration = getConfig().getLong("Abilities.Air.Flight.Duration"); baseSpeed = getConfig().getDouble("Abilities.Air.Flight.BaseSpeed"); slowSpeed = baseSpeed/2; fastSpeed = baseSpeed*2; multiplier = baseSpeed; start(); }
Source:
<code>private Object getAdapter(Object adaptable, Class c) { if (c.isInstance(adaptable)) { return adaptable; } if (adaptable instanceof IAdaptable) { IAdaptable a = (IAdaptable) adaptable; Object adapter = a.getAdapter(c); <START> if (c.isInstance(adapter)) { <END> return adapter; } } return null; }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
private Object getAdapter(Object adaptable, Class c) { if (c.isInstance(adaptable)) return adaptable; if (adaptable instanceof IAdaptable) { IAdaptable a = (IAdaptable) adaptable; Object adapter = a.getAdapter(c); if (c.isInstance(adapter)) return adapter; } return null; }
Source:
<code>public static Map<String, List<String>> getQueryParams(final URL url) { if (url == null) { throw new IllegalArgumentException("Cannot get query params from the null url"); } Map<String, List<String>> returnValue = new HashMap<>(); if (url.getQuery() == null) { return returnValue; } String[] pairs = url.getQuery().split("&"); for (String pair : pairs) { if (pair.isEmpty()) { continue; } <START> int idx = pair.indexOf('='); <END> String key = pair.substring(0, idx); String value = pair.substring(idx + 1); try { key = URLDecoder.decode(key, StandardCharsets.UTF_8.toString()); value = URLDecoder.decode(value, StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Could not find UTF-8 encoding", e); } List<String> paramValues = returnValue.computeIfAbsent(key, k -> new LinkedList<>()); paramValues.add(value); } return returnValue; }</code><technical_language>if url ?param1=value1&param2=&param3&param4=value4</technical_language>

Target:
public static Map<String, List<String>> getQueryParams(final URL url) { if (url == null) { throw new IllegalArgumentException("Cannot get query params from the null url"); } Map<String, List<String>> returnValue = new HashMap<>(); if (url.getQuery() == null) { return returnValue; } String[] pairs = url.getQuery().split("&"); for (String pair : pairs) { if (pair.isEmpty()) { continue; } int idx = pair.indexOf('='); if (idx == -1) { returnValue.computeIfAbsent(pair, k -> new LinkedList<>()); continue; } String key = pair.substring(0, idx); String value = pair.substring(idx + 1); try { key = URLDecoder.decode(key, StandardCharsets.UTF_8.toString()); value = URLDecoder.decode(value, StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Could not find UTF-8 encoding", e); } List<String> paramValues = returnValue.computeIfAbsent(key, k -> new LinkedList<>()); paramValues.add(value); } return returnValue; }
Source:
<code>public boolean execute(String jobName, Date jobRunDate) throws InterruptedException { <START> List<String> listOfSaeFileNames = getConcurStandardAccountingExtractService().buildListOfFileNamesToBeProcessed(); <END> for (String saeFileName : listOfSaeFileNames) { LOG.debug("execute, processing: " + saeFileName); try { processCurrentFileAndExtractPdpFeedFromSAEFile(saeFileName); } catch (Exception e) { LOG.error("execute, there was an unexpected error processing a file: ", e); } finally { getFileStorageService().removeDoneFiles(Collections.singletonList(saeFileName)); } } return true; }</code><technical_language>Is this a list of file names fully qualified file names? nitpick a difference need build XML .done files based initially get, more clear dealing if more explicit variable parameter names used; especially maintenance. Thoughts</technical_language>

Target:
public boolean execute(String jobName, Date jobRunDate) throws InterruptedException { List<String> listOfSaeFullyQualifiedFileNames = getConcurStandardAccountingExtractService().buildListOfFullyQualifiedFileNamesToBeProcessed(); for (String saeFileName : listOfSaeFullyQualifiedFileNames) { LOG.debug("execute, processing: " + saeFileName); try { processCurrentFileAndExtractPdpFeedFromSAEFile(saeFileName); } catch (Exception e) { LOG.error("execute, there was an unexpected error processing a file: ", e); } finally { getFileStorageService().removeDoneFiles(Collections.singletonList(saeFileName)); } } return true; }
Source:
<code>private void onMaintenance() { ArrayList<ActionParametersBase> list = new ArrayList<>(); for (StorageDomain item : getSelectedItems()) { DeactivateStorageDomainWithOvfUpdateParameters parameters = new DeactivateStorageDomainWithOvfUpdateParameters(); parameters.setStorageDomainId(getEntity().getId()); <START> parameters.setForceMaintenance(false); <END> if (item.getStoragePoolId() != null) { parameters.setStoragePoolId(item.getStoragePoolId()); } list.add(parameters); } final ConfirmationModel confirmationModel = (ConfirmationModel) getWindow(); confirmationModel.startProgress(); Frontend.getInstance().runMultipleAction(ActionType.DeactivateStorageDomainWithOvfUpdate, list, result -> { confirmationModel.stopProgress(); setWindow(null); }, null); }</code><technical_language>forceMaintenance is false default? In case do need add this line</technical_language>

Target:
private void onMaintenance() { ArrayList<ActionParametersBase> list = new ArrayList<>(); for (StorageDomain item : getSelectedItems()) { DeactivateStorageDomainWithOvfUpdateParameters parameters = new DeactivateStorageDomainWithOvfUpdateParameters(); parameters.setStorageDomainId(getEntity().getId()); if (item.getStoragePoolId() != null) { parameters.setStoragePoolId(item.getStoragePoolId()); } list.add(parameters); } final ConfirmationModel confirmationModel = (ConfirmationModel) getWindow(); confirmationModel.startProgress(); Frontend.getInstance().runMultipleAction(ActionType.DeactivateStorageDomainWithOvfUpdate, list, result -> { confirmationModel.stopProgress(); setWindow(null); }, null); }
Source:
<code>public static List<VMImage> getImages(String containerName, String group, String storageAccountName, String key, String offer, String location) { final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storageAccountName, key) .buildApi(AzureBlobClient.class); List<VMImage> list = new ArrayList<VMImage>(); try { BoundedSet<ContainerProperties> containerList = azureBlob.listContainers(); for (ContainerProperties props : containerList) { if (props.getName().equals("system")) { ListBlobsResponse blobList = azureBlob.listBlobs("system"); String osDisk = ""; String dataDisk = ""; for (BlobProperties blob : blobList) { <START> System.out.println(blob.getName()); <END> String name = blob.getName(); if (dataDisk.length() == 0) dataDisk = name.substring(1 + name.lastIndexOf('/')); else if (osDisk.length() == 0) osDisk = name.substring(1 + name.lastIndexOf('/')); } final VMImage ref = VMImage.create(group, storageAccountName, osDisk, dataDisk, "test-create-image", "custom", location); list.add(ref); } } } catch (Exception e) { e.printStackTrace(); } try { azureBlob.close(); } catch (IOException e) { e.printStackTrace(); } return list; }</code><technical_language>do this. Consider initializing this helper class compute logger instead</technical_language>

Target:
public static List<VMImage> getImages(String containerName, String group, String storageAccountName, String key, String offer, String location) { final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storageAccountName, key) .buildApi(AzureBlobClient.class); List<VMImage> list = new ArrayList<VMImage>(); try { BoundedSet<ContainerProperties> containerList = azureBlob.listContainers(); for (ContainerProperties props : containerList) { if (props.getName().equals("system")) { ListBlobsResponse blobList = azureBlob.listBlobs("system"); String osDisk = ""; String dataDisk = ""; for (BlobProperties blob : blobList) { String name = blob.getName(); if (dataDisk.length() == 0) dataDisk = name.substring(1 + name.lastIndexOf('/')); else if (osDisk.length() == 0) osDisk = name.substring(1 + name.lastIndexOf('/')); } final VMImage ref = VMImage.create(group, storageAccountName, osDisk, dataDisk, "test-create-image", "custom", location); list.add(ref); } } } finally { Closeables2.closeQuietly(azureBlob); } return list; }
Source:
<code>protected void onHandleIntent(Intent intent) { PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "NotificationsIntent"); try { wl.acquire(); Log.d("Notifications", "Running Notifications Intent Service"); Context context =getApplicationContext(); ReadPerfs(context); notificationSetter(context); ArmTimer(context); context.startService(new Intent(context, MissedReadingService.class)); } finally { if (wl.isHeld()) wl.release(); <START> } <END> }</code><technical_language>Usually, do acquire try block. this work, if want more consistent, change</technical_language>

Target:
protected void onHandleIntent(Intent intent) { PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "NotificationsIntent"); wl.acquire(); try { Log.d("Notifications", "Running Notifications Intent Service"); Context context =getApplicationContext(); ReadPerfs(context); notificationSetter(context); ArmTimer(context); context.startService(new Intent(context, MissedReadingService.class)); } finally { if (wl.isHeld()) wl.release(); } }
Source:
<code>public static JobStatus findPriority(String name) { <START> if (name.equalsIgnoreCase(PENDING.toString())) { <END> return PENDING; } if (name.equalsIgnoreCase(RUNNING.toString())) { return RUNNING; } if (name.equalsIgnoreCase(STALLED.toString())) { return STALLED; } if (name.equalsIgnoreCase(FINISHED.toString())) { return FINISHED; } if (name.equalsIgnoreCase(PAUSED.toString())) { return PAUSED; } if (name.equalsIgnoreCase(CANCELED.toString())) { return CANCELED; } if (name.equalsIgnoreCase(FAILED.toString())) { return FAILED; } return KILLED; }</code><technical_language>I implementation of this class replaced a simple for loop is iterate constants method values() enum. This more maintainable</technical_language>

Target:
public static JobStatus findPriority(String name) { for (JobStatus jobStatus : JobStatus.values()) { if (name.equalsIgnoreCase(jobStatus.toString())) return jobStatus; } return KILLED; }
Source:
<code>public void execute(List<Tuple> tuples, OutputCollector collector) { System.out.println("---- store "+tuples.size() ); if ( !initialized ) { if( !config.isCounterBolt() ) { dao.init(); dao.setConfig(config); <START> dao.analyzeTuple( tuples.get(0) ); <END> dao.createDataStructures(); } else { ctn.setConfig( config ); ctn.connect( config.getIP() ); ctn.createDataStructures(); keyFields = new Fields(config.getPrimaryKeys().getPrimaryKeyFields()); } initialized = true; } try{ if( !config.isCounterBolt() ) { for( Tuple t : tuples ){ System.out.println("debug: store "+t); } dao.store( tuples ); } else { for( Tuple t : tuples ){ List<Object> keyValues = t.select( keyFields ); List<Object> val = t.select(config.getTupleFields()); System.out.println("debug: store "+t); ctn.update( keyValues, (int)val.get(0) ); } } } catch (Exception e ){ System.err.print("ERROR: "+e); e.printStackTrace(); } for( Tuple p : tuples ){ collector.emit(p.getValues()); } }</code><technical_language>If error easily handle. ^^</technical_language>

Target:
public void execute(List<Tuple> tuples, OutputCollector collector) { System.out.println("debug: store "+tuples.size() ); if ( !initialized ) { if( !config.isCounterBolt() ) { dao.init(); dao.setConfig(config); dao.analyzeTuple( tuples.get(0) ); dao.createDataStructures(); } else { ctn.connect( config.getIP() ); ctn.createDataStructures(); keyFields = new Fields(config.getPrimaryKeys().getPrimaryKeyFields()); } initialized = true; } try{ if( !config.isCounterBolt() ) { for( Tuple t : tuples ){ System.out.println("debug: store "+t); } dao.store( tuples ); } else { for( Tuple t : tuples ){ List<Object> keyValues = t.select( keyFields ); List<Object> val = t.select(config.getTupleFields()); System.out.println("debug: store "+t); ctn.update( keyValues, (int)val.get(0) ); } } } catch (Exception e ){ System.err.print("ERROR: "+e); e.printStackTrace(); } for( Tuple p : tuples ){ collector.emit(p.getValues()); } }
Source:
<code>public void testCapture404() throws Exception { server.enqueue(response404()); final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname"); URI uri = vmAPI.capture("vm", "prefix", "container"); assertNull(uri); assertSent(server, "POST", "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute" + "/virtualMachines/vm/capture?api-version=2015-06-15"); <START> } <END></code><technical_language>Please, assert generated body in capture methods</technical_language>

Target:
public void testCapture404() throws Exception { server.enqueue(response404()); final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname"); URI uri = vmAPI.capture("vm", "prefix", "container"); assertNull(uri); assertSent(server, "POST", "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute" + "/virtualMachines/vm/capture?api-version=2015-06-15", "{\"vhdPrefix\":\"prefix\",\"destinationContainerName\":\"container\"}"); }