auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int getSigInsertionIndex(Sha256Hash hash, ECKey signingKey) { List<byte[]> sigs = Lists.newArrayList(); List<ScriptChunk> existingChunks = chunks.subList(1, chunks.size() - 1); ScriptChunk scriptChunk = chunks.get(chunks.size() - 1); checkNotNull(scriptChunk.data); Script redeemScript = new Script(scriptChunk.data); for (ScriptChunk chunk : existingChunks) { if (chunk.opcode == OP_0) { } else { checkNotNull(chunk.data); sigs.add(chunk.data); } } int myIndex = redeemScript.findKeyInRedeem(signingKey); for (ListIterator<byte[]> iter = sigs.listIterator() ; iter.hasNext() ;) { byte[] sig = iter.next(); if (myIndex < redeemScript.findSigInRedeem(sig, hash)) { return iter.previousIndex(); } } return sigs.size(); }

Target:
public int getSigInsertionIndex(Sha256Hash hash, ECKey signingKey) { List<ScriptChunk> existingChunks = chunks.subList(1, chunks.size() - 1); ScriptChunk redeemScriptChunk = chunks.get(chunks.size() - 1); checkNotNull(redeemScriptChunk.data); Script redeemScript = new Script(redeemScriptChunk.data); int sigCount = 0; int myIndex = redeemScript.findKeyInRedeem(signingKey); for (ScriptChunk chunk : existingChunks) { if (chunk.opcode == OP_0) { } else { checkNotNull(chunk.data); if (myIndex < redeemScript.findSigInRedeem(chunk.data, hash)) return sigCount; sigCount++; } } return sigCount; }
Source:
public static String parseId (String json, String prefix, String key) { Gson gson = new Gson(); Type mapType = new TypeToken<Map<String, Object>>(){}.getType(); Map<String, String> jsonMap = gson.fromJson(json, mapType); Pattern p = Pattern.compile(String.format(".*%s\\/([a-z|\\-|\\d]*).*", prefix)); Matcher m = p.matcher(jsonMap.get("href")); if (m.matches()) { String dataCenterId = m.group(1); jsonMap.put(key, dataCenterId); json = (new Gson()).toJson(jsonMap); } return json; }

Target:
public String parseId (String json, String prefix, String key) { Type mapType = new TypeToken<Map<String, Object>>(){}.getType(); Map<String, String> jsonMap = jsonBinder.fromJson(json, mapType); Pattern p = Pattern.compile(String.format(".*%s\\/([a-z|\\-|\\d]*).*", prefix)); Matcher m = p.matcher(jsonMap.get("href")); if (m.matches()) { String dataCenterId = m.group(1); jsonMap = new ImmutableMap.Builder<String, String>() .putAll(jsonMap) .put(key, dataCenterId) .build(); json = jsonBinder.toJson(jsonMap); } return json; }
Source:
public double sum() { return TimeUnit.SECONDS.convert(sum, TimeUnit.NANOSECONDS); }

Target:
public double sum() { return sum / 1e9D; }
Source:
public static List<String> getAllBroadcastAddresses() { try { List<String> broadcastAddresses = new ArrayList<String>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { final NetworkInterface networkInterface = networkInterfaces.nextElement(); final List<InterfaceAddress> interfaceAddresses = networkInterface.getInterfaceAddresses(); for (InterfaceAddress interfaceAddress : interfaceAddresses) { final InetAddress addr = interfaceAddress.getAddress(); if (!addr.isLinkLocalAddress() && !addr.isLoopbackAddress() && addr instanceof Inet4Address) { broadcastAddresses.add(interfaceAddress.getBroadcast().getHostAddress()); } } } return broadcastAddresses; } catch (SocketException ex) { LOGGER.error("Could not find broadcast address: {}", ex.getMessage(), ex); return null; } }

Target:
public static List<String> getAllBroadcastAddresses() { List<String> broadcastAddresses = new LinkedList<String>(); try { final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { final NetworkInterface networkInterface = networkInterfaces.nextElement(); final List<InterfaceAddress> interfaceAddresses = networkInterface.getInterfaceAddresses(); for (InterfaceAddress interfaceAddress : interfaceAddresses) { final InetAddress addr = interfaceAddress.getAddress(); if (!addr.isLinkLocalAddress() && !addr.isLoopbackAddress() && addr instanceof Inet4Address) { broadcastAddresses.add(interfaceAddress.getBroadcast().getHostAddress()); } } } } catch (SocketException ex) { LOGGER.error("Could not find broadcast address: {}", ex.getMessage(), ex); } return broadcastAddresses; }
Source:
public QQProfile retrieveUserProfileFromToken(WebContext context, OAuth2AccessToken accessToken) { QQProfileDefinition profileDefinition = (QQProfileDefinition) configuration.getProfileDefinition(); String openidUrl = profileDefinition.getOpenidUrl(accessToken, configuration); final OAuth20Service service = this.configuration.buildService(context, client, null); String body = sendRequestForData(service, accessToken, openidUrl, Verb.GET); String openid = profileDefinition.extractOpenid(body); String profileUrl = profileDefinition.getProfileUrl(accessToken, configuration); profileUrl = profileUrl + "?openid=" + openid + "&oauth_consumer_key=" + configuration.getKey(); body = sendRequestForData(service, accessToken, profileUrl, Verb.GET); if (body == null) { throw new HttpCommunicationException("Not data found for accessToken: " + accessToken); } final QQProfile profile = profileDefinition.extractUserProfile(body); addAccessTokenToProfile(profile, accessToken); profile.setId(openid); return profile; }

Target:
public QQProfile retrieveUserProfileFromToken(WebContext context, OAuth2AccessToken accessToken) { QQProfileDefinition profileDefinition = (QQProfileDefinition) configuration.getProfileDefinition(); String openidUrl = profileDefinition.getOpenidUrl(accessToken, configuration); final OAuth20Service service = this.configuration.buildService(context, client, null); String body = sendRequestForData(service, accessToken, openidUrl, Verb.GET); String openid = profileDefinition.extractOpenid(body); String profileUrl = profileDefinition.getProfileUrl(accessToken, configuration); profileUrl = CommonHelper.addParameter(profileUrl, "openid", openid); profileUrl = CommonHelper.addParameter(profileUrl, "oauth_consumer_key", configuration.getKey()); body = sendRequestForData(service, accessToken, profileUrl, Verb.GET); if (body == null) { throw new HttpCommunicationException("Not data found for accessToken: " + accessToken); } final QQProfile profile = profileDefinition.extractUserProfile(body); addAccessTokenToProfile(profile, accessToken); profile.setId(openid); return profile; }
Source:
public static boolean verify(byte[] data, byte[] signature, byte[] pub) { return verify(data, ECDSASignature.decodeFromDER(signature), pub); }

Target:
public static boolean verify(byte[] data, byte[] signature, byte[] pub) { if (Secp256k1Context.isEnabled()) { try { return NativeSecp256k1.verify(data, signature, pub); } catch (NativeSecp256k1Util.AssertFailException e) { log.error("Caught AssertFailException inside secp256k1", e); return false; } } return verify(data, ECDSASignature.decodeFromDER(signature), pub); }
Source:
public String installPush( @Nullable String deviceToken, @NonNull PushBackend pushBackend ) throws ThingIFException { return thingIfApi.installPush(deviceToken, pushBackend); }

Target:
public String installPush( @Nullable String deviceToken, @NonNull PushBackend pushBackend ) throws ThingIFException { return this.thingIfApi.installPush(deviceToken, pushBackend); }
Source:
private static long unpacked(Any any) { checkNotNull(any); final Int64Value unpacked = unpack(any, Int64Value.class); return unpacked.getValue(); }

Target:
private static long unpacked(Any any) { final Int64Value unpacked = unpack(any, Int64Value.class); return unpacked.getValue(); }
Source:
public void run() { RebalanceUtil.scheduleOnDemandPipeline(_manager.getClusterName(), 0); }

Target:
public void run() { RebalanceUtil.scheduleOnDemandPipeline(_manager.getClusterName(), 0L); }
Source:
public void setup(final Optional<HasName> hasName) { this.metaData = new NameAndDataTypeHeaderMetaData(hasName, () -> hasTypeRef, clearDisplayNameConsumer, setDisplayNameConsumer, setTypeRefConsumer, cellEditorControls, headerEditor, EDITOR_TITLE) { @Override public String getColumnGroup() { return NAME_DATA_TYPE_COLUMN_GROUP; } @Override public Optional<String> getPlaceHolder() { return Optional.of("placeholder"); } }; }

Target:
public void setup(final Optional<HasName> hasName) { this.metaData = new NameAndDataTypeHeaderMetaData(hasName, () -> hasTypeRef, clearDisplayNameConsumer, setDisplayNameConsumer, setTypeRefConsumer, cellEditorControls, headerEditor, EDITOR_TITLE) { @Override public String getColumnGroup() { return NAME_DATA_TYPE_COLUMN_GROUP; } @Override public Optional<String> getPlaceHolder() { return Optional.of(PLACEHOLDER); } }; }
Source:
public void validUsualEmail_shouldPass() throws Exception { User user = Users.signUpAndSignIn(); user.setEmail(randomAlphanumeric(8) + "@" + "jtalks"); Users.editProfile(user); }

Target:
public void validUsualEmail_shouldPass() throws Exception { User user = Users.signUpAndSignIn(); user.setEmail(randomAlphanumeric(8) + "@" + "jtalks.org"); Users.editProfile(user); }
Source:
public boolean needsFuel() { ItemStack fuel = getStackInSlot(SLOT_INPUT); return InvTools.isEmpty(fuel) || sizeOf(fuel) < 8; }

Target:
public boolean needsFuel() { ItemStack fuel = getStackInSlot(SLOT_INPUT); return sizeOf(fuel) < 8; }
Source:
private void mapNetworkConnectionChanged() { if (getActivity().getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueToNoAccessibleStorage); return; } mMap.post(mCoverageUrlQuery); ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); boolean hasNetwork = cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnectedOrConnecting(); if (!hasNetwork) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueToNoInternet); return; } showMapNotAvailableMessage(NoMapAvailableMessage.eHideNoMapMessage); NetworkInfo info = cm.getActiveNetworkInfo(); setHighBandwidthMap(info.getType() == ConnectivityManager.TYPE_WIFI); }

Target:
private void mapNetworkConnectionChanged() { if (getActivity().getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueToNoAccessibleStorage); return; } mMap.post(mCoverageUrlQuery); final ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo info = cm.getActiveNetworkInfo(); final boolean hasNetwork = (info != null) && cm.getActiveNetworkInfo().isConnected(); final boolean hasWifi = (info != null) && (info.getType() == ConnectivityManager.TYPE_WIFI); if (!hasNetwork) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueToNoInternet); return; } showMapNotAvailableMessage(NoMapAvailableMessage.eHideNoMapMessage); setHighBandwidthMap(hasWifi); }
Source:
public SerialWorker( final List<String> queueNameList, final Client client, final String workerName, final int intervalInSeconds) { Preconditions.checkArgument( (null != queueNameList) && (!queueNameList.isEmpty()), "empty queue list provided"); Preconditions.checkArgument( null != client, "null client provided"); Preconditions.checkArgument( intervalInSeconds > 0, "only positive vlaue for intervalInSecods allowed"); this.client = client; this.intervalInSeconds = intervalInSeconds; if (Strings.isNullOrEmpty(workerName)) { this.setWorkerName(this.client.workerName()); } else { this.setWorkerName(workerName + "-" + this.client.workerName()); } for (final String queueName : queueNameList) { this.queues.add(this.client.getQueues().get(queueName)); } if (this.queues.isEmpty()) { throw new QlessException("empty queue list for the worker"); } else { this.queueItor = this.queues.iterator(); LOGGER.info("initialize worker"); } }

Target:
public SerialWorker( final List<String> queueNameList, final Client client, final String workerName, final int intervalInSeconds) { Preconditions.checkArgument( (null != queueNameList) && (!queueNameList.isEmpty()), "empty queue list provided"); Preconditions.checkArgument( null != client, "null client provided"); Preconditions.checkArgument( intervalInSeconds > 0, "only positive value for intervalInSeconds allowed"); this.client = client; this.intervalInSeconds = intervalInSeconds; if (Strings.isNullOrEmpty(workerName)) { this.setWorkerName(this.client.workerName()); } else { this.setWorkerName(workerName + "-" + this.client.workerName()); } for (final String queueName : queueNameList) { this.queues.add(this.client.getQueue(queueName)); } if (this.queues.isEmpty()) { throw new QlessException("empty queue list for the worker"); } else { this.queueIter = this.queues.iterator(); LOGGER.info("initialize worker"); } }
Source:
public AvroServiceImpl(Collection<AvroReplacementDescriptor> replacements, Map<Class<?>, Class<AvroSchemaFactory<?>>> factories) { this.replacements = new ArrayList<>(replacements); this.factories = new HashMap<>(factories); this.replacements.sort(null); createContext(); }

Target:
public AvroServiceImpl(Collection<AvroReplacementDescriptor> replacements, Map<Class<?>, Class<AvroSchemaFactory<?>>> factories) { this.replacements = new ArrayList<>(replacements); this.factories = new HashMap<>(factories); this.replacements.sort(Comparator.naturalOrder()); createContext(); }
Source:
public DevicePolice(RobotAssertionManager assertionManager) { this.assertionManager = assertionManager; registeredDevices = new ArrayList<String>(); }

Target:
public DevicePolice(RobotAssertionManager assertionManager) { this.assertionManager = assertionManager; registeredDevices = new LinkedList<String>(); }
Source:
private NodeState getLocalNodeState(Set<String> allServers, Set<String> allConnectedNodes, long epoch, SequencerMetrics sequencerMetrics) { Map<String, Boolean> connectivity = allServers .stream() .collect(Collectors.toMap(Function.identity(), allConnectedNodes::contains)); NodeConnectivity localConnectivity = NodeConnectivity.builder() .endpoint(localEndpoint) .type(NodeConnectivityType.CONNECTED) .connectivity(ImmutableMap.copyOf(connectivity)) .build(); return NodeState.builder() .connectivity(localConnectivity) .heartbeat(new HeartbeatTimestamp(epoch, heartbeatCounter.incrementHeartbeat())) .sequencerMetrics(sequencerMetrics) .build(); }

Target:
private NodeState getLocalNodeState(Set<String> allServers, Set<String> allConnectedNodes, long epoch, SequencerMetrics sequencerMetrics) { Map<String, ConnectionStatus> connectivity = new HashMap<>(); allServers.forEach(server -> { connectivity.put(server, ConnectionStatus.fromBool(allConnectedNodes.contains(server))); }); NodeConnectivity localConnectivity = NodeConnectivity.connectivity( localEndpoint, ImmutableMap.copyOf(connectivity) ); return NodeState.builder() .connectivity(localConnectivity) .heartbeat(new HeartbeatTimestamp(epoch, heartbeatCounter.incrementHeartbeat())) .sequencerMetrics(sequencerMetrics) .build(); }
Source:
public static VmDevice addManagedDevice(VmDeviceId id, VmDeviceGeneralType type, VmDeviceType device, Map<String, Object> specParams, boolean is_plugged, Boolean isReadOnly, Map<String, String> customProp, boolean isUsingScsiReservation) { VmDevice managedDevice = new VmDevice(id, type, device.getName(), "", 0, specParams, true, is_plugged, isReadOnly, "", customProp, null, null, isUsingScsiReservation); dao.save(managedDevice); if (type == VmDeviceGeneralType.DISK || type == VmDeviceGeneralType.INTERFACE) { VmBase vmBase = DbFacade.getInstance().getVmStaticDao().get(managedDevice.getId().getVmId()); updateBootOrderInVmDeviceAndStoreToDB(vmBase); } return managedDevice; }

Target:
public static VmDevice addManagedDevice(VmDeviceId id, VmDeviceGeneralType type, VmDeviceType device, Map<String, Object> specParams, boolean is_plugged, Boolean isReadOnly, Map<String, String> customProp, boolean isUsingScsiReservation) { VmDevice managedDevice = new VmDevice(id, type, device.getName(), "", 0, specParams, true, is_plugged, isReadOnly, "", customProp, null, null, isUsingScsiReservation); dao.save(managedDevice); if (type == VmDeviceGeneralType.DISK || type == VmDeviceGeneralType.INTERFACE) { VmBase vmBase = dbFacade.getVmStaticDao().get(id.getVmId()); updateBootOrderInVmDeviceAndStoreToDB(vmBase); } return managedDevice; }
Source:
public void setup() { string1 = "string1"; string3 = "string3"; inner = new PersistenceTestObjectInner(); inner.setup(); }

Target:
public void setup() { string1 = "string1"; string3 = "string3"; inner.setup(); }
Source:
public synchronized static boolean canSystemGrantMemory(long xms, long xmx, long freeMemDecrAmt) throws Exception { if (!memCheckEnabled) { throw new Exception("memory check is disabled"); } if (freeMemAmount < LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount (%d kb) is less than low mem threshold (%d kb), memory request declined.", freeMemAmount, LOW_MEM_THRESHOLD)); return false; } if (freeMemAmount >= LOW_MEM_THRESHOLD && freeMemAmount < 2 * LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount (%d kb) is less than 2x low mem threshold (%d kb), re-read /proc/meminfo", freeMemAmount, LOW_MEM_THRESHOLD)); readMemoryInfoFile(); } if (freeMemAmount < LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount (%d kb) is less than low mem threshold (%d kb), memory request declined.", freeMemAmount, LOW_MEM_THRESHOLD)); return false; } if (freeMemAmount - xmx < LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount minus xmx (%d - %d kb) is less than low mem threshold (%d kb), memory request declined.", freeMemAmount, xmx, LOW_MEM_THRESHOLD)); return false; } if (freeMemDecrAmt > 0) { freeMemAmount -= freeMemDecrAmt; logger.info(String.format("Memory (%d kb) granted. Current free memory amount is %d kb", freeMemDecrAmt, freeMemAmount)); } else { freeMemAmount -= xms; logger.info(String.format("Memory (%d kb) granted. Current free memory amount is %d kb", xms, freeMemAmount)); } return true; }

Target:
public synchronized static boolean canSystemGrantMemory(long xms, long xmx, long freeMemDecrAmt) { if (!memCheckEnabled) { return true; } if (freeMemAmount < LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount (%d kb) is less than low mem threshold (%d kb), memory request declined.", freeMemAmount, LOW_MEM_THRESHOLD)); return false; } if (freeMemAmount >= LOW_MEM_THRESHOLD && freeMemAmount < 2 * LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount (%d kb) is less than 2x low mem threshold (%d kb), re-read /proc/meminfo", freeMemAmount, LOW_MEM_THRESHOLD)); readMemoryInfoFile(); } if (freeMemAmount < LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount (%d kb) is less than low mem threshold (%d kb), memory request declined.", freeMemAmount, LOW_MEM_THRESHOLD)); return false; } if (freeMemAmount - xmx < LOW_MEM_THRESHOLD) { logger.info(String.format("Free memory amount minus xmx (%d - %d kb) is less than low mem threshold (%d kb), memory request declined.", freeMemAmount, xmx, LOW_MEM_THRESHOLD)); return false; } if (freeMemDecrAmt > 0) { freeMemAmount -= freeMemDecrAmt; logger.info(String.format("Memory (%d kb) granted. Current free memory amount is %d kb", freeMemDecrAmt, freeMemAmount)); } else { freeMemAmount -= xms; logger.info(String.format("Memory (%d kb) granted. Current free memory amount is %d kb", xms, freeMemAmount)); } return true; }
Source:
private boolean shouldAskOverlayPermission(){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if(SalesforceReactActivity.this.getReactNativeHost().getReactInstanceManager().getDevSupportManager().getDevSupportEnabled()){ if (!Settings.canDrawOverlays(this)) { return true; } } } return false; }

Target:
private boolean shouldAskOverlayPermission(){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if(SalesforceReactActivity.this.getReactNativeHost().getReactInstanceManager().getDevSupportManager().getDevSupportEnabled()){ if (!Settings.canDrawOverlays(this)) { showPermissionWarning(); return true; } else{ hidePermissionWarning(); } } } return false; }
Source:
private boolean shouldReassignMac(VmNetworkInterface iface) { return (getParameters().isReassignBadMacs() && vNicHasBadMac(iface)) || getParameters().isImportAsNewEntity() || StringUtils.isEmpty(iface.getMacAddress()); }

Target:
private boolean shouldReassignMac(VmNetworkInterface iface) { return StringUtils.isEmpty(iface.getMacAddress()) || (getParameters().isReassignBadMacs() && vNicHasBadMac(iface)) || getParameters().isImportAsNewEntity(); }
Source:
public void setup() throws ClientException { client = new Client(getPublicKey(), getSecretKey()); }

Target:
public void setup() throws Exception { client = getLiveClient(); }
Source:
private static Properties loadProps() { String registryClassProp = System.getProperty(REGISTRY_CLASS_PROP); String registryNameProp = System.getProperty(REGISTRY_NAME_PROP); String defaultRegistryName = System.getProperty(DEFAULT_REGISTRY_NAME); String registryJmxNameProp = System.getProperty(REGISTRY_JMX_NAME_PROP); Properties props = new Properties(); if (registryClassProp != null) { props.setProperty(REGISTRY_CLASS_PROP, registryClassProp); } if (registryNameProp != null) { props.setProperty(REGISTRY_NAME_PROP, registryNameProp); } if (defaultRegistryName != null) { props.setProperty(DEFAULT_REGISTRY_NAME, defaultRegistryName); } if (registryJmxNameProp != null) { props.setProperty(REGISTRY_JMX_NAME_PROP, registryJmxNameProp); } return props; }

Target:
private static Properties loadProps() { String registryClassProp = System.getProperty(REGISTRY_CLASS_PROP); String registryNameProp = System.getProperty(REGISTRY_NAME_PROP); String registryJmxNameProp = System.getProperty(REGISTRY_JMX_NAME_PROP); Properties props = new Properties(); if (registryClassProp != null) { props.setProperty(REGISTRY_CLASS_PROP, registryClassProp); } if (registryNameProp != null) { props.setProperty(REGISTRY_NAME_PROP, registryNameProp); } if (registryJmxNameProp != null) { props.setProperty(REGISTRY_JMX_NAME_PROP, registryJmxNameProp); } return props; }
Source:
public void run() { MembersView newMembersView = decideNewMembersView(localMemberMap, membersToAsk); clusterServiceLock.lock(); try { if (!clusterService.isJoined()) { if (logger.isFineEnabled()) { logger.fine("Ignoring decided members view after mastership claim: " + newMembersView + ", because not joined!"); } return; } MemberImpl localMember = clusterService.getLocalMember(); if (!newMembersView.containsMember(localMember.getAddress(), localMember.getUuid())) { if (logger.isFineEnabled()) { logger.fine("Ignoring decided members view after mastership claim: " + newMembersView + ", because current local member: " + localMember + " not in decided members view."); } return; } updateMembers(newMembersView); clusterService.getClusterJoinManager().reset(); sendMemberListToOthers(); logger.info("Mastership is claimed with: " + newMembersView); node.getNodeExtension().scheduleClusterVersionAutoUpgrade(); } finally { clusterServiceLock.unlock(); } }

Target:
public void run() { MembersView newMembersView = decideNewMembersView(localMemberMap, membersToAsk); clusterServiceLock.lock(); try { if (!clusterService.isJoined()) { if (logger.isFineEnabled()) { logger.fine("Ignoring decided members view after mastership claim: " + newMembersView + ", because not joined!"); } return; } MemberImpl localMember = clusterService.getLocalMember(); if (!newMembersView.containsMember(localMember.getAddress(), localMember.getUuid())) { if (logger.isFineEnabled()) { logger.fine("Ignoring decided members view after mastership claim: " + newMembersView + ", because current local member: " + localMember + " not in decided members view."); } return; } updateMembers(newMembersView); clusterService.getClusterJoinManager().reset(); sendMemberListToOthers(); logger.info("Mastership is claimed with: " + newMembersView); } finally { clusterServiceLock.unlock(); } }
Source:
public void pruneQueryInfo() { Optional<QueryInfo> finalInfo = finalQueryInfo.get(); if (!finalInfo.isPresent() || !finalInfo.get().getOutputStage().isPresent()) { return; } QueryInfo queryInfo = finalInfo.get(); StageInfo outputStage = queryInfo.getOutputStage().get(); StageInfo prunedOutputStage = new StageInfo( outputStage.getStageId(), outputStage.getState(), outputStage.getSelf(), null, outputStage.getTypes(), outputStage.getStageStats(), ImmutableList.of(), ImmutableList.of(), outputStage.getFailureCause()); QueryInfo prunedQueryInfo = new QueryInfo( queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), getMemoryPool().getId(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getFieldNames(), queryInfo.getQuery(), pruneQueryStats(queryInfo.getQueryStats()), queryInfo.getSetCatalog(), queryInfo.getSetSchema(), queryInfo.getSetSessionProperties(), queryInfo.getResetSessionProperties(), queryInfo.getAddedPreparedStatements(), queryInfo.getDeallocatedPreparedStatements(), queryInfo.getStartedTransactionId(), queryInfo.isClearTransactionId(), queryInfo.getUpdateType(), Optional.of(prunedOutputStage), queryInfo.getFailureInfo(), queryInfo.getErrorCode(), queryInfo.getWarnings(), queryInfo.getInputs(), queryInfo.getOutput(), queryInfo.getPlan(), queryInfo.isCompleteInfo(), queryInfo.getResourceGroupName()); finalQueryInfo.compareAndSet(finalInfo, Optional.of(prunedQueryInfo)); }

Target:
public void pruneQueryInfo() { Optional<QueryInfo> finalInfo = finalQueryInfo.get(); if (!finalInfo.isPresent() || !finalInfo.get().getOutputStage().isPresent()) { return; } QueryInfo queryInfo = finalInfo.get(); StageInfo outputStage = queryInfo.getOutputStage().get(); StageInfo prunedOutputStage = new StageInfo( outputStage.getStageId(), outputStage.getState(), outputStage.getSelf(), null, outputStage.getTypes(), outputStage.getStageStats(), ImmutableList.of(), ImmutableList.of(), outputStage.getFailureCause()); QueryInfo prunedQueryInfo = new QueryInfo( queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), getMemoryPool().getId(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getFieldNames(), queryInfo.getQuery(), pruneQueryStats(queryInfo.getQueryStats()), queryInfo.getSetCatalog(), queryInfo.getSetSchema(), queryInfo.getSetPath(), queryInfo.getSetSessionProperties(), queryInfo.getResetSessionProperties(), queryInfo.getAddedPreparedStatements(), queryInfo.getDeallocatedPreparedStatements(), queryInfo.getStartedTransactionId(), queryInfo.isClearTransactionId(), queryInfo.getUpdateType(), Optional.of(prunedOutputStage), queryInfo.getFailureInfo(), queryInfo.getErrorCode(), queryInfo.getWarnings(), queryInfo.getInputs(), queryInfo.getOutput(), queryInfo.isCompleteInfo(), queryInfo.getResourceGroupId()); finalQueryInfo.compareAndSet(finalInfo, Optional.of(prunedQueryInfo)); }
Source:
public DirectCompilerResult visitExpressionList(FEEL_1_1Parser.ExpressionListContext ctx) { List<DirectCompilerResult> exprs = new ArrayList<>(); for (int i = 0; i < ctx.getChildCount(); i++) { if (ctx.getChild(i) instanceof FEEL_1_1Parser.ExpressionContext) { FEEL_1_1Parser.ExpressionContext childCtx = (FEEL_1_1Parser.ExpressionContext) ctx.getChild(i); DirectCompilerResult child = visit(childCtx); if (!replaceEqualForUnaryTest) { exprs.add(child); } else { if (child.resultType == BuiltInType.UNARY_TEST) { exprs.add(child); } else if (child.resultType == BuiltInType.RANGE) { DirectCompilerResult replaced = createUnaryTestExpression(childCtx, child, UnaryOperator.IN); exprs.add(replaced); } else if (child.resultType == BuiltInType.BOOLEAN) { DirectCompilerResult replaced = createUnaryTestExpression(childCtx, child, UnaryOperator.TEST); exprs.add(replaced); } else { DirectCompilerResult replaced = createUnaryTestExpression(childCtx, child, UnaryOperator.EQ); exprs.add(replaced); } } } } MethodCallExpr list = new MethodCallExpr(null, "list"); exprs.stream().map(DirectCompilerResult::getExpression).forEach(list::addArgument); return DirectCompilerResult.of(list, BuiltInType.LIST, DirectCompilerResult.mergeFDs(exprs.toArray(new DirectCompilerResult[]{}))); }

Target:
public DirectCompilerResult visitExpressionList(FEEL_1_1Parser.ExpressionListContext ctx) { List<DirectCompilerResult> exprs = new ArrayList<>(); for (int i = 0; i < ctx.getChildCount(); i++) { if (ctx.getChild(i) instanceof FEEL_1_1Parser.ExpressionContext) { FEEL_1_1Parser.ExpressionContext childCtx = (FEEL_1_1Parser.ExpressionContext) ctx.getChild(i); DirectCompilerResult child = visit(childCtx); exprs.add(child); } } MethodCallExpr list = new MethodCallExpr(null, "list"); exprs.stream().map(DirectCompilerResult::getExpression).forEach(list::addArgument); return DirectCompilerResult.of(list, BuiltInType.LIST, DirectCompilerResult.mergeFDs(exprs.toArray(new DirectCompilerResult[]{}))); }
Source:
private void replaceThing(Thing oldThing, Thing newThing) { final ThingHandler thingHandler = thingHandlers.get(newThing.getUID()); if (oldThing != newThing) { this.things.remove(oldThing); this.things.add(newThing); if (thingHandler != null) { newThing.setHandler(thingHandler); } if (oldThing != null) { oldThing.setHandler(null); } } }

Target:
private ThingHandler replaceThing(Thing oldThing, Thing newThing) { final ThingHandler thingHandler = thingHandlers.get(newThing.getUID()); if (oldThing != newThing) { this.things.remove(oldThing); this.things.add(newThing); if (thingHandler != null) { newThing.setHandler(thingHandler); } if (oldThing != null) { oldThing.setHandler(null); } } return thingHandler; }
Source:
private boolean fetchJobResult(int rows, TDJobOperator job) { Optional<ArrayValue> firstRow = job.getResult(ite -> ite.hasNext() ? Optional.of(ite.next()) : Optional.absent()); if (!firstRow.isPresent()) { throw new RuntimeException("Got unexpected empty result for count job: " + job.getJobId()); } ArrayValue row = firstRow.get(); if (row.size() != 1) { throw new RuntimeException("Got unexpected result row size for count job: " + row.size()); } Value count = row.get(0); IntegerValue actualRows; try { actualRows = count.asIntegerValue(); } catch (MessageTypeCastException e) { throw new RuntimeException("Got unexpected value type count job: " + count.getValueType()); } return BigInteger.valueOf(rows).compareTo(actualRows.asBigInteger()) <= 0; }

Target:
private boolean fetchJobResult(int rows, TDJobOperator job) { Optional<ArrayValue> firstRow = job.getResult(ite -> ite.hasNext() ? Optional.of(ite.next()) : Optional.absent()); if (!firstRow.isPresent()) { throw new TaskExecutionException("Got unexpected empty result for count job: " + job.getJobId(), ConfigElement.empty()); } ArrayValue row = firstRow.get(); if (row.size() != 1) { throw new TaskExecutionException("Got unexpected result row size for count job: " + row.size(), ConfigElement.empty()); } Value count = row.get(0); IntegerValue actualRows; try { actualRows = count.asIntegerValue(); } catch (MessageTypeCastException e) { throw new TaskExecutionException("Got unexpected value type count job: " + count.getValueType(), ConfigElement.empty()); } return BigInteger.valueOf(rows).compareTo(actualRows.asBigInteger()) <= 0; }
Source:
public static FluidAttributes createVanillaFluidAttributes(Fluid fluid) { if (fluid instanceof EmptyFluid) return net.minecraftforge.fluids.FluidAttributes.builder(fluid, new net.minecraft.util.ResourceLocation("white"), new net.minecraft.util.ResourceLocation("white")) .translationKey("block.minecraft.air") .color(0).density(0).temperature(0).luminosity(0).viscosity(0).density(0).build(); if (fluid instanceof WaterFluid) return net.minecraftforge.fluids.FluidAttributes.Water.builder(fluid, new net.minecraft.util.ResourceLocation("block/water_still"), new net.minecraft.util.ResourceLocation("block/water_flow")) .overlay(new net.minecraft.util.ResourceLocation("block/water_overlay")) .translationKey("block.minecraft.water") .color(0x3F76E4).build(); if (fluid instanceof LavaFluid) return net.minecraftforge.fluids.FluidAttributes.builder(fluid, new net.minecraft.util.ResourceLocation("block/lava_still"), new net.minecraft.util.ResourceLocation("block/lava_flow")) .translationKey("block.minecraft.lava") .luminosity(15).density(3000).viscosity(6000).temperature(1300).build(); throw new RuntimeException("Mod fluids must override createAttributes."); }

Target:
public static FluidAttributes createVanillaFluidAttributes(Fluid fluid) { if (fluid instanceof EmptyFluid) return net.minecraftforge.fluids.FluidAttributes.builder( new net.minecraft.util.ResourceLocation("white"), new net.minecraft.util.ResourceLocation("white")) .translationKey("block.minecraft.air") .color(0).density(0).temperature(0).luminosity(0).viscosity(0).build(fluid); if (fluid instanceof WaterFluid) return net.minecraftforge.fluids.FluidAttributes.Water.builder( new net.minecraft.util.ResourceLocation("block/water_still"), new net.minecraft.util.ResourceLocation("block/water_flow")) .overlay(new net.minecraft.util.ResourceLocation("block/water_overlay")) .translationKey("block.minecraft.water") .color(0x3F76E4).build(fluid); if (fluid instanceof LavaFluid) return net.minecraftforge.fluids.FluidAttributes.builder( new net.minecraft.util.ResourceLocation("block/lava_still"), new net.minecraft.util.ResourceLocation("block/lava_flow")) .translationKey("block.minecraft.lava") .luminosity(15).density(3000).viscosity(6000).temperature(1300).build(fluid); throw new RuntimeException("Mod fluids must override createAttributes."); }
Source:
static List<String> decodeAttributeValue(final String attributeValue) { return ParsingUtils.split(attributeValue, VALUE_DELIMITER).stream(). map(a -> { try { return URLDecoder.decode(a.trim(), "UTF-8"); } catch (final UnsupportedEncodingException ex) { throw new TribbleException("Error decoding attribute", ex); } }). collect(Collectors.toList()); }

Target:
static List<String> decodeAttributeValue(final String attributeValue) { final List<String> splitValues = ParsingUtils.split(attributeValue, Gff3Constants.VALUE_DELIMITER); final List<String> decodedValues = new ArrayList<>(); for (final String encodedValue : splitValues) { try { decodedValues.add(URLDecoder.decode(encodedValue.trim(), "UTF-8")); } catch (final UnsupportedEncodingException ex) { throw new TribbleException("Error decoding attribute " + encodedValue, ex); } } return decodedValues; }
Source:
public void handleAction(ActionParameters params) throws ActionException { params.requireLoggedInUser(); final long id = ConversionHelper.getLong(params.getHttpParam(PARAM_ID), -1); if(id == -1) { throw new ActionParamsException("Parameter missing or non-numeric: " + PARAM_ID + "=" + params.getHttpParam(PARAM_ID)); } final UserLayer userLayer = userLayerDbService.getUserLayerById(id); final UserLayerStyle style = new UserLayerStyle(); if(userLayer == null) { throw new ActionParamsException("Userlayer id doesn't exist: " + id); } if(!userLayer.isOwnedBy(params.getUser().getUuid())) { throw new ActionDeniedException("Userlayer belongs to another user"); } userLayer.setLayer_name(params.getHttpParam(PARAM_NAME)); userLayer.setLayer_desc(params.getHttpParam(PARAM_DESC)); userLayer.setLayer_source(params.getHttpParam(PARAM_SOURCE)); try { final JSONObject stylejs = JSONHelper .createJSONObject(params.getHttpParam(PARAM_STYLE)); style.setId(id); style.populateFromJSON(stylejs); } catch (JSONException e) { throw new ActionException("Unable to populate style from JSON", e); } userLayerDbService.updateUserLayerCols(userLayer); userLayerDbService.updateUserLayerStyleCols(style); JSONObject ulayer = userlayerService.parseUserLayer2JSON(userLayer); JSONObject permissions = OskariLayerWorker.getAllowedPermissions(); JSONHelper.putValue(ulayer, "permissions", permissions); ResponseHelper.writeResponse(params, ulayer); }

Target:
public void handleAction(ActionParameters params) throws ActionException { params.requireLoggedInUser(); final long id = params.getRequiredParamLong(PARAM_ID); final UserLayer userLayer = userLayerDbService.getUserLayerById(id); final UserLayerStyle style = new UserLayerStyle(); if(userLayer == null) { throw new ActionParamsException("Userlayer id doesn't exist: " + id); } if(!userLayer.isOwnedBy(params.getUser().getUuid())) { throw new ActionDeniedException("Userlayer belongs to another user"); } userLayer.setLayer_name(params.getRequiredParam(PARAM_NAME)); userLayer.setLayer_desc(params.getHttpParam(PARAM_DESC, userLayer.getLayer_desc())); userLayer.setLayer_source(params.getHttpParam(PARAM_SOURCE, userLayer.getLayer_source())); try { final JSONObject stylejs = JSONHelper .createJSONObject(params.getHttpParam(PARAM_STYLE)); style.setId(id); style.populateFromJSON(stylejs); } catch (JSONException e) { throw new ActionParamsException("Unable to populate style from JSON", e); } userLayerDbService.updateUserLayerCols(userLayer); userLayerDbService.updateUserLayerStyleCols(style); JSONObject ulayer = userlayerService.parseUserLayer2JSON(userLayer); JSONObject permissions = OskariLayerWorker.getAllowedPermissions(); JSONHelper.putValue(ulayer, "permissions", permissions); ResponseHelper.writeResponse(params, ulayer); }
Source:
String getShortDescription() { if(shortDesc!=null) { return shortDesc; } String description=null; if(bundle!=null && bundle.getHeaders()!=null) { description = bundle.getHeaders().get(Constants.BUNDLE_DESCRIPTION); } if(obrResource!=null && obrResource.getProperties()!=null) { Object descrObj = obrResource.getProperties().get(Resource.DESCRIPTION); if(descrObj instanceof String) { description = (String)descrObj; } } if(description!=null) { if(description.length()>MAX_SHORT_DESCRIPTION_CHAR_COUNT) { StringBuilder shortDescBuilder = new StringBuilder(); for(String word : description.split(" ")) { if(shortDescBuilder.length()+word.length() < MAX_SHORT_DESCRIPTION_CHAR_COUNT) { shortDescBuilder.append(word); shortDescBuilder.append(" "); } else { shortDescBuilder.append(".."); break; } } shortDesc = shortDescBuilder.toString(); description = shortDesc; } return description; } else { return ""; } }

Target:
public String getShortDescription() { if(shortDesc!=null) { return shortDesc; } String description=null; if(bundle!=null && bundle.getHeaders()!=null) { description = bundle.getHeaders().get(Constants.BUNDLE_DESCRIPTION); } else if(obrResource!=null && obrResource.getProperties()!=null) { Object descrObj = obrResource.getProperties().get(Resource.DESCRIPTION); if(descrObj instanceof String) { description = (String)descrObj; } } if(description!=null) { if(description.length()>MAX_SHORT_DESCRIPTION_CHAR_COUNT) { StringBuilder shortDescBuilder = new StringBuilder(); for(String word : description.split(" ")) { if(shortDescBuilder.length()+word.length() < MAX_SHORT_DESCRIPTION_CHAR_COUNT) { shortDescBuilder.append(word); shortDescBuilder.append(" "); } else { shortDescBuilder.append(".."); break; } } shortDesc = shortDescBuilder.toString(); description = shortDesc; } return description; } else { return ""; } }
Source:
public com.azure.core.http.HttpClient build() { HttpClient nettyHttpClient; if (this.connectionProvider != null) { if (this.baseHttpClient != null) { throw logger.logExceptionAsError(new IllegalStateException("connectionProvider cannot be set on an " + "existing reactor netty HttpClient.")); } nettyHttpClient = HttpClient.create(this.connectionProvider); } else { nettyHttpClient = this.baseHttpClient == null ? HttpClient.create() : this.baseHttpClient; } Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; nettyHttpClient = nettyHttpClient .port(port) .wiretap(enableWiretap) .tcpConfiguration(tcpConfig -> { if (nioEventLoopGroup != null) { tcpConfig = tcpConfig.runOn(nioEventLoopGroup); } ProxyOptions buildProxyOptions = (proxyOptions == null) ? ProxyOptions.loadFromEnvironment(buildConfiguration) : proxyOptions; if (buildProxyOptions != null) { tcpConfig = tcpConfig.proxy(typeSpec -> typeSpec.type(mapProxyType(buildProxyOptions.getType(), logger)) .address(proxyOptions.getAddress()) .username(proxyOptions.getUsername()) .password(user -> proxyOptions.getPassword()) .nonProxyHosts(proxyOptions.getNonProxyHosts())); } return tcpConfig; }); return new NettyAsyncHttpClient(nettyHttpClient); }

Target:
public com.azure.core.http.HttpClient build() { HttpClient nettyHttpClient; if (this.connectionProvider != null) { if (this.baseHttpClient != null) { throw logger.logExceptionAsError(new IllegalStateException("connectionProvider cannot be set on an " + "existing reactor netty HttpClient.")); } nettyHttpClient = HttpClient.create(this.connectionProvider); } else { nettyHttpClient = this.baseHttpClient == null ? HttpClient.create() : this.baseHttpClient; } Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; nettyHttpClient = nettyHttpClient .port(port) .wiretap(enableWiretap) .tcpConfiguration(tcpConfig -> { if (nioEventLoopGroup != null) { tcpConfig = tcpConfig.runOn(nioEventLoopGroup); } ProxyOptions buildProxyOptions = (proxyOptions == null) ? ProxyOptions.fromConfiguration(buildConfiguration) : proxyOptions; if (buildProxyOptions != null) { tcpConfig = tcpConfig.proxy(typeSpec -> typeSpec.type(mapProxyType(buildProxyOptions.getType(), logger)) .address(proxyOptions.getAddress()) .username(proxyOptions.getUsername()) .password(user -> proxyOptions.getPassword()) .nonProxyHosts(proxyOptions.getNonProxyHosts())); } return tcpConfig; }); return new NettyAsyncHttpClient(nettyHttpClient); }
Source:
public JMXConnectionTypeFragment() { providerMap = UIExtensionManager.getConnectionUIElements(); childFragmentMap = new HashMap<String, WizardFragment>(); }

Target:
public JMXConnectionTypeFragment() { providerMap = UIExtensionManager.getConnectionUIElements(); childFragmentMap = new HashMap<>(); }
Source:
private BlobSoftRef getBlobSoftRef() { if (blobSoftRef == null) { try { this.blobSoftRef = (BlobSoftRef) field.get(accessPath.apply(descriptor.getReferenceInstance())); } catch (Exception e) { throw Exceptions.handle() .to(Mixing.LOG) .error(e) .withSystemErrorMessage( "Unable to obtain a BlobSoftRef object from entity ref field ('%s' in '%s'): %s (%s)", getName(), descriptor.getType().getName()) .handle(); } } return blobSoftRef; }

Target:
private BlobSoftRef getBlobSoftRef() { if (blobSoftRef == null) { try { blobSoftRef = (BlobSoftRef) field.get(accessPath.apply(descriptor.getReferenceInstance())); } catch (Exception e) { throw Exceptions.handle() .to(Mixing.LOG) .error(e) .withSystemErrorMessage( "Unable to obtain a BlobSoftRef object from entity ref field ('%s' in '%s'): %s (%s)", getName(), descriptor.getType().getName()) .handle(); } } return blobSoftRef; }
Source:
public void read1() { for (int i = 0; i < 500000; i++) { sum += d1.get(i); } }

Target:
public void read1() { for (int i = 0; i < values; i++) { sum += d1.get(i); } }
Source:
public void verifyIndex(PackIndex idx) throws CorruptPackIndexException { ObjectIdOwnerMap<ObjFromPack> inPack = new ObjectIdOwnerMap<>(); for (int i = 0; i < getObjectCount(); i++) { PackedObjectInfo entry = getObject(i); inPack.add(new ObjFromPack(entry)); long offs = idx.findOffset(entry); if (offs == -1) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().missingObject, entry.getType(), entry.getName()), ErrorType.MISSING_OBJ); } else if (offs != entry.getOffset()) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().mismatchOffset, entry.getName()), ErrorType.MISMATCH_OFFSET); } try { if (idx.hasCRC32Support() && (int) idx.findCRC32(entry) != entry.getCRC()) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().mismatchCRC, entry.getName()), ErrorType.MISMATCH_CRC); } } catch (MissingObjectException e) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().missingCRC, entry.getName()), ErrorType.MISSING_CRC); } } for (MutableEntry entry : idx) { if (!inPack.contains(entry.toObjectId())) { throw new CorruptPackIndexException(MessageFormat.format( JGitText.get().unknownObjectInIndex, entry.name()), ErrorType.UNKNOWN_OBJ); } } }

Target:
public void verifyIndex(PackIndex idx) throws CorruptPackIndexException { ObjectIdOwnerMap<ObjFromPack> inPack = new ObjectIdOwnerMap<>(); for (int i = 0; i < getObjectCount(); i++) { PackedObjectInfo entry = getObject(i); inPack.add(new ObjFromPack(entry)); long offs = idx.findOffset(entry); if (offs == -1) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().missingObject, Integer.valueOf(entry.getType()), entry.getName()), ErrorType.MISSING_OBJ); } else if (offs != entry.getOffset()) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().mismatchOffset, entry.getName()), ErrorType.MISMATCH_OFFSET); } try { if (idx.hasCRC32Support() && (int) idx.findCRC32(entry) != entry.getCRC()) { throw new CorruptPackIndexException( MessageFormat.format(JGitText.get().mismatchCRC, entry.getName()), ErrorType.MISMATCH_CRC); } } catch (MissingObjectException e) { throw new CorruptPackIndexException(MessageFormat .format(JGitText.get().missingCRC, entry.getName()), ErrorType.MISSING_CRC); } } for (MutableEntry entry : idx) { if (!inPack.contains(entry.toObjectId())) { throw new CorruptPackIndexException(MessageFormat.format( JGitText.get().unknownObjectInIndex, entry.name()), ErrorType.UNKNOWN_OBJ); } } }
Source:
public void testMonacoMotorcycle() { List<OneRun> list = new ArrayList<OneRun>(); list.add(new OneRun(43.730729, 7.42135, 43.727697, 7.419199, 2703, 119)); list.add(new OneRun(43.727687, 7.418737, 43.74958, 7.436566, 3749, 170)); list.add(new OneRun(43.728677, 7.41016, 43.739213, 7.4277, 3175, 169)); list.add(new OneRun(43.733802, 7.413433, 43.739662, 7.424355, 5636, 298)); list.add(new OneRun(43.730949, 7.412338, 43.739643, 7.424542, 5467, 277)); list.add(new OneRun(43.727592, 7.419333, 43.727712, 7.419333, 0, 1)); runAlgo(testCollector, "files/monaco.osm.gz", "target/monaco-mc-gh", list, "motorcycle", true, "motorcycle", "fastest", true); assertEquals(testCollector.toString(), 0, testCollector.errors.size()); }

Target:
public void testMonacoMotorcycle() { List<OneRun> list = new ArrayList<OneRun>(); list.add(new OneRun(43.730729, 7.42135, 43.727697, 7.419199, 2703, 119)); list.add(new OneRun(43.727687, 7.418737, 43.74958, 7.436566, 3749, 170)); list.add(new OneRun(43.728677, 7.41016, 43.739213, 7.4277, 3175, 169)); list.add(new OneRun(43.733802, 7.413433, 43.739662, 7.424355, 2423, 141)); list.add(new OneRun(43.730949, 7.412338, 43.739643, 7.424542, 2253, 120)); list.add(new OneRun(43.727592, 7.419333, 43.727712, 7.419333, 0, 1)); runAlgo(testCollector, "files/monaco.osm.gz", "target/monaco-mc-gh", list, "motorcycle", true, "motorcycle", "fastest", true); assertEquals(testCollector.toString(), 0, testCollector.errors.size()); }
Source:
public void test_precaching_of_account_proximityUUIDS() throws IOException, JSONException, InterruptedException { BaseResolveResponse resolveResponse = gson.fromJson(Utils.getRawResourceAsString(com.sensorberg.sdk.test.R.raw.response_resolve_precaching, InstrumentationRegistry.getContext()), BaseResolveResponse.class); Mockito.when(mockRetrofitApiService.updateBeaconLayout(Mockito.anyString())).thenReturn(Calls.response(resolveResponse)); Assertions.assertThat(spiedInternalApplicationBootstrapper.proximityUUIDs).hasSize(0); System.out.println("TheInternalBootstrapperIntegration start test_precaching_of_account_proximityUUIDS"); spiedTransportWithMockService.setProximityUUIDUpdateHandler(new Transport.ProximityUUIDUpdateHandler() { @Override public void proximityUUIDListUpdated(List<String> proximityUUIDs) { Assertions.assertThat(proximityUUIDs.size()).isEqualTo(5); } }); spiedInternalApplicationBootstrapper.updateBeaconLayout(); }

Target:
public void test_precaching_of_account_proximityUUIDS() throws IOException, JSONException, InterruptedException { BaseResolveResponse resolveResponse = gson.fromJson(Utils.getRawResourceAsString(com.sensorberg.sdk.test.R.raw.response_resolve_precaching, InstrumentationRegistry.getContext()), BaseResolveResponse.class); Mockito.when(mockRetrofitApiService.updateBeaconLayout(Mockito.anyString())).thenReturn(Calls.response(resolveResponse)); Assertions.assertThat(spiedInternalApplicationBootstrapper.proximityUUIDs).hasSize(0); spiedTransportWithMockService.setProximityUUIDUpdateHandler(new Transport.ProximityUUIDUpdateHandler() { @Override public void proximityUUIDListUpdated(List<String> proximityUUIDs) { Assertions.assertThat(proximityUUIDs.size()).isEqualTo(5); } }); spiedInternalApplicationBootstrapper.updateBeaconLayout(); }