auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected TileEntityBeacon createVirtualTile() { return new TileEntityBeacon() { @Override public boolean isUseableByPlayer(EntityPlayer player) { return player == SpongeBeaconWindow.this.player; } }; }

Target:
protected TileEntityBeacon createVirtualTile() { return new TileEntityBeacon() { @Override public boolean isUseableByPlayer(EntityPlayer player) { return SpongeBeaconWindow.this.players.contains(player); } }; }
Source:
public CtfTmfLightweightContext(ArrayList<CtfIterator> iters, ListIterator<CtfIterator> pos) { fIteratorPool = iters; fCurrentIterator = pos; fTrace = iters.get(0).getCtfTmfTrace(); curLocation = new CtfLocation((Long)null); collisions = 0; }

Target:
public CtfTmfLightweightContext(ArrayList<CtfIterator> iters, ListIterator<CtfIterator> pos) { fTrace = iters.get(0).getCtfTmfTrace(); curLocation = new CtfLocation((Long) null); }
Source:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended()) .filter(vm -> getStoragePool().getCompatibilityVersion().compareTo(vm.getCustomCompatibilityVersion()) > 0) .map(VM::getName) .collect(Collectors.joining(", ")); if (!suspendedVms.isEmpty()) { return failValidation( EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED, String.format("$VmsList %1$s", suspendedVms)); } return true; }

Target:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && getStoragePool().getCompatibilityVersion().compareTo(vm.getCustomCompatibilityVersion()) > 0) .map(VM::getName) .collect(Collectors.joining(", ")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }
Source:
private static void buildMenu(ModelItem curModelItem, String menuName, SoapUITreeNode path) { String[] groupsId = {SoapUI.STEP, SoapUI.CASE, SoapUI.SUITE, SoapUI.PROJECT}; if (curModelItem instanceof Workspace) { for (String groupId : groupsId) { activateMenuItems(groupId, false); } } else if (ModelSupport.isOneOf(curModelItem, WsdlTestSuite.class, WsdlTestCase.class, WsdlTestStep.class, WsdlProject.class)) { ActionList actionList = ActionListBuilder.buildActions(curModelItem); JMenu curMenu = MenuBuilderHelper.getMenu(menuName); curMenu.removeAll(); ActionSupport.addActions(actionList, curMenu); for (String groupId : groupsId) { if (groupId.equals(menuName)) { break; } activateMenuItems(groupId, false); } while (!(curModelItem.getParent() instanceof Workspace)) { curModelItem = curModelItem.getParent(); ActionList parentActionList = ActionListBuilder.buildActions(curModelItem); JMenu parentMenu = MenuBuilderHelper.getMenu(getMenuNameForModelItem(curModelItem)); parentMenu.removeAll(); ActionSupport.addActions(parentActionList, parentMenu); activateMenuItems(getMenuNameForModelItem(curModelItem), true); } } else { SoapUITreeNode node = path.getParentTreeNode(); curModelItem = node.getModelItem(); while (!(curModelItem instanceof Workspace)) { if (curModelItem instanceof WsdlTestCase) { buildMenu(curModelItem, SoapUI.CASE, null); break; } if (curModelItem instanceof WsdlProject) { buildMenu(curModelItem, SoapUI.PROJECT, null); break; } node = node.getParentTreeNode(); curModelItem = node.getModelItem(); } } }

Target:
private static void buildMenu(ModelItem curModelItem, String menuName, SoapUITreeNode path) { String[] groupsId = {SoapUI.STEP, SoapUI.CASE, SoapUI.SUITE, SoapUI.PROJECT}; if (curModelItem instanceof Workspace) { for (String groupId : groupsId) { activateMenuItems(groupId, false); } } else if (ModelSupport.isOneOf(curModelItem, WsdlTestSuite.class, WsdlTestCase.class, WsdlTestStep.class, WsdlProject.class)) { ActionList actionList = ActionListBuilder.buildActions(curModelItem); JMenu curMenu = MenuBuilderHelper.getMenu(menuName); curMenu.removeAll(); ActionSupport.addActions(actionList, curMenu); for (String groupId : groupsId) { if (groupId.equals(menuName)) { break; } activateMenuItems(groupId, false); } while (!(curModelItem.getParent() instanceof Workspace)) { curModelItem = curModelItem.getParent(); ActionList parentActionList = ActionListBuilder.buildActions(curModelItem); JMenu parentMenu = MenuBuilderHelper.getMenu(getMenuNameForModelItem(curModelItem)); parentMenu.removeAll(); ActionSupport.addActions(parentActionList, parentMenu); activateMenuItems(getMenuNameForModelItem(curModelItem), true); } } else { SoapUITreeNode node = path.getParentTreeNode(); curModelItem = node.getModelItem(); while (!(curModelItem instanceof Workspace)) { if (curModelItem instanceof WsdlTestCase) { buildMenu(curModelItem, SoapUI.CASE, null); break; } else if (curModelItem instanceof WsdlProject) { buildMenu(curModelItem, SoapUI.PROJECT, null); break; } node = node.getParentTreeNode(); curModelItem = node.getModelItem(); } } }
Source:
public void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget) { final MultiPageEditorViewImpl editorMultiPageView = (MultiPageEditorViewImpl) kieView.getMultiPage().getView(); final int backgroundPageIndex = editorMultiPageView.getPageIndex(CommonConstants.INSTANCE.EditTabTitle()) + 1; kieView.getMultiPage().addPage(backgroundPageIndex, new PageImpl(scenarioGridWidget, ScenarioSimulationEditorConstants.INSTANCE.backgroundTabTitle()) { @Override public void onFocus() { super.onFocus(); onBackgroundTabSelected(); } }); }

Target:
public void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget) { final MultiPageEditorViewImpl editorMultiPageView = (MultiPageEditorViewImpl) kieView.getMultiPage().getView(); final String mainPageTitle = CommonConstants.INSTANCE.EditTabTitle(); final String backgroundPageTitle = ScenarioSimulationEditorConstants.INSTANCE.backgroundTabTitle(); final int mainPageIndex = editorMultiPageView.getPageIndex(mainPageTitle); final int backgroundPageIndex = mainPageIndex + 1; kieView.getMultiPage().addPage(backgroundPageIndex, new PageImpl(scenarioGridWidget, backgroundPageTitle) { @Override public void onFocus() { super.onFocus(); onBackgroundTabSelected(); } }); }
Source:
private List<String> relationPK(RelationModel rm) throws OrmException, SQLException { List<String> pk = new ArrayList<>(); for (ColumnModel cm : rm.getPrimaryKeyColumns()) { pk.add(cm.getColumnName().toUpperCase()); } return pk; }

Target:
private List<String> relationPK(RelationModel rm) throws OrmException, SQLException { Collection<ColumnModel> cols = rm.getPrimaryKeyColumns(); List<String> pk = new ArrayList<>(cols.size()); for (ColumnModel cm : cols) { pk.add(cm.getColumnName().toUpperCase(Locale.US)); } return pk; }
Source:
public void onMediaDeleted(AztecAttributes aztecAttributes) { String localMediaId = aztecAttributes.getValue(ATTR_ID_WP); mUploadingMediaProgressMax.remove(localMediaId); if (!TextUtils.isEmpty(localMediaId)) { mEditorFragmentListener.onMediaDeleted(localMediaId); } removeCaptionFromDeletedMedia(localMediaId); }

Target:
public void onMediaDeleted(AztecAttributes aztecAttributes) { String localMediaId = aztecAttributes.getValue(ATTR_ID_WP); mUploadingMediaProgressMax.remove(localMediaId); if (!TextUtils.isEmpty(localMediaId)) { mEditorFragmentListener.onMediaDeleted(localMediaId); removeCaptionFromDeletedMedia(localMediaId); } }
Source:
public void release() { if (state == State.RELEASED) { return; } state = State.RELEASED; try { container.release(deployment, instance); } finally { try { instanceManager.poolInstance(new ThreadContext(deployment, null), instance); } catch (OpenEJBException e) { e.printStackTrace(); } instance = null; } }

Target:
public void release() { if (state == State.RELEASED) { return; } state = State.RELEASED; try { container.release(deployment, instance); } finally { if (instance != null) { try { instanceManager.poolInstance(new ThreadContext(deployment, null), instance); } catch (OpenEJBException e) { LOGGER.error("Unable to add instance back to the pool", e); } } instance = null; } }
Source:
protected boolean perform() { try { getParameters().setStartTime(new Date()); destinationHostLock = new EngineLock(hostLocking.getSetupNetworksLock(getDestinationVdsId())); lockManager.acquireLockWait(destinationHostLock); if (unplugPassthroughNics() && connectLunDisks(getDestinationVdsId()) && migrateVm()) { ExecutionHandler.setAsyncJob(getExecutionContext(), true); return true; } runningFailed(); return false; } catch (Exception e) { runningFailed(); throw e; } }

Target:
protected boolean perform() { try { getParameters().setStartTime(new Date()); if (unplugPassthroughNics() && connectLunDisks(getDestinationVdsId()) && migrateVm()) { ExecutionHandler.setAsyncJob(getExecutionContext(), true); return true; } runningFailed(); return false; } catch (Exception e) { runningFailed(); throw e; } }
Source:
public CreatorBuilder url(String url) throws CardBuilderException { boolean isValid = v.optional(v.notNullOrEmpty(url), "App store URL cannot be blank."); if (isValid) { try { this.url = new URL(url); } catch (MalformedURLException e) { v.required(v.fail(), "Could not parse URL from url string."); } } return this; }

Target:
public CreatorBuilder url(String url) throws CardBuilderException { boolean isValid = v.optional(v.notNullOrEmpty(url), "Creator URL cannot be blank."); if (isValid) { try { this.url = new URL(url); } catch (MalformedURLException e) { v.required(v.fail(), "Could not parse URL from url string."); } } return this; }
Source:
public void storeCommand() throws PersistenceException { cql = addUserConstraintToCql(user, cql); Function<List<Map<String, Object>>, Integer> listFunction = results -> { int count = 0; for (int i = 0; i < results.size(); i++) { Map<String, Object> curStore = PersistentItem.stripSuffixes(results.get(i)); console.println("Result {" + i + "}:"); if (headerSet.isEmpty()) { headerSet.addAll(curStore.keySet()); } for (String curKey : headerSet) { console.println(curKey + ":"); console.println("\t" + curStore.get(curKey).toString()); count++; } } return count; }; long totalCount = getResults(listFunction); console.println(""); console.println("Results found: " + totalCount + "\n"); }

Target:
public void storeCommand() throws PersistenceException { cql = addUserConstraintToCql(user, cql); Function<List<Map<String, Object>>, Integer> noOp = results -> { return results.size(); }; long totalCount = getResults(noOp); if (totalCount > 100) { console.println("Results found: " + totalCount + "\n"); console.println("Narrow the search criteria below 100 results to print"); return; } Function<List<Map<String, Object>>, Integer> listFunction = results -> { for (int i = 0; i < results.size(); i++) { Map<String, Object> curStore = PersistentItem.stripSuffixes(results.get(i)); console.println("Result {" + i + "}:"); if (headerSet.isEmpty()) { headerSet.addAll(curStore.keySet()); } for (String curKey : headerSet) { console.println(curKey + ":"); console.println("\t" + curStore.get(curKey).toString()); } } return results.size(); }; totalCount = getResults(listFunction); console.println(""); console.println("Results found: " + totalCount + "\n"); }
Source:
private void enableThing(Console console, ThingUID thingUID, boolean isEnabled) { if (thingRegistry.get(thingUID) == null) { console.println("unknwon thing for thingUID '" + thingUID.getAsString() + "'."); return; } thingManager.setEnabled(thingUID, isEnabled); String command = isEnabled ? "enabled" : "disabled"; console.println(thingUID.getAsString() + " successfully " + command + "."); }

Target:
private void enableThing(Console console, ThingUID thingUID, boolean isEnabled) { if (thingRegistry.get(thingUID) == null) { console.println("unknown thing for thingUID '" + thingUID.getAsString() + "'."); return; } thingManager.setEnabled(thingUID, isEnabled); String command = isEnabled ? "enabled" : "disabled"; console.println(thingUID.getAsString() + " successfully " + command + "."); }
Source:
public GlusterTaskInfoReturnForXmlRpc glusterVolumeRemoveBricksStart(String volumeName, String[] brickList, int replicaCount, Boolean forceRemove) { RequestBuilder rBuilder; if(forceRemove) { rBuilder = new RequestBuilder("GlusterVolume.removeBrickForce"); } else { rBuilder = new RequestBuilder("GlusterVolume.removeBrickStart"); } JsonRpcRequest request = rBuilder.withParameter("volumeName", volumeName) .withParameter("brickList", new ArrayList<String>(Arrays.asList(brickList))) .withParameter("replicaCount", replicaCount) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new GlusterTaskInfoReturnForXmlRpc(response); }

Target:
public GlusterTaskInfoReturnForXmlRpc glusterVolumeRemoveBricksStart(String volumeName, String[] brickList, int replicaCount, Boolean forceRemove) { String command = "GlusterVolume.removeBrickStart"; if(forceRemove) { command = "GlusterVolume.removeBrickForce"; } JsonRpcRequest request = new RequestBuilder(command).withParameter("volumeName", volumeName) .withParameter("brickList", new ArrayList<String>(Arrays.asList(brickList))) .withParameter("replicaCount", replicaCount) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new GlusterTaskInfoReturnForXmlRpc(response); }
Source:
public String copyResourceStep(String filePath) { final Resource res = resource(filePath); try (InputStream in = res.asInputStream()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try (OutputStream gz = new GZIPOutputStream(out)) { IOUtils.copy(in, gz); } return String.format("sh '''base64 --decode << ENDOFFILE | gunzip > %1$s \n%2$s\nENDOFFILE'''\n", res.getName(), new String(Base64.encodeBase64Chunked(out.toByteArray()))); } catch (IOException e) { throw new AssertionError(e); } }

Target:
public String copyResourceStep(String filePath) { final Resource res = resource(filePath); return String.format("sh '''%s'''%n", copyResourceShell(res, res.getName())); }
Source:
public void onReceive(Object message) { if (message instanceof Object[]) { Object messageAsArray = (Object[]) message; if (!(messageAsArray[0] instanceof Config)) { unhandled(message); } Object[] newMessage = new Object[] {messageAsArray[0], messageAsArray[1], getSender()}; boolean taskSent = false; for (ActorRef actorRef : this.pool.keySet()) { if (this.pool.get(actorRef)) { taskSent = true; actorRef.tell(newMessage, getSelf()); this.pool.put(actorRef, Boolean.FALSE); break; } } if (!taskSent) this.pool.keySet().iterator().next().tell(message, getSender()); } else if (message instanceof Message) { switch ((Message) message) { case AVAILABLE: this.pool.put(getSender(), Boolean.TRUE); break; default: unhandled(message); } } else unhandled(message); }

Target:
public void onReceive(Object message) { if (message instanceof ConfigActor) { boolean taskSent = false; ((ConfigActor)message).setClient(getSender()); for (ActorRef actorRef : this.pool.keySet()) { if (this.pool.get(actorRef)) { taskSent = true; actorRef.tell(message, getSelf()); this.pool.put(actorRef, Boolean.FALSE); break; } } if (!taskSent) this.pool.keySet().iterator().next().tell(message, getSender()); } else if (message instanceof Message) { switch ((Message) message) { case AVAILABLE: this.pool.put(getSender(), Boolean.TRUE); break; default: unhandled(message); } } else unhandled(message); }
Source:
OracleConnection unwrapConnection( Connection cx ) throws SQLException { if (cx == null) { return null; } if ( cx instanceof OracleConnection ) { return (OracleConnection) cx; } try { Connection testCon = cx; do { UnWrapper unwrapper = uwMap.get(testCon.getClass()); if (unwrapper == null) { unwrapper = DataSourceFinder.getUnWrapper(testCon); if (unwrapper == null) { unwrapper = UNWRAPPER_NOT_FOUND; } uwMap.put(testCon.getClass(), unwrapper); } if (unwrapper == UNWRAPPER_NOT_FOUND) { break; } testCon = unwrapper.unwrap(testCon); if (testCon instanceof OracleConnection) { return (OracleConnection) testCon; } } while (testCon != null); if (cx instanceof Wrapper) { try { Wrapper w = cx; if (w.isWrapperFor(OracleConnection.class)) { return w.unwrap(OracleConnection.class); } } catch (Throwable t) { LOGGER.log(Level.FINER, "Failed to unwrap connection using java 6 facilities", t); } } } catch(IOException e) { throw (SQLException) new SQLException( "Could not obtain native oracle connection.").initCause(e); } throw new SQLException( "Could not obtain native oracle connection for " + cx.getClass()); }

Target:
OracleConnection unwrapConnection( Connection cx ) throws SQLException { if (cx == null) { return null; } if ( cx instanceof OracleConnection ) { return (OracleConnection) cx; } try { Connection testCon = cx; Connection toUnwrap; do { UnWrapper unwrapper = uwMap.get(testCon.getClass()); if (unwrapper == null) { unwrapper = DataSourceFinder.getUnWrapper(testCon); if (unwrapper == null) { unwrapper = UNWRAPPER_NOT_FOUND; } uwMap.put(testCon.getClass(), unwrapper); } if (unwrapper == UNWRAPPER_NOT_FOUND) { break; } toUnwrap = testCon; testCon = unwrapper.unwrap(testCon); if (testCon instanceof OracleConnection) { return (OracleConnection) testCon; } } while (testCon != null && testCon != toUnwrap); if (cx instanceof Wrapper) { try { Wrapper w = cx; if (w.isWrapperFor(OracleConnection.class)) { return w.unwrap(OracleConnection.class); } } catch (Throwable t) { LOGGER.log(Level.FINER, "Failed to unwrap connection using java 6 facilities", t); } } } catch(IOException e) { throw (SQLException) new SQLException( "Could not obtain native oracle connection.").initCause(e); } throw new SQLException( "Could not obtain native oracle connection for " + cx.getClass()); }
Source:
private void processListing(CertifiedProductDetailsDTO cp) { try { LOGGER.info("Retrieving listing information for (" + cp.getId() + ") " + cp.getChplProductNumber()); CertifiedProductSearchDetails listing = certifiedProductDetailsManager.getCertifiedProductDetails(cp.getId()); if (curesUpdateService.isCuresUpdate(listing)) { LOGGER.info("************************** Updating " + cp.getId() + " as Cures Updated **************************"); updateListingAsCuresUpdated(listing); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } }

Target:
private void processListing(CertifiedProductDetailsDTO cp) { try { LOGGER.info("Retrieving listing information for (" + cp.getId() + ") " + cp.getChplProductNumber()); CertifiedProductSearchDetails listing = certifiedProductDetailsManager.getCertifiedProductDetails(cp.getId()); if (isListingActive(listing) && curesUpdateService.isCuresUpdate(listing)) { LOGGER.info("************************** Updating " + cp.getId() + " as Cures Updated **************************"); updateListingAsCuresUpdated(listing); } else { updateListingAsNotCuresUpdated(listing); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } }
Source:
private void lockImageInDb() { final DiskImage diskImage = getDiskImage(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntityStatus(diskImage.getImage()); diskImage.setImageStatus(ImageStatus.LOCKED); ImagesHandler.updateImageStatus(diskImage.getImageId(), ImageStatus.LOCKED); getCompensationContext().stateChanged(); return null; }); }

Target:
private void lockImageInDb() { final DiskImage diskImage = getDiskImage(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntityStatus(diskImage.getImage()); ImagesHandler.updateImageStatus(diskImage.getImageId(), ImageStatus.LOCKED); getCompensationContext().stateChanged(); return null; }); }
Source:
public GetObjectResult call() throws Exception { try { final Ds3ClientHelpers helpers = getClientHelpers(); final Path filePath = Paths.get(prefix, objectName); LOG.info("Output path: " + filePath.toString()); final Ds3Object ds3Obj = new Ds3Object(objectName.replace("\\", "/")); if (sync && SyncUtils.FileExists(filePath)) { final Iterable<Contents> objects = helpers.listObjects(bucketName); for (final Contents obj : objects){ if (ds3Obj.getName().equals(obj.getKey())) { if (SyncUtils.NeedToSync(filePath, obj, false)) { LOG.info("Syncing new version of " + objectName); Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished syncing object."); } else { LOG.info("No need to sync " + objectName); return new GetObjectResult("SUCCESS: No need to sync " + objectName); } } } } Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished downloading object. The object was written to: " + filePath); } catch(final FailedRequestException e) { if(e.getStatusCode() == 500) { LOG.info(e.getMessage()); if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException( "Error: Cannot communicate with the remote DS3 appliance.", e); } else if(e.getStatusCode() == 404) { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException( "Error: " + e.getMessage(), e); } else { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException( "Error: Encountered an unknown error of ("+ e.getStatusCode() +") while accessing the remote DS3 appliance.", e); } } }

Target:
public GetObjectResult call() throws Exception { try { final Ds3ClientHelpers helpers = getClientHelpers(); final Path filePath = Paths.get(prefix, objectName); LOG.info("Output path: " + filePath.toString()); final Ds3Object ds3Obj = new Ds3Object(objectName.replace("\\", "/")); if (sync && Utils.fileExists(filePath)) { if (SyncUtils.needToSync(helpers, bucketName, filePath, ds3Obj.getName(), false)) { Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished syncing object."); } else { return new GetObjectResult("SUCCESS: No need to sync " + objectName); } } Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished downloading object. The object was written to: " + filePath); } catch(final FailedRequestException e) { if(e.getStatusCode() == 500) { LOG.info(e.getMessage()); if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException( "Error: Cannot communicate with the remote DS3 appliance.", e); } else if(e.getStatusCode() == 404) { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException( "Error: " + e.getMessage(), e); } else { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException( "Error: Encountered an unknown error of ("+ e.getStatusCode() +") while accessing the remote DS3 appliance.", e); } } }
Source:
public void close() throws Exception { statisticsAggregation.close(); }

Target:
public void close() throws Exception { statisticsAggregationOperator.close(); }
Source:
public static @CheckForNull Fingerprint load(@NonNull byte[] md5sum) throws IOException { long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); Fingerprint loaded = FingerprintStorage.get().load(md5sum); initFacets(loaded); if(logger.isLoggable(Level.FINE)) logger.fine("Loading fingerprint took "+(System.currentTimeMillis()-start)+"ms"); return loaded; }

Target:
static @CheckForNull Fingerprint load(@NonNull byte[] md5sum) throws IOException { return load(Util.toHexString(md5sum)); }
Source:
private RowExpression inlineReferences(RowExpression expression, Assignments assignments, TypeProvider types) { if (isExpression(expression)) { return castToRowExpression(inlineReferences(castToExpression(expression), assignments, types)); } Function<VariableReferenceExpression, RowExpression> mapping = variable -> { if (assignments.get(variable) == null) { return variable; } return assignments.get(variable); }; return RowExpressionVariableInliner.inlineVariables(mapping, expression); }

Target:
private RowExpression inlineReferences(RowExpression expression, Assignments assignments, TypeProvider types) { if (isExpression(expression)) { Function<VariableReferenceExpression, Expression> mapping = variable -> { if (assignments.get(variable) == null) { return new SymbolReference(variable.getName()); } return castToExpression(assignments.get(variable)); }; return castToRowExpression(ExpressionVariableInliner.inlineVariables(mapping, castToExpression(expression), types)); } return RowExpressionVariableInliner.inlineVariables(variable -> assignments.getMap().getOrDefault(variable, variable), expression); }
Source:
protected Integer addToFacts( AggregatorFactory[] metrics, boolean deserializeComplexMetrics, boolean reportParseExceptions, InputRow row, AtomicInteger numEntries, TimeAndDims key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier ) throws IndexSizeExceededException { final Integer priorIndex = facts.get(key); Aggregator[] aggs; if (null != priorIndex) { aggs = concurrentGet(priorIndex); doAggregate(aggs, rowContainer, row, reportParseExceptions); } else { aggs = new Aggregator[metrics.length]; rowContainer.set(row); for (int i = 0; i < metrics.length; i++) { final AggregatorFactory agg = metrics[i]; aggs[i] = agg.factorize( selectors.get(agg.getName()) ); aggs[i].aggregate(); } rowContainer.set(null); final Integer rowIndex = indexIncrement.getAndIncrement(); concurrentSet(rowIndex, aggs); if (numEntries.get() >= maxRowCount && !facts.containsKey(key)) { throw new IndexSizeExceededException("Maximum number of rows [%d] reached", maxRowCount); } final Integer prev = facts.putIfAbsent(key, rowIndex); if (null == prev) { numEntries.incrementAndGet(); } else { aggs = concurrentGet(prev); doAggregate(aggs, rowContainer, row, reportParseExceptions); concurrentRemove(rowIndex); } } return numEntries.get(); }

Target:
protected Integer addToFacts( AggregatorFactory[] metrics, boolean deserializeComplexMetrics, boolean reportParseExceptions, InputRow row, AtomicInteger numEntries, TimeAndDims key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier ) throws IndexSizeExceededException { final Integer priorIndex = facts.get(key); Aggregator[] aggs; if (null != priorIndex) { aggs = concurrentGet(priorIndex); doAggregate(aggs, rowContainer, row, reportParseExceptions); } else { aggs = new Aggregator[metrics.length]; factorizeAggs(metrics, aggs, rowContainer, row); doAggregate(aggs, rowContainer, row, reportParseExceptions); final Integer rowIndex = indexIncrement.getAndIncrement(); concurrentSet(rowIndex, aggs); if (numEntries.get() >= maxRowCount && !facts.containsKey(key)) { throw new IndexSizeExceededException("Maximum number of rows [%d] reached", maxRowCount); } final Integer prev = facts.putIfAbsent(key, rowIndex); if (null == prev) { numEntries.incrementAndGet(); } else { aggs = concurrentGet(prev); doAggregate(aggs, rowContainer, row, reportParseExceptions); concurrentRemove(rowIndex); } } return numEntries.get(); }
Source:
@Override protected AbstractBinder getAuthBinder() { final Set<Class<? extends Principal>> principalClassSet = new HashSet<>(); principalClassSet.add(JsonPrincipal.class); principalClassSet.add(NullPrincipal.class); return new PolymorphicAuthValueFactoryProvider.Binder<Principal>(principalClassSet); }

Target:
@Override protected AbstractBinder getAuthBinder() { return new PolymorphicAuthValueFactoryProvider.Binder<>( ImmutableSet.of(JsonPrincipal.class, NullPrincipal.class)); }
Source:
public static Future<Boolean> tryUpdateAsync(final String transactionId) throws IOException { Future<Boolean> future = null; if (transactionExecutorMap.containsKey(transactionId)) { ExecutorService transactionUpdateExecutor = transactionExecutorMap.get(transactionId); future = transactionUpdateExecutor.submit(new Callable<Boolean>() { @Override public Boolean call() throws Exception { Boolean result = false; try { if (transactionExecutorMap.containsKey(transactionId) && transactionMap.containsKey(transactionId)) { Transaction read = transactionMap.get(transactionId); synchronized (read) { Path transactionPath = path(transactionId); if (transactionPath != null && Files.exists(transactionPath)) { final Path json = transactionPath.resolve(JSON); try (OutputStream output = Files.newOutputStream(json)) { objectMapper().writeValue(output, read); } } result = true; } } else { } } catch (IOException exception) { error(exception, "").log(); } return result; } }); } return future; }

Target:
public static Future<Boolean> tryUpdateAsync(final String transactionId) throws IOException { Future<Boolean> future = null; if (transactionExecutorMap.containsKey(transactionId)) { ExecutorService transactionUpdateExecutor = transactionExecutorMap.get(transactionId); future = transactionUpdateExecutor.submit(new Callable<Boolean>() { @Override public Boolean call() throws Exception { Boolean result = false; try { if (transactionExecutorMap.containsKey(transactionId) && transactionMap.containsKey(transactionId)) { Transaction read = transactionMap.get(transactionId); synchronized (read) { Path transactionPath = path(transactionId); if (transactionPath != null && Files.exists(transactionPath)) { final Path json = transactionPath.resolve(JSON); try (OutputStream output = Files.newOutputStream(json)) { objectMapper().writeValue(output, read); } } result = true; } } else { } } catch (IOException exception) { logBuilder().error(exception, "tryUpdateAsync: unexpected error encountered"); } return result; } }); } return future; }
Source:
private void findStartEngineUrl(String newLine) { if (newLine.contains("info page of Axon.ivy Engine") && !engineStarted.get()) { String url = StringUtils.substringBetween(newLine, "http://", "/"); url = "http://" + url + "/"; url += evaluateDefaultContext(url); context.log.info("Axon.ivy Engine runs on : " + url); context.properties.setMavenProperty(Property.TEST_ENGINE_URL, url); engineStarted.set(true); } }

Target:
private void findStartEngineUrl(String newLine) { if (newLine.contains("info page of Axon.ivy Engine") && !engineStarted.get()) { String url = "http://" + StringUtils.substringBetween(newLine, "http://", "/") + "/"; url += evaluateDefaultContext(url); context.log.info("Axon.ivy Engine runs on : " + url); context.properties.setMavenProperty(Property.TEST_ENGINE_URL, url); engineStarted.set(true); } }
Source:
GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map<String, GHPermissionType> permissions) { this.root = root; this.apiUrlTail = apiUrlTail; this.builder = root.retrieve().method("POST"); withPermissions(builder, permissions); }

Target:
GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map<String, GHPermissionType> permissions) { this.root = root; this.apiUrlTail = apiUrlTail; this.builder = root.createRequest(); withPermissions(builder, permissions); }
Source:
public static CsvIterator of(CharSource source, boolean headerRow, char separator) { ArgChecker.notNull(source, "source"); return Unchecked.wrap(() -> { BufferedReader reader = source.openBufferedStream(); if (!headerRow) { return new CsvIterator(reader, separator, ImmutableList.of(), ImmutableMap.of()); } String line = reader.readLine(); if (line == null) { throw new IllegalArgumentException("Could not read header row from empty CSV file"); } ImmutableList<String> headers = CsvFile.parseLine(line, separator); return new CsvIterator(reader, separator, headers, CsvFile.buildSearchHeaders(headers)); }); }

Target:
public static CsvIterator of(CharSource source, boolean headerRow, char separator) { ArgChecker.notNull(source, "source"); @SuppressWarnings("resource") BufferedReader reader = Unchecked.wrap(() -> source.openBufferedStream()); try { if (!headerRow) { return new CsvIterator(reader, separator, ImmutableList.of(), ImmutableMap.of()); } String line = reader.readLine(); if (line == null) { throw new IllegalArgumentException("Could not read header row from empty CSV file"); } ImmutableList<String> headers = CsvFile.parseLine(line, separator); return new CsvIterator(reader, separator, headers, CsvFile.buildSearchHeaders(headers)); } catch (RuntimeException ex) { try { reader.close(); } catch (IOException ex2) { ex.addSuppressed(ex2); } throw ex; } catch (IOException ex) { try { reader.close(); } catch (IOException ex2) { ex.addSuppressed(ex2); } throw new UncheckedIOException(ex); } }
Source:
public Object compute(Map<String, Object> combinedAggregators) { Object retVal = combinedAggregators.get(fieldName); if (retVal == null) { throw new ISE("Mismatch! Agg[%s] was not specified!", fieldName); } return retVal; }

Target:
public Object compute(Map<String, Object> combinedAggregators) { return combinedAggregators.get(fieldName); }
Source:
public void init() { try { final String filtersDirectoryString = APILocator.getFileAssetAPI().getRealAssetsRootPath() + File.separator + "server" + File.separator + "publishing-filters" + File.separator; final File basePath = new File(filtersDirectoryString); if (!basePath.exists()) { basePath.mkdir(); final String systemFiltersDirectory = "com" + File.separator + "dotcms" + File.separator + "publishing-filters" + File.separator; final String systemFiltersPathString = Thread.currentThread() .getContextClassLoader().getResource(systemFiltersDirectory).getPath(); final File systemFilters = new File(systemFiltersPathString); Files.list(systemFilters.toPath()).forEach(filter -> { try { Files.copy(filter, Paths.get(filtersDirectoryString + filter.getFileName())); } catch (IOException e) { Logger.error(this, e.getMessage(), e); } }); Logger.debug(PushPublishFiltersInitializer.class, " dotcms filters files copied"); } Logger.info(PushPublishFiltersInitializer.class, " ymlFiles are set under: " + filtersDirectoryString); Files.list(basePath.toPath()).forEach(this::loadFilter); } catch (IOException e) { Logger.error(this, e.getMessage(), e); } }

Target:
public void init() { try { final String filtersDirectoryString = APILocator.getFileAssetAPI().getRealAssetsRootPath() + File.separator + "server" + File.separator + "publishing-filters" + File.separator; final File basePath = new File(filtersDirectoryString); if (!basePath.exists()) { basePath.mkdir(); final String systemFiltersDirectory = "com" + File.separator + "dotcms" + File.separator + "publishing-filters" + File.separator; final String systemFiltersPathString = Thread.currentThread() .getContextClassLoader().getResource(systemFiltersDirectory).getPath(); final File systemFilters = new File(systemFiltersPathString); Files.list(systemFilters.toPath()).forEach(filter -> { try { Files.copy(filter, Paths.get(filtersDirectoryString + filter.getFileName())); } catch (IOException e) { Logger.error(this, e.getMessage(), e); } }); Logger.debug(PushPublishFiltersInitializer.class, ()->" dotcms filters files copied"); } Logger.info(PushPublishFiltersInitializer.class, " ymlFiles are set under: " + filtersDirectoryString); Files.list(basePath.toPath()).forEach(this::loadFilter); } catch (IOException e) { Logger.error(this, e.getMessage(), e); } }
Source:
public InputStream getInputStream() { inputStream = provider.getInputStream(); if (inputStream != null) { inputStream = new FilterInputStream(inputStream) { @Override public int read(byte[] b, int off, int len) throws IOException { int bytes = super.read(b, off, len); byte[] payload = new byte[bytes]; System.arraycopy(b, off, payload, 0, bytes); if (logToStderr) { System.err.println(id + " to LSP4E:" + new String(payload)); } if (logToFile) { log("\n" + id + " to LSP4E:" + new String(payload)); } return bytes; } }; } return inputStream; }

Target:
public InputStream getInputStream() { if (inputStream != null) { return inputStream; } if (provider.getInputStream() != null) { inputStream = new FilterInputStream(provider.getInputStream()) { @Override public int read(byte[] b, int off, int len) throws IOException { int bytes = super.read(b, off, len); byte[] payload = new byte[bytes]; System.arraycopy(b, off, payload, 0, bytes); if (logToStderr) { System.err.println(id + " to LSP4E:" + new String(payload)); } if (logToFile) { log("\n" + id + " to LSP4E:" + new String(payload)); } return bytes; } }; } return inputStream; }
Source:
public void assumeNotNullThrowsException() { try { Object[] objects = {1, 2, null}; assumeNotNull(objects); fail("should throw AssumptionViolatedException"); } catch (AssumptionViolatedException e) { } }

Target:
public void assumeNotNullThrowsException() { Object[] objects = {1, 2, null}; assumeNotNull(objects); }
Source:
public TotalItem(final String measureIdentifier, final Total total, final String attributeIdentifier) { this(measureIdentifier, notNull(total.toString(), "total"), attributeIdentifier); }

Target:
public TotalItem(final String measureIdentifier, final Total total, final String attributeIdentifier) { this(measureIdentifier, notNull(total, "total").toString(), attributeIdentifier); }
Source:
public void channelLinked(ChannelUID channelUID) { onLightStateChanged(null, getHueBridgeHandler().getLightById(lightId)); }

Target:
public void channelLinked(ChannelUID channelUID) { HueBridgeHandler handler = getHueBridgeHandler(); if (handler != null) { onLightStateChanged(null, handler.getLightById(lightId)); } }
Source:
GroupType(Repetition repetition, String name, OriginalType originalType, List<Type> fields, ID id) { super(name, repetition, originalType, id); if (fields.size() == 0) { throw new InvalidSchemaException("A group type can not be empty. Parquet does not support empty group without leaves. Empty group: " + name); } this.fields = fields; this.indexByName = new HashMap<String, Integer>(); for (int i = 0; i < fields.size(); i++) { indexByName.put(fields.get(i).getName(), i); } }

Target:
GroupType(Repetition repetition, String name, OriginalType originalType, List<Type> fields, ID id) { super(name, repetition, originalType, id); if (fields.isEmpty()) { throw new InvalidSchemaException("A group type can not be empty. Parquet does not support empty group without leaves. Empty group: " + name); } this.fields = fields; this.indexByName = new HashMap<String, Integer>(); for (int i = 0; i < fields.size(); i++) { indexByName.put(fields.get(i).getName(), i); } }
Source:
public static String toECLRecord(FieldDef field) throws Exception { if (field.getFieldType() != FieldType.RECORD) { throw new Exception("Invalid record structure. Root object must of type Record"); } HashMap<String, String> recordDefinitionMap = new HashMap<String, String>(); String rootRecordName = getEClTypeDefinition(field, recordDefinitionMap); String rootDefinition = recordDefinitionMap.get(rootRecordName); recordDefinitionMap.remove(rootRecordName); rootDefinition = rootDefinition.replace(rootRecordName, "RD"); String definition = ""; for (HashMap.Entry<String, String> entry : recordDefinitionMap.entrySet()) { definition += "\n\n" + entry.getKey() + " := " + entry.getValue(); } definition += "\n\n" + rootDefinition; int numRecordDefinitions = 1; for (HashMap.Entry<String, String> entry : recordDefinitionMap.entrySet()) { definition = definition.replace(entry.getKey(), "RD" + numRecordDefinitions); numRecordDefinitions++; } return definition; }

Target:
public static String toECLRecord(FieldDef field) throws Exception { if (field.getFieldType() != FieldType.RECORD) { throw new Exception("Invalid record structure. Root object must of type Record"); } HashMap<String, String> recordDefinitionMap = new HashMap<String, String>(); String rootRecordName = getEClTypeDefinition(field, recordDefinitionMap); String rootDefinition = recordDefinitionMap.get(rootRecordName); recordDefinitionMap.remove(rootRecordName); rootDefinition = rootDefinition.replace(rootRecordName, "RD"); StringBuilder sb = new StringBuilder(8192); for (HashMap.Entry<String, String> entry : recordDefinitionMap.entrySet()) { sb.append("\n\n"); sb.append(entry.getKey()); sb.append(" := "); sb.append(entry.getValue()); } sb.append("\n\n"); sb.append(rootDefinition); String definition = sb.toString(); int numRecordDefinitions = 1; for (HashMap.Entry<String, String> entry : recordDefinitionMap.entrySet()) { definition = definition.replace(entry.getKey(), "RD" + numRecordDefinitions); numRecordDefinitions++; } return definition; }
Source:
private File makeJunction(File baseDir, File pointToDir) throws Exception { File junc = new File(baseDir, "testJunction"); Process p = Runtime.getRuntime().exec("cmd.exe /C \"mklink /J " + junc.getPath() + " " + pointToDir.getPath() + "\""); p.waitFor(); return junc; }

Target:
private File makeJunction(File baseDir, File pointToDir) throws Exception { File junc = new File(baseDir, "test Junction"); String cmd = "mklink /J \"" + junc.getPath() + "\" \"" + pointToDir.getPath() + "\""; ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/C", cmd); pb.inheritIO(); Process p = pb.start(); assertEquals("Running mklink failed (cmd=" + cmd + ")", 0, p.waitFor()); return junc; }
Source:
public void testPathFilterBucketedPartitionedTable() throws Exception { final List<Column> partitionColumns = new ArrayList(); partitionColumns.add(new Column(TEST_PARTITION_COLUMN_NAME, HIVE_INT, Optional.empty())); final Table partitionedTable = getTable(partitionColumns); final BackgroundHiveSplitLoader backgroundHiveSplitLoader = getBackgroundHiveSplitLoader(getFiles(), getPathTupleDomain(returnedPath), getBuckets(MAX_BUCKETS), partitionedTable); final HiveSplitSource hiveSplitSource = new HiveSplitSource(1, backgroundHiveSplitLoader, mockExecutor); backgroundHiveSplitLoader.start(hiveSplitSource); assertEquals(1, hiveSplitSource.getOutstandingSplitCount()); final List<ConnectorSplit> connectorSplits = hiveSplitSource.getNextBatch(1).get(); assertEquals(1, connectorSplits.size()); final HiveSplit connectorSplit = (HiveSplit) connectorSplits.get(0); assertEquals(returnedPath.toString(), connectorSplit.getPath()); }

Target:
public void testPathFilterBucketedPartitionedTable() throws Exception { BackgroundHiveSplitLoader backgroundHiveSplitLoader = backgroundHiveSplitLoader( TEST_FILES, RETURNED_PATH_DOMAIN, ImmutableList.of(), PARTITIONED_TABLE, Optional.of( new HiveBucketHandle( getRegularColumnHandles(TEST_CONNECTOR_ID, PARTITIONED_TABLE), BUCKET_COUNT))); HiveSplitSource hiveSplitSource = hiveSplitSource(backgroundHiveSplitLoader); backgroundHiveSplitLoader.start(hiveSplitSource); assertEquals(1, hiveSplitSource.getOutstandingSplitCount()); List<ConnectorSplit> connectorSplits = hiveSplitSource.getNextBatch(1).get(); assertEquals(1, connectorSplits.size()); assertEquals(RETURNED_PATH.toString(), ((HiveSplit) connectorSplits.get(0)).getPath()); }
Source:
public void validDiscoveryResultIfWithoutBaseUrl() throws ValidationException { RemoteDevice fsInternetRadioDeviceWithoutUrl = createDefaultFSInternetRadioDevice(null); final DiscoveryResult result = discoveryParticipant.createResult(fsInternetRadioDeviceWithoutUrl); assertThat("A result with wrong thingUID was created for a FSInternetRadio device without base URL", result.getThingUID(), is(new ThingUID(DEFAULT_RADIO_THING_UID))); assertThat("A result with wrong thingTypeUID was created for a FSInternetRadio device without base URL", result.getThingTypeUID(), is(FSInternetRadioBindingConstants.THING_TYPE_RADIO)); assertThat("A result with wrong manifacturer was created for a FSInternetRadio device without base URL", result.getProperties().get(FSInternetRadioBindingConstants.PROPERTY_MANUFACTURER), is(DEFAULT_RADIO_MANIFACTURER)); assertThat("A result with wrong model number was created for a FSInternetRadio device without base URL", result.getProperties().get(FSInternetRadioBindingConstants.PROPERTY_MODEL), is(DEFAULT_RADIO_MODEL_NUMBER)); }

Target:
public void validDiscoveryResultIfWithoutBaseUrl() throws ValidationException { RemoteDevice fsInternetRadioDeviceWithoutUrl = createDefaultFSInternetRadioDevice(null); final DiscoveryResult result = discoveryParticipant.createResult(fsInternetRadioDeviceWithoutUrl); assertEquals(new ThingUID(DEFAULT_RADIO_THING_UID), result.getThingUID()); assertEquals(FSInternetRadioBindingConstants.THING_TYPE_RADIO, result.getThingTypeUID()); assertEquals(DEFAULT_RADIO_MANIFACTURER, result.getProperties().get(FSInternetRadioBindingConstants.PROPERTY_MANUFACTURER)); assertEquals(DEFAULT_RADIO_MODEL_NUMBER, result.getProperties().get(FSInternetRadioBindingConstants.PROPERTY_MODEL)); }
Source:
public static String getWebHost(final IServer server) throws ExecutionException { final String serverType = server.getServerType().getId(); final Object adapter = server.loadAdapter(ServerDelegate.class, null); if (serverType.equals(OPENSHIFT_SERVER_TYPE)) { if(adapter instanceof IExtendedPropertiesProvider) { final IExtendedPropertiesProvider propertiesProvider = (IExtendedPropertiesProvider) adapter; try { final URL welcomePageURL = new URL(propertiesProvider.getExtendedProperties().getWelcomePageUrl()); return welcomePageURL.getHost(); } catch (MalformedURLException | GetWelcomePageURLException e) { throw new ExecutionException("Failed to retrieve the hostname for the selected server", e ); } } } return server.getHost(); }

Target:
public static String getWebHost(final IServer server) throws CoreException { return server.getHost(); }
Source:
public ValueHolder<V> compute(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) { return map.compute(key, new BiFunction<K, ValueHolder<V>, ValueHolder<V>>() { @Override public ValueHolder<V> apply(final K k, final ValueHolder<V> vValueHolder) { return nullSafeValueHolder(remappingFunction.apply(k, vValueHolder.value())); } }); }

Target:
public ValueHolder<V> compute(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) { return map.compute(key, new BiFunction<K, ValueHolder<V>, ValueHolder<V>>() { @Override public ValueHolder<V> apply(final K k, final ValueHolder<V> vValueHolder) { return nullSafeValueHolder(remappingFunction.apply(k, vValueHolder == null ? null : vValueHolder.value())); } }); }
Source:
public void sentNotification() { final String message = "Subject \n message body"; final String topic = "Test Topic"; final String sub = "Test Subject"; final String body = "Test Body"; final AmazonSNS aws = Mockito.mock(AmazonSNS.class); final SNSClient client = Mockito.mock(SNSClient.class); final PublishResult result = Mockito.mock(PublishResult.class); final PublishRequest request = Mockito .mock(PublishRequest.class); Mockito.doReturn(request).when(request) .withTopicArn(topic); Mockito.doReturn(request).when(request) .withMessage(body); Mockito.doReturn(request).when(request).withSubject(sub); Mockito.doReturn(aws).when(client).get(); Mockito.doReturn(result).when(aws).publish(request); new SNS(topic, client).announce(message); MatcherAssert.assertThat( result, Matchers.equalTo(aws.publish(request)) ); MatcherAssert.assertThat( request, Matchers.equalTo(request.withTopicArn(topic)) ); MatcherAssert.assertThat( request, Matchers.equalTo(request.withMessage(body)) ); MatcherAssert.assertThat( request, Matchers.equalTo(request.withSubject(sub)) ); Mockito.verify(aws, Mockito.atLeast(1)).publish(request); }

Target:
public void sentNotification() { final String message = "Subject \n message body"; final String topic = "Test Topic"; final AmazonSNS aws = Mockito.mock(AmazonSNS.class); final SNSClient client = Mockito.mock(SNSClient.class); final PublishResult result = Mockito.mock(PublishResult.class); final PublishRequest request = Mockito .mock(PublishRequest.class); Mockito.doReturn(aws).when(client).get(); Mockito.doReturn(result).when(aws).publish(request); new SNS(topic, client).announce(message); MatcherAssert.assertThat( aws.publish(request) , Matchers.equalTo(result) ); Mockito.verify(aws); }