auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initializeDatastream(Datastream stream, List<Datastream> allDatastreams) throws DatastreamValidationException { LOG.info("validating datastream " + stream.toString()); try { MysqlSource source = MysqlSource.createFromUri(stream.getSource().getConnectionString()); if (source.getSourceType() != _sourceType) { String msg = String.format("Connector can support datastreams of source type: %s", _sourceType); LOG.error(msg); throw new DatastreamValidationException(msg); } if (_sourceType == SourceType.MYSQLSERVER) { MysqlQueryUtils queryUtils = new MysqlQueryUtils(source, getUserNameFromDatastream(stream), getPasswordFromDatastream(stream)); queryUtils.initializeConnection(); if (!queryUtils.checkTableExist(source.getDatabaseName(), source.getTableName())) { throw new DatastreamValidationException( String.format("Invalid datastream: Can't find table %s in db %s.", source.getDatabaseName(), source.getTableName())); } queryUtils.closeConnection(); } else { File binlogFolder = new File(source.getBinlogFolderName()); if (!binlogFolder.exists()) { String msg = String.format("BinlogFolder %s doesn't exist", binlogFolder.getAbsolutePath()); LOG.error(msg); throw new DatastreamValidationException(msg); } } if (stream.getSource().hasPartitions() && stream.getSource().getPartitions() != 1) { String msg = "Mysql connector can only support single partition sources"; LOG.error(msg); throw new DatastreamValidationException(msg); } } catch (SourceNotValidException | SQLException e) { throw new DatastreamValidationException(e); } }

Target:
public void initializeDatastream(Datastream stream, List<Datastream> allDatastreams) throws DatastreamValidationException { LOG.info("validating datastream " + stream.toString()); try { MysqlSource source = MysqlSource.createFromUri(stream.getSource().getConnectionString()); if (source.getSourceType() != _sourceType) { String msg = String.format("Connector can only support datastreams of source type: %s", _sourceType); LOG.error(msg); throw new DatastreamValidationException(msg); } if (_sourceType == SourceType.MYSQLSERVER) { MysqlQueryUtils queryUtils = new MysqlQueryUtils(source, getUserNameFromDatastream(stream), getPasswordFromDatastream(stream)); try { queryUtils.initializeConnection(); if (!queryUtils.checkTableExist(source.getDatabaseName(), source.getTableName())) { throw new DatastreamValidationException( String.format("Invalid datastream: Can't find table %s in db %s.", source.getDatabaseName(), source.getTableName())); } } finally { queryUtils.closeConnection(); } } else { File binlogFolder = new File(source.getBinlogFolderName()); if (!binlogFolder.exists()) { String msg = String.format("BinlogFolder %s doesn't exist", binlogFolder.getAbsolutePath()); LOG.error(msg); throw new DatastreamValidationException(msg); } } if (stream.getSource().hasPartitions() && stream.getSource().getPartitions() != 1) { String msg = "Mysql connector can only support single partition sources"; LOG.error(msg); throw new DatastreamValidationException(msg); } } catch (SourceNotValidException | SQLException e) { throw new DatastreamValidationException(e); } }
Source:
public void testGetIntersectingElementsRange() { Iterable<ISegment> intersectingElements; intersectingElements = fSegmentStore.getIntersectingElements(16, 20); assertEquals(0, Iterables.size(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(1, 15); assertEquals(5, Iterables.size(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(2, 14); assertEquals(5, Iterables.size(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(11, 13); assertEquals(1, Iterables.size(intersectingElements)); assert (SEGMENT_10_14.equals(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(10, 14); assertEquals(1, Iterables.size(intersectingElements)); assert (SEGMENT_10_14.equals(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(14, 18); assertEquals(1, Iterables.size(intersectingElements)); assert (SEGMENT_10_14.equals(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(1, 2); assertEquals(1, Iterables.size(intersectingElements)); assert (SEGMENT_2_6.equals(intersectingElements)); }

Target:
public void testGetIntersectingElementsRange() { Iterable<ISegment> intersectingElements; intersectingElements = fSegmentStore.getIntersectingElements(16, 20); assertEquals(0, Iterables.size(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(1, 15); assertEquals(5, Iterables.size(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(2, 14); assertEquals(5, Iterables.size(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(11, 13); assertEquals(1, Iterables.size(intersectingElements)); assertEquals(SEGMENT_10_14, Iterables.getOnlyElement(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(10, 14); assertEquals(1, Iterables.size(intersectingElements)); assertEquals(SEGMENT_10_14, Iterables.getOnlyElement(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(14, 18); assertEquals(1, Iterables.size(intersectingElements)); assertEquals(SEGMENT_10_14, Iterables.getOnlyElement(intersectingElements)); intersectingElements = fSegmentStore.getIntersectingElements(1, 2); assertEquals(1, Iterables.size(intersectingElements)); assertEquals(SEGMENT_2_6, Iterables.getOnlyElement(intersectingElements)); }
Source:
private void drawMapMatched(List<Point> coordinates) { try { MapboxMapMatching client = MapboxMapMatching.builder() .accessToken(Mapbox.getAccessToken()) .profile(PROFILE_DRIVING) .coordinates(coordinates) .build(); client.enqueueCall(new Callback<MapMatchingResponse>() { @Override public void onResponse(Call<MapMatchingResponse> call, Response<MapMatchingResponse> response) { List<LatLng> mapMatchedPoints = new ArrayList<>(); if (response.code() == 200) { String geometry = response.body().matchings().get(0).geometry(); List<Position> positions = PolylineUtils.decode(geometry, Constants.PRECISION_6); if (positions == null) { return; } for (int i = 0; i < positions.size(); i++) { mapMatchedPoints.add(new LatLng( positions.get(i).getLatitude(), positions.get(i).getLongitude())); } if (mapMatchedRoute != null) { map.removeAnnotation(mapMatchedRoute); } mapMatchedRoute = map.addPolyline(new PolylineOptions() .addAll(mapMatchedPoints) .color(Color.parseColor("#3bb2d0")) .width(4)); } else { Log.e(TAG, "Too many coordinates, profile not found, invalid input, or no match."); } } @Override public void onFailure(Call<MapMatchingResponse> call, Throwable throwable) { Log.e(TAG, "MapboxMapMatching error: " + throwable.getMessage()); } }); } catch (ServicesException servicesException) { Log.e(TAG, "MapboxMapMatching error: " + servicesException.getMessage()); servicesException.printStackTrace(); } }

Target:
private void drawMapMatched(List<Point> coordinates) { try { MapboxMapMatching client = MapboxMapMatching.builder() .accessToken(Mapbox.getAccessToken()) .profile(PROFILE_DRIVING) .coordinates(coordinates) .build(); client.enqueueCall(new Callback<MapMatchingResponse>() { @Override public void onResponse(Call<MapMatchingResponse> call, Response<MapMatchingResponse> response) { List<LatLng> mapMatchedPoints = new ArrayList<>(); if (response.code() == 200) { String geometry = response.body().matchings().get(0).geometry(); List<Point> pointList = PolylineUtils.decode(geometry, Constants.PRECISION_6); if (pointList == null) { return; } for (Point singlePosition : pointList) { mapMatchedPoints.add(new LatLng(singlePosition.latitude(), singlePosition.longitude())); } if (mapMatchedRoute != null) { map.removeAnnotation(mapMatchedRoute); } mapMatchedRoute = map.addPolyline(new PolylineOptions() .addAll(mapMatchedPoints) .color(Color.parseColor("#3bb2d0")) .width(4)); } else { Log.e(TAG, "Too many coordinates, profile not found, invalid input, or no match."); } } @Override public void onFailure(Call<MapMatchingResponse> call, Throwable throwable) { Log.e(TAG, "MapboxMapMatching error: " + throwable.getMessage()); } }); } catch (ServicesException servicesException) { Log.e(TAG, "MapboxMapMatching error: " + servicesException.getMessage()); servicesException.printStackTrace(); } }
Source:
protected void removeTranslations() { mango.select(MongoTranslation.class) .eq(Translation.TRANSLATION_DATA.inner(TranslationData.OWNER), owner.getUniqueName()) .delete(); }

Target:
protected void removeTranslations() { mongo.delete() .where(Translation.TRANSLATION_DATA.inner(TranslationData.OWNER), owner.getUniqueName()) .manyFrom(MongoTranslation.class); }
Source:
public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) { if (aSelection == null || aSelection.isEmpty()) { return; } IFile file = null; if ((aSelection.getFirstElement() instanceof TmfTraceElement)) { TmfTraceElement fTrace = ((TmfTraceElement)aSelection.getFirstElement()); final TmfTraceElement traceElement = fTrace.getElementUnderTraceFolder(); final IResource resource = traceElement.getResource(); if (resource instanceof IFile) { file = (IFile) resource; } else if (resource instanceof IFolder) { file = ((IFolder) resource).getFile(traceElement.getName() + '_'); } } else if ((aSelection.getFirstElement() instanceof TmfExperimentElement)) { TmfExperimentElement experimentElement = (TmfExperimentElement) aSelection.getFirstElement(); file = experimentElement.getResource().getFile(experimentElement.getName() + '_'); } if (file != null) { IEditorInput tmpInput = new FileEditorInput(file); IEditorPart localEditor = aPage.findEditor(tmpInput); if (localEditor != null) { aPage.activate(localEditor); aPage.bringToTop(localEditor); } else { IEditorReference[] refs = aPage.getEditorReferences(); for (IEditorReference editorReference : refs) { try { if (editorReference.getEditorInput().equals(tmpInput)) { editorReference.getEditor(true); aPage.bringToTop(editorReference.getEditor(false)); } } catch (PartInitException e) { } } } } }

Target:
public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) { if (aSelection == null || aSelection.isEmpty()) { return; } IFile file = null; if ((aSelection.getFirstElement() instanceof TmfTraceElement)) { TmfTraceElement traceElement = ((TmfTraceElement)aSelection.getFirstElement()); traceElement = traceElement.getElementUnderTraceFolder(); final IResource resource = traceElement.getResource(); if (resource instanceof IFile) { file = (IFile) resource; } else if (resource instanceof IFolder) { file = ((IFolder) resource).getFile(traceElement.getName() + '_'); } } else if ((aSelection.getFirstElement() instanceof TmfExperimentElement)) { TmfExperimentElement experimentElement = (TmfExperimentElement) aSelection.getFirstElement(); file = experimentElement.getResource().getFile(experimentElement.getName() + '_'); } if (file != null) { IEditorInput tmpInput = new FileEditorInput(file); IEditorPart localEditor = aPage.findEditor(tmpInput); if (localEditor != null) { aPage.activate(localEditor); aPage.bringToTop(localEditor); } else { IEditorReference[] refs = aPage.getEditorReferences(); for (IEditorReference editorReference : refs) { try { if (editorReference.getEditorInput().equals(tmpInput)) { localEditor = editorReference.getEditor(true); if (localEditor != null) { aPage.bringToTop(localEditor); } } } catch (PartInitException e) { } } } } }
Source:
MarkerBackTrackingAlgorithm(List<MarkerHolder> oldMarkers, List<MarkerHolder> currentMarkers) { this.oldMarkers = oldMarkers; this.currentMarkers = currentMarkers; this.oldSize = oldMarkers.size(); this.currentSize = currentMarkers.size(); memoization = new int[oldSize + 1][currentSize + 1]; }

Target:
MarkerBackTrackingAlgorithm(List<MarkerHolder> oldMarkers, List<MarkerHolder> currentMarkers) { this.oldMarkers = oldMarkers; this.currentMarkers = currentMarkers; this.oldSize = oldMarkers.size(); this.currentSize = currentMarkers.size(); this.memoization = new int[oldSize + 1][currentSize + 1]; this.createdWarningTypes = new ArrayList<>(); this.removedWarningTypes = new ArrayList<>(); }
Source:
public Object invoke(PageContext pc, Object[] args) throws PageException { if (args.length < 2) { throw new FunctionException(pc, "StringSome", 2, 3, args.length); } return call(pc, Caster.toString(args[0]), Caster.toFunction(args[1]), args[2]); }

Target:
public Object invoke(PageContext pc, Object[] args) throws PageException { if(args.length==2) { return call(pc, Caster.toString(args[0]), Caster.toFunction(args[1]), null); } else if(args.length==3) { return call(pc, Caster.toString(args[0]), Caster.toFunction(args[1]), args[2]); } else { throw new FunctionException(pc, "StringReduce", 2, 3, args.length); } }
Source:
public Collection<EntityProjection> make(String query) { Parser parser = new Parser(); Document parsedDocument = parser.parseDocument(query); fragmentMap.clear(); List<FragmentDefinition> fragmentDefinitions = parsedDocument.getDefinitions().stream() .filter(definition -> definition instanceof FragmentDefinition) .map(definition -> (FragmentDefinition) definition) .collect(Collectors.toList()); fragmentMap.putAll(FragmentResolver.resolve(fragmentDefinitions)); parsedDocument.getDefinitions().forEach(definition -> { if (definition instanceof OperationDefinition) { OperationDefinition operationDefinition = (OperationDefinition) definition; if (operationDefinition.getOperation() == OperationDefinition.Operation.MUTATION) { return; } addRootProjection(operationDefinition.getSelectionSet()); } else if (!(definition instanceof FragmentDefinition)) { throw new InvalidEntityBodyException( String.format("Unsupported definition type {%s}.", definition.getClass())); } }); return rootProjections; }

Target:
public GraphQLProjectionInfo make(String query) { Parser parser = new Parser(); Document parsedDocument = parser.parseDocument(query); fragmentResolver.addFragments(parsedDocument); parsedDocument.getDefinitions().forEach(definition -> { if (definition instanceof OperationDefinition) { OperationDefinition operationDefinition = (OperationDefinition) definition; if (operationDefinition.getOperation() == OperationDefinition.Operation.SUBSCRIPTION) { return; } variableResolver.newScope(operationDefinition); addRootProjection(operationDefinition.getSelectionSet()); } else if (!(definition instanceof FragmentDefinition)) { throw new InvalidEntityBodyException( String.format("Unsupported definition type {%s}.", definition.getClass())); } }); return new GraphQLProjectionInfo(rootLocation, rootProjections, relationshipMap); }
Source:
protected void processMonoValuedEReference(EReference eReference, SIRIUS processedDescription, SIRIUS currentDescription, TransformationCache cache) { if (!processedDescription.eIsSet(eReference)) { Object currentValue = currentDescription.eGet(eReference); if (currentValue instanceof EObject) { IDescriptionPreprocessor preprocessor = SiriusPropertiesCorePlugin.getPlugin().getDescriptionPreprocessor((EObject) currentValue); if (preprocessor != null) { Object processedValue = preprocessor.convert((EObject) currentValue, cache); processedDescription.eSet(eReference, processedValue); } } } }

Target:
protected void processMonoValuedEReference(EReference eReference, SIRIUS processedDescription, SIRIUS currentDescription, TransformationCache cache) { if (!processedDescription.eIsSet(eReference)) { Object currentValue = currentDescription.eGet(eReference); if (currentValue instanceof EObject) { Optional<IDescriptionPreprocessor> preprocessor = SiriusPropertiesCorePlugin.getPlugin().getDescriptionPreprocessor((EObject) currentValue); if (preprocessor.isPresent()) { Object processedValue = preprocessor.get().convert((EObject) currentValue, cache); processedDescription.eSet(eReference, processedValue); } } } }
Source:
public static RootDSE get(LdapProviderType ldapProviderType, Attributes rootDseRecords) throws NumberFormatException, NamingException { switch (ldapProviderType) { case activeDirectory: return new ADRootDSE(rootDseRecords); case ipa: return new IPARootDSE(rootDseRecords); case rhds: return new RHDSRootDSE(rootDseRecords); case itds: return new ITDSRootDSE(rootDseRecords); case openLdap: return new DefaultRootDSE(rootDseRecords); default: return new DefaultRootDSE(rootDseRecords); } }

Target:
public static RootDSE get(LdapProviderType ldapProviderType, Attributes rootDseRecords) throws NumberFormatException, NamingException { switch (ldapProviderType) { case activeDirectory: return new ADRootDSE(rootDseRecords); case ipa: return new IPARootDSE(rootDseRecords); case rhds: return new RHDSRootDSE(rootDseRecords); case itds: return new ITDSRootDSE(rootDseRecords); case openLdap: return new DefaultRootDSE(rootDseRecords); default: throw new IllegalArgumentException("Invalid LDAP provider type."); } }
Source:
private static RelNode trimUnusedfields(RelNode relNode) { final List<RelOptTable> relOptTables = RelOptUtil.findAllTables(relNode); final RelOptSchema relOptSchema = relOptTables.get(0).getRelOptSchema(); final RelBuilder relBuilder = RelFactories.LOGICAL_BUILDER.create( relNode.getCluster(), relOptSchema); final RelFieldTrimmer relFieldTrimmer = new RelFieldTrimmer(null, relBuilder); final RelNode rel = relFieldTrimmer.trim(relNode); return rel; }

Target:
private static RelNode trimUnusedfields(RelNode relNode) { final List<RelOptTable> relOptTables = RelOptUtil.findAllTables(relNode); RelOptSchema relOptSchema = null; if (relOptTables.size() != 0) { relOptSchema = relOptTables.get(0).getRelOptSchema(); } final RelBuilder relBuilder = RelFactories.LOGICAL_BUILDER.create( relNode.getCluster(), relOptSchema); final RelFieldTrimmer relFieldTrimmer = new RelFieldTrimmer(null, relBuilder); final RelNode rel = relFieldTrimmer.trim(relNode); return rel; }
Source:
protected Handler createAppServlet(Server server, JerseyEnvironment jersey, ObjectMapper objectMapper, Validator validator, MutableServletContextHandler handler, @Nullable Servlet jerseyContainer, MetricRegistry metricRegistry) { configureSessionsAndSecurity(handler, server); handler.addFilter(AllowedMethodsFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)) .setInitParameter(AllowedMethodsFilter.ALLOWED_METHODS_PARAM, Joiner.on(',').join(allowedMethods)); handler.addFilter(ThreadNameFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); if (gzip.isEnabled()) { final FilterHolder holder = new FilterHolder(gzip.build()); handler.addFilter(holder, "/*", EnumSet.allOf(DispatcherType.class)); } if (jerseyContainer != null) { String urlPattern = jerseyRootPath; if (!urlPattern.endsWith("/")) { urlPattern += "/"; } if (!urlPattern.endsWith("*")) { urlPattern += "*"; } jersey.setUrlPattern(urlPattern); jersey.register(new JacksonMessageBodyProvider(objectMapper, validator)); if (registerDefaultExceptionMappers == null || registerDefaultExceptionMappers) { jersey.register(new LoggingExceptionMapper<Throwable>() { }); jersey.register(new ConstraintViolationExceptionMapper()); jersey.register(new JsonProcessingExceptionMapper()); jersey.register(new EarlyEofExceptionMapper()); } handler.addServlet(new NonblockingServletHolder(jerseyContainer), jersey.getUrlPattern()); } final InstrumentedHandler instrumented = new InstrumentedHandler(metricRegistry); instrumented.setServer(server); instrumented.setHandler(handler); return instrumented; }

Target:
protected Handler createAppServlet(Server server, JerseyEnvironment jersey, ObjectMapper objectMapper, Validator validator, MutableServletContextHandler handler, @Nullable Servlet jerseyContainer, MetricRegistry metricRegistry) { configureSessionsAndSecurity(handler, server); handler.addFilter(AllowedMethodsFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)) .setInitParameter(AllowedMethodsFilter.ALLOWED_METHODS_PARAM, Joiner.on(',').join(allowedMethods)); handler.addFilter(ThreadNameFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); if (gzip.isEnabled()) { final FilterHolder holder = new FilterHolder(gzip.build()); handler.addFilter(holder, "/*", EnumSet.allOf(DispatcherType.class)); } if (jerseyContainer != null) { String urlPattern = jerseyRootPath; if (!urlPattern.endsWith("*") && !urlPattern.endsWith("/")) { urlPattern += "/"; } if (!urlPattern.endsWith("*")) { urlPattern += "*"; } jersey.setUrlPattern(urlPattern); jersey.register(new JacksonMessageBodyProvider(objectMapper, validator)); if (registerDefaultExceptionMappers == null || registerDefaultExceptionMappers) { jersey.register(new LoggingExceptionMapper<Throwable>() { }); jersey.register(new ConstraintViolationExceptionMapper()); jersey.register(new JsonProcessingExceptionMapper()); jersey.register(new EarlyEofExceptionMapper()); } handler.addServlet(new NonblockingServletHolder(jerseyContainer), jersey.getUrlPattern()); } final InstrumentedHandler instrumented = new InstrumentedHandler(metricRegistry); instrumented.setServer(server); instrumented.setHandler(handler); return instrumented; }
Source:
private void waitForClusterReady() throws InterruptedException { await().atMost(50, TimeUnit.SECONDS).until(clusterIsReady()); }

Target:
private void waitForClusterReady() throws InterruptedException { boolean clusterOk = false; while (!clusterOk) { if (node1.clusterInfo().split("\n")[0].contains("ok") && node2.clusterInfo().split("\n")[0].contains("ok") && node3.clusterInfo().split("\n")[0].contains("ok")) { clusterOk = true; } AwaitilityUtils.waitFor(50); } }
Source:
public TmfConstantTransform(ITmfTimestamp offset) { fOffset = new TmfNanoTimestamp(offset); }

Target:
public TmfConstantTransform(ITmfTimestamp offset) { fOffset = offset; }
Source:
public static void updateVmLock(final VM vm) { vm.setLockInfo(getLockManager().getLockInfo(String.format("%s%s", vm.getId(), LockingGroup.VM))); }

Target:
public static void updateVmLock(final VM vm) { vm.setLockInfo(getLockManager().getLockInfo(String.format("%s%s", vm.getId(), LockingGroup.VM.name()))); }
Source:
public SeekableStreamIndexTaskTuningConfig convertToTaskTuningConfig() { return new KafkaIndexTaskTuningConfig( getMaxRowsInMemory(), getMaxBytesInMemory(), getMaxRowsPerSegment(), getMaxTotalRows(), getIntermediatePersistPeriod(), getBasePersistDirectory(), 0, getIndexSpec(), true, isReportParseExceptions(), getHandoffConditionTimeout(), isResetOffsetAutomatically(), getSegmentWriteOutMediumFactory(), getIntermediateHandoffPeriod(), isLogParseExceptions(), getMaxParseExceptions(), getMaxSavedParseExceptions() ); }

Target:
public SeekableStreamIndexTaskTuningConfig convertToTaskTuningConfig() { return new KafkaIndexTaskTuningConfig( getMaxRowsInMemory(), getMaxBytesInMemory(), getMaxRowsPerSegment(), getMaxTotalRows(), getIntermediatePersistPeriod(), getBasePersistDirectory(), getMaxPendingPersists(), getIndexSpec(), true, isReportParseExceptions(), getHandoffConditionTimeout(), isResetOffsetAutomatically(), getSegmentWriteOutMediumFactory(), getIntermediateHandoffPeriod(), isLogParseExceptions(), getMaxParseExceptions(), getMaxSavedParseExceptions() ); }
Source:
protected boolean scrollSelectedCellIntoView(final GridWidget gridWidget) { if (!isSelectionOriginSet(gridWidget) && !isHeaderSelectionOriginSet(gridWidget)) { return false; } boolean isHeaderCellSelected = false; if (!isSelectionOriginSet(gridWidget) && isHeaderSelectionOriginSet(gridWidget)) { isHeaderCellSelected = true; } final BaseGridRendererHelper.RenderingInformation renderingInformation = computeRenderingInformation(gridWidget); if (Objects.isNull(renderingInformation)) { return false; } if (!isGridColumnCandidateForScroll(gridWidget, renderingInformation, isHeaderCellSelected)) { return false; } final double dx = getCellScrollDeltaX(gridWidget, isHeaderCellSelected); final double dy = getCellScrollDeltaY(gridWidget, isHeaderCellSelected); if (dx != 0 || dy != 0) { adjustViewportTransform(gridLayer.getViewport(), new Point2D(dx, dy)); } return true; }

Target:
protected boolean scrollSelectedCellIntoView(final GridWidget gridWidget) { if (!isSelectionOriginSet(gridWidget) && !isHeaderSelectionOriginSet(gridWidget)) { return false; } boolean isHeaderCellSelected = false; if (!isSelectionOriginSet(gridWidget) && isHeaderSelectionOriginSet(gridWidget)) { isHeaderCellSelected = true; } if (!isGridColumnCandidateForScroll(gridWidget, isHeaderCellSelected)) { return false; } final double dx = getCellScrollDeltaX(gridWidget, isHeaderCellSelected); final double dy = getCellScrollDeltaY(gridWidget, isHeaderCellSelected); if (dx != 0 || dy != 0) { adjustViewportTransform(gridLayer.getViewport(), new Point2D(dx, dy)); } return true; }
Source:
private void setSnackbarMessage(String status,boolean showBar) { String internetStatus=""; if(status.equalsIgnoreCase("Wifi enabled")||status.equalsIgnoreCase("Mobile data enabled")){ internetStatus="Network Status: Connected"; }else { internetStatus="Network Status: Disconnected"; } if(internetStatus.equalsIgnoreCase("Network Status: Disconnected")) { snackbar = Snackbar .make(linearLayout, internetStatus, Snackbar.LENGTH_LONG) .setAction("Retry", new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS)); } }); } else { snackbar = Snackbar .make(linearLayout, internetStatus, Snackbar.LENGTH_SHORT); } snackbar.setActionTextColor(Color.WHITE); if(internetStatus.equalsIgnoreCase("Network Status: Disconnected")){ if(internetConnected){ snackbar.show(); internetConnected=false; } }else{ if(!internetConnected){ internetConnected=true; snackbar.show(); } } }

Target:
private void setSnackbarMessage(String status,boolean showBar) { String internetStatus=""; if(status.equalsIgnoreCase("Wifi enabled")||status.equalsIgnoreCase("Mobile data enabled")){ internetStatus=getResources().getString(R.string.offline_network_connected); }else { internetStatus=getResources().getString(R.string.offline_network_disconnected); } if(internetStatus.equalsIgnoreCase(getResources().getString(R.string.offline_network_disconnected))) { snackbar = Snackbar .make(linearLayout, internetStatus, Snackbar.LENGTH_LONG) .setAction(getResources().getString(R.string.offline_network_retry), new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS)); } }); } else { snackbar = Snackbar .make(linearLayout, internetStatus, Snackbar.LENGTH_SHORT); } snackbar.setActionTextColor(Color.WHITE); if(internetStatus.equalsIgnoreCase(getResources().getString(R.string.offline_network_disconnected))){ if(internetConnected){ snackbar.show(); internetConnected=false; } }else{ if(!internetConnected){ internetConnected=true; snackbar.show(); } } }
Source:
protected PacketDecoder createPacketDecoder() { return ClientPacketDecoder.INSTANCE; }

Target:
protected PacketDecoder createPacketDecoder() { return new ClientPacketDecoder(); }
Source:
public void latchAwaitSeconds(int sec) throws InterruptedException { System.out.println("AWAIT " + latch); if (!latch.await(sec, TimeUnit.SECONDS)) { throw new RuntimeException("Await failed"); } }

Target:
public void latchAwaitSeconds(int sec) throws InterruptedException { if (!latch.await(sec, TimeUnit.SECONDS)) { throw new RuntimeException("Await failed"); } }
Source:
private static void populateDataToHiveTable(String destination, String source, String partition) { String queryStatement = format("INSERT INTO TABLE %s PARTITION (%s) SELECT * FROM %s", destination, partition, source); onHive().executeQuery("SET mapreduce.map.memory.mb=256"); onHive().executeQuery("SET mapreduce.map.java.opts=-Xmx196m"); onHive().executeQuery("SET mapreduce.reduce.memory.mb=256"); onHive().executeQuery("SET mapreduce.reduce.java.opts=-Xmx196m"); onHive().executeQuery("SET hive.enforce.bucketing = true"); onHive().executeQuery("SET hive.enforce.sorting = true"); onHive().executeQuery(queryStatement); }

Target:
private static void populateDataToHiveTable(String destination, String source, String partition) { String queryStatement = format("INSERT INTO TABLE %s PARTITION (%s) SELECT * FROM %s", destination, partition, source); onHive().executeQuery("set hive.enforce.bucketing = true"); onHive().executeQuery("set hive.enforce.sorting = true"); onHive().executeQuery(queryStatement); }
Source:
private static Map<String,String> createMap(URL accumuloPropsLocation, Map<String,String> overrides) { CompositeConfiguration config = new CompositeConfiguration(); config.setThrowExceptionOnMissing(false); config.setDelimiterParsingDisabled(true); PropertiesConfiguration propsConfig = new PropertiesConfiguration(); propsConfig.setDelimiterParsingDisabled(true); if (accumuloPropsLocation != null) { try { propsConfig.load(accumuloPropsLocation.openStream()); } catch (IOException | ConfigurationException e) { throw new IllegalArgumentException(e); } } config.addConfiguration(propsConfig); Map<String,String> result = new HashMap<>(); config.getKeys().forEachRemaining(key -> result.put(key, config.getString(key))); overrides.keySet().forEach(key -> result.put(key, overrides.get(key))); String credProvider = result.get(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey()); if (credProvider != null) { org.apache.hadoop.conf.Configuration hadoopConf = new org.apache.hadoop.conf.Configuration( CachedConfiguration.getInstance()); hadoopConf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credProvider); for (Property property : Property.values()) { if (property.isSensitive()) { char[] value = CredentialProviderFactoryShim.getValueFromCredentialProvider(hadoopConf, property.getKey()); if (value != null) { result.put(property.getKey(), new String(value)); } } } } return result; }

Target:
private static ImmutableMap<String,String> createMap(URL accumuloPropsLocation, Map<String,String> overrides) { CompositeConfiguration config = new CompositeConfiguration(); config.setThrowExceptionOnMissing(false); config.setDelimiterParsingDisabled(true); PropertiesConfiguration propsConfig = new PropertiesConfiguration(); propsConfig.setDelimiterParsingDisabled(true); if (accumuloPropsLocation != null) { try { propsConfig.load(accumuloPropsLocation.openStream()); } catch (IOException | ConfigurationException e) { throw new IllegalArgumentException(e); } } config.addConfiguration(propsConfig); Map<String,String> result = new HashMap<>(); config.getKeys().forEachRemaining(key -> result.put(key, config.getString(key))); overrides.forEach(result::put); String credProvider = result.get(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey()); if (credProvider != null) { org.apache.hadoop.conf.Configuration hadoopConf = new org.apache.hadoop.conf.Configuration( CachedConfiguration.getInstance()); hadoopConf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credProvider); for (Property property : Property.values()) { if (property.isSensitive()) { char[] value = CredentialProviderFactoryShim.getValueFromCredentialProvider(hadoopConf, property.getKey()); if (value != null) { result.put(property.getKey(), new String(value)); } } } } return ImmutableMap.copyOf(result); }
Source:
private long initializeCipher() { String ivString = getHeaderAsString(MantaHttpHeaders.ENCRYPTION_IV); if (ivString == null || ivString.isEmpty()) { String msg = "Initialization Vector (IV) was not set for the object. Unable to decrypt."; MantaClientEncryptionException e = new MantaClientEncryptionException(msg); annotateException(e); throw e; } byte[] iv = Base64.getDecoder().decode(ivString); if (LOGGER.isTraceEnabled()) { LOGGER.trace("IV: {}", Hex.encodeHexString(iv)); } final int mode = Cipher.DECRYPT_MODE; try { if (startPosition != null && startPosition > 0) { this.cipher.init(mode, secretKey, cipherDetails.getEncryptionParameterSpec(iv, startPosition)); return startPosition % cipherDetails.getBlockSizeInBytes(); } else { this.cipher.init(mode, secretKey, cipherDetails.getEncryptionParameterSpec(iv)); return 0L; } } catch (InvalidKeyException | InvalidAlgorithmParameterException e) { String msg = "Error initializing cipher"; MantaClientEncryptionException mce = new MantaClientEncryptionException(msg, e); annotateException(mce); throw mce; } }

Target:
private long initializeCipher() { String ivString = getHeaderAsString(MantaHttpHeaders.ENCRYPTION_IV); if (ivString == null || ivString.isEmpty()) { String msg = "Initialization Vector (IV) was not set for the object. Unable to decrypt."; MantaClientEncryptionException e = new MantaClientEncryptionException(msg); annotateException(e); throw e; } byte[] iv = Base64.getDecoder().decode(ivString); if (LOGGER.isTraceEnabled()) { LOGGER.trace("IV: {}", Hex.encodeHexString(iv)); } final int mode = Cipher.DECRYPT_MODE; try { if (startPosition > 0) { this.cipher.init(mode, secretKey, cipherDetails.getEncryptionParameterSpec(iv, startPosition)); return startPosition % cipherDetails.getBlockSizeInBytes(); } else { this.cipher.init(mode, secretKey, cipherDetails.getEncryptionParameterSpec(iv)); return 0L; } } catch (InvalidKeyException | InvalidAlgorithmParameterException e) { String msg = "Error initializing cipher"; MantaClientEncryptionException mce = new MantaClientEncryptionException(msg, e); annotateException(mce); throw mce; } }
Source:
public void run() { Logger log = Logger.getLogger(this.getClass().getCanonicalName()); long startTime = System.currentTimeMillis(); long finishTime = startTime + WORK_TIMEOUT; log.info("Starting work " + name + " on node " + System.getProperty("jboss.node.name")); while (!quit) { try { Thread.sleep(SLEEP_STEP); } catch (InterruptedException e) { log.error("Was interrupted while waiting for work to finish", e); } if (System.currentTimeMillis() >= finishTime) quit = true; } log.info("Finishing work " + name + " after " + TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - startTime) + " seconds"); }

Target:
public void run() { long startTime = System.currentTimeMillis(); long finishTime = startTime + WORK_TIMEOUT; while (!quit) { try { Thread.sleep(SLEEP_STEP); } catch (InterruptedException ignored) { } if (System.currentTimeMillis() >= finishTime) quit = true; } }
Source:
public void refresh() { logger.info( "Refreshing Created new Index Name [{}]", alias); final RetryOperation retryOperation = new RetryOperation() { @Override public boolean doOp() { try { String[] indexes = getIndexes(AliasType.Read); Observable.from(indexes).subscribeOn(Schedulers.io()).map(new Func1<String, String>() { @Override public String call(String index) { esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet(); return index; } }).toBlocking().last(); logger.debug( "Refreshed index: " + alias); return true; } catch ( IndexMissingException e ) { logger.error( "Unable to refresh index after create. Waiting before sleeping.", e ); throw e; } } }; doInRetry( retryOperation ); logger.debug( "Refreshed index: " + alias); }

Target:
public void refresh() { logger.info( "Refreshing Created new Index Name [{}]", alias); final RetryOperation retryOperation = new RetryOperation() { @Override public boolean doOp() { try { String[] indexes = getIndexes(AliasType.Read); Observable.from(indexes).map(new Func1<String, String>() { @Override public String call(String index) { esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet(); return index; } }).toBlocking().last(); logger.debug( "Refreshed index: " + alias); return true; } catch ( IndexMissingException e ) { logger.error( "Unable to refresh index after create. Waiting before sleeping.", e ); throw e; } } }; doInRetry( retryOperation ); logger.debug( "Refreshed index: " + alias); }
Source:
private ListStatusResult parseToListStatusResult(@Nonnull final IMAPResponse[] r) throws ParsingException, ImapAsyncClientException { if (r.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = r[r.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<ListInfo> v = new ArrayList<ListInfo>(); final Map<String, Status> m = new HashMap<>(); for (int i = 0; i < r.length; i++) { final IMAPResponse ir = r[i]; if (ir.keyEquals("LIST")) { v.add(new ListInfo(ir)); } else if (ir.keyEquals("STATUS")) { final Status status = new Status(ir); m.put(status.mbox, status); } } return new ListStatusResult(v, m); }

Target:
private ListStatusResult parseToListStatusResult(@Nonnull final IMAPResponse[] r) throws ParsingException, ImapAsyncClientException { if (r.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = r[r.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<ExtensionListInfo> v = new ArrayList<ExtensionListInfo>(); final Map<String, Status> m = new HashMap<String, Status>(); for (int i = 0; i < r.length; i++) { final IMAPResponse ir = r[i]; if (ir.keyEquals("LIST")) { v.add(new ExtensionListInfo(ir)); } else if (ir.keyEquals("STATUS")) { final Status status = new Status(ir); m.put(status.mbox, status); } } return new ListStatusResult(v, m); }
Source:
private List<AqlSearchResult.SearchEntry> filterBuildAqlSearchResults(List<AqlSearchResult.SearchEntry> itemsToFilter, Map<String,Boolean> buildArtifactsSha1){ List<AqlSearchResult.SearchEntry> filteredResults = new ArrayList<>(); Map<String,List<AqlSearchResult.SearchEntry>> firstPriority = new HashMap<>(); Map<String,List<AqlSearchResult.SearchEntry>> secondPriority = new HashMap<>(); Map<String,List<AqlSearchResult.SearchEntry>> thirdPriority = new HashMap<>(); boolean isBuildNameMatch; boolean isBuildNumberMatch; for (AqlSearchResult.SearchEntry item:itemsToFilter) { if(!buildArtifactsSha1.containsKey(item.getActualSha1())){ continue; } isBuildNameMatch = item.getBuildName().equals(this.buildName); isBuildNumberMatch = item.getBuildNumber().equals(this.buildNumber); if (isBuildNameMatch && isBuildNumberMatch) { firstPriority = addToListInMap(firstPriority,item); continue; } if (isBuildNameMatch) { secondPriority = addToListInMap(secondPriority,item); continue; } thirdPriority = addToListInMap(thirdPriority,item); } for (Map.Entry<String,Boolean> entry : buildArtifactsSha1.entrySet()) { String shaToMatch = entry.getKey(); if (firstPriority.containsKey(shaToMatch)) { filteredResults.addAll(firstPriority.get(shaToMatch)); } else if (secondPriority.containsKey(shaToMatch)) { filteredResults.addAll(secondPriority.get(shaToMatch)); } else if (thirdPriority.containsKey(shaToMatch)) { filteredResults.addAll(thirdPriority.get(shaToMatch)); } } return filteredResults; }

Target:
private List<AqlSearchResult.SearchEntry> filterBuildAqlSearchResults(List<AqlSearchResult.SearchEntry> itemsToFilter, Map<String,Boolean> buildArtifactsSha1){ Map<String, List<AqlSearchResult.SearchEntry>> firstPriority = new HashMap<>(); Map<String, List<AqlSearchResult.SearchEntry>> secondPriority = new HashMap<>(); Map<String, List<AqlSearchResult.SearchEntry>> thirdPriority = new HashMap<>(); List<AqlSearchResult.SearchEntry> filteredResults = new ArrayList<>(); for (AqlSearchResult.SearchEntry item : itemsToFilter) { if (!buildArtifactsSha1.containsKey(item.getActualSha1())){ continue; } boolean isBuildNameMatch = item.getBuildName().equals(this.buildName); boolean isBuildNumberMatch = item.getBuildNumber().equals(this.buildNumber); if (isBuildNameMatch) { if (isBuildNumberMatch) { addToListInMap(firstPriority,item); continue; } addToListInMap(secondPriority,item); continue; } addToListInMap(thirdPriority,item); } for (Map.Entry<String, Boolean> entry : buildArtifactsSha1.entrySet()) { String shaToMatch = entry.getKey(); if (firstPriority.containsKey(shaToMatch)) { filteredResults.addAll(firstPriority.get(shaToMatch)); } else if (secondPriority.containsKey(shaToMatch)) { filteredResults.addAll(secondPriority.get(shaToMatch)); } else if (thirdPriority.containsKey(shaToMatch)) { filteredResults.addAll(thirdPriority.get(shaToMatch)); } } return filteredResults; }
Source:
private static InputStream postPrivate(final String urlPath, final Map<String, String> parameters) { final HttpsURLConnection connection = createConnection(urlPath, false); final OutputStream stream = getOutputStream(connection); if (stream == null) { return null; } final PrintWriter out = new PrintWriter(stream); try { out.print(createQueryStringForParameters(parameters)); out.close(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { Lg.e("server response error(", connection.getResponseCode(), "): ", connection.getResponseMessage()); return null; } Lg.i("used CipherSuite: ", connection.getCipherSuite()); return connection.getInputStream(); } catch (final IOException e) { Lg.ex(e, "IOException while posting"); return null; } finally { out.close(); } }

Target:
private static InputStream postPrivate(final String urlPath, final Map<String, String> parameters) { final HttpsURLConnection connection = createConnection(urlPath, false); final OutputStream stream = getOutputStream(connection); if (stream == null) { return null; } final PrintWriter out = new PrintWriter(stream); try { out.print(createQueryStringForParameters(parameters)); out.flush(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { Lg.e("server response error(", connection.getResponseCode(), "): ", connection.getResponseMessage()); return null; } Lg.i("used CipherSuite: ", connection.getCipherSuite()); return connection.getInputStream(); } catch (final IOException e) { Lg.ex(e, "IOException while posting"); return null; } finally { out.close(); } }
Source:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { pointer = null; if (walker.isSubtree()) { return walker.isRecursive(); } ObjectId objectId = walker.getObjectId(0); ObjectLoader object = walker.getObjectReader().open(objectId); if (object.isLarge()) { return false; } ObjectStream stream = object.openStream(); byte[] buffer = new byte[VERSION_LINE_LEGACY.length]; int read = stream.read(buffer); if (!validVersionLine(read, buffer)) { return false; } int line = 2; int foundKeys = 0; byte[][] values = new byte[REQUIRED_KEYS.length][]; buffer = object.getCachedBytes(); IntList lineMap = RawParseUtils.lineMap(buffer, 0, buffer.length); int lineMapSize = lineMap.size() - 1; for (int r = 0; r < REQUIRED_KEYS.length; r++) { byte[] key = REQUIRED_KEYS[r]; for (; line < lineMapSize; line++) { int lineStart = lineMap.get(line); int match = RawParseUtils.match(buffer, lineStart, key); if (match > 0) { foundKeys++; int len = lineMap.get(line + 1) - match - 1; values[r] = new byte[len]; System.arraycopy(buffer, match, values[r], 0, len); break; } } } if (foundKeys == REQUIRED_KEYS.length) { LongObjectId oid = LongObjectId.fromString(values[OID_INDEX], 0); int size = RawParseUtils.parseBase10(values[SIZE_INDEX], 0, new MutableInteger()); pointer = new LargeObjectPointer(oid, size); return true; } return false; }

Target:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { pointer = null; if (walker.isSubtree()) { return walker.isRecursive(); } ObjectId objectId = walker.getObjectId(0); ObjectLoader object = walker.getObjectReader().open(objectId); if (object.isLarge()) { return false; } ObjectStream stream = object.openStream(); byte[] buffer = new byte[VERSION_LINES[0].length]; int read = stream.read(buffer); if (!validVersionLine(read, buffer)) { return false; } int line = 2; int foundKeys = 0; byte[][] values = new byte[REQUIRED_KEYS.length][]; buffer = object.getCachedBytes(); IntList lineMap = RawParseUtils.lineMap(buffer, 0, buffer.length); int lineMapSize = lineMap.size() - 1; for (int r = 0; r < REQUIRED_KEYS.length; r++) { byte[] key = REQUIRED_KEYS[r]; for (; line < lineMapSize; line++) { int lineStart = lineMap.get(line); int match = RawParseUtils.match(buffer, lineStart, key); if (match > 0) { foundKeys++; int len = lineMap.get(line + 1) - match - 1; values[r] = new byte[len]; System.arraycopy(buffer, match, values[r], 0, len); break; } } } if (foundKeys == REQUIRED_KEYS.length) { LongObjectId oid = LongObjectId.fromString(values[OID_INDEX], 0); int size = RawParseUtils.parseBase10(values[SIZE_INDEX], 0, new MutableInteger()); pointer = new LargeObjectPointer(oid, size); return true; } return false; }
Source:
public IRemoteProcess getCommandShell(int flags) throws IOException { return new JSchProcessBuilder(getRemoteConnection(), "shell").start(flags); }

Target:
public IRemoteProcess getCommandShell(int flags) throws IOException { return new JSchProcessBuilder(getRemoteConnection()).start(flags); }
Source:
private static <T extends Throwable> String getFailureWithSuppliedMessage(Class<T> expectedType, Supplier<String> messageSupplier) { return buildPrefix(nullSafeGet(messageSupplier) + getFailureMessage(expectedType)); }

Target:
private static <T extends Throwable> String getFailureWithSuppliedMessage(Class<T> expectedType, Supplier<String> messageSupplier) { return buildPrefix(nullSafeGet(messageSupplier)) + getFailureMessage(expectedType); }
Source:
private String getPath() { return Paths.get(getPersistencePath(), mapName).toString() + File.separator; }

Target:
private Path getPath() { return Paths.get(getPersistencePath(), mapName); }
Source:
public void shouldReturnInternalServerError_ifGatewayErrors() throws IOException { String externalChargeId = "external-charge-id"; ApplePayAuthRequest applePayAuthRequest = ApplePayAuthRequestBuilder.anApplePayToken().build(); GatewayError gatewayError = mock(GatewayError.class); GatewayResponse gatewayResponse = responseBuilder() .withGatewayError(gatewayError) .withSessionIdentifier("234") .build(); when(gatewayError.getErrorType()).thenReturn(GATEWAY_ERROR); when(gatewayError.getMessage()).thenReturn("oops"); when(mockedApplePayDecrypter.performDecryptOperation(applePayAuthRequest)).thenReturn(validData); when(mockedApplePayAuthoriseService.doAuthorise(externalChargeId, validData)).thenReturn(gatewayResponse); Response authorisationResponse = applePayService.authorise(externalChargeId, applePayAuthRequest); verify(mockedApplePayAuthoriseService).doAuthorise(externalChargeId, validData); assertThat(authorisationResponse.getStatus(), is(500)); ErrorResponse response = (ErrorResponse)authorisationResponse.getEntity(); MatcherAssert.assertThat(response.getMessages(), contains("oops")); }

Target:
public void shouldReturnInternalServerError_ifGatewayErrors() throws IOException { String externalChargeId = "external-charge-id"; ApplePayAuthRequest applePayAuthRequest = ApplePayAuthRequestBuilder.anApplePayToken().build(); GatewayError gatewayError = mock(GatewayError.class); GatewayResponse gatewayResponse = responseBuilder() .withGatewayError(gatewayError) .withSessionIdentifier("234") .build(); when(gatewayError.getErrorType()).thenReturn(GATEWAY_ERROR); when(gatewayError.getMessage()).thenReturn("oops"); when(mockedApplePayDecrypter.performDecryptOperation(applePayAuthRequest)).thenReturn(validData); when(mockedApplePayAuthoriseService.doAuthorise(externalChargeId, validData)).thenReturn(gatewayResponse); Response authorisationResponse = applePayService.authorise(externalChargeId, applePayAuthRequest); verify(mockedApplePayAuthoriseService).doAuthorise(externalChargeId, validData); assertThat(authorisationResponse.getStatus(), is(500)); ErrorResponse response = (ErrorResponse)authorisationResponse.getEntity(); assertThat(response.getMessages(), contains("oops")); }
Source:
protected Builder() { id("jdbc") .name("Jdbc BlobStore") .identityName("Unused") .defaultEndpoint("http://localhost/transient") .defaultIdentity("unused") .defaultCredential("unused") .version("1") .documentation(URI.create("<LINK_0>")) .view(BlobStoreContext.class) .defaultModules(ImmutableSet.<Class<? extends Module>>of(JdbcBlobStoreContextModule.class)); }

Target:
protected Builder() { id("jdbc") .name("Jdbc BlobStore") .identityName("Unused") .credentialName("unused") .defaultEndpoint("http://localhost/transient") .defaultIdentity("unused") .defaultCredential("unused") .version("1") .documentation(URI.create("<LINK_0>")) .view(BlobStoreContext.class) .defaultModules(ImmutableSet.<Class<? extends Module>>of(JdbcBlobStoreContextModule.class)); }