auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void unzipFile(String archivePath, String targetPath) { try { File archiveFile = new File(archivePath); File targetFile = new File(targetPath); ZipFile zipFile = new ZipFile(archiveFile); Enumeration<?> e = zipFile.getEntries(); while (e.hasMoreElements()) { ZipArchiveEntry zipEntry = (ZipArchiveEntry) e.nextElement(); File file = new File(targetFile, zipEntry.getName()); if (zipEntry.isDirectory()) { FileUtils.forceMkdir(file); } else { InputStream is = zipFile.getInputStream(zipEntry); FileOutputStream os = FileUtils.openOutputStream(file); try { IOUtils.copy(is, os); } finally { os.close(); is.close(); } } } } catch (ZipException e) { log.error(e); } catch (IOException e) { log.error(e); } }

Target:
public void unzipFile(String archivePath, String targetPath) throws Exception { try { File archiveFile = new File(archivePath); File targetFile = new File(targetPath); ZipFile zipFile = new ZipFile(archiveFile); Enumeration<?> e = zipFile.getEntries(); while (e.hasMoreElements()) { ZipArchiveEntry zipEntry = (ZipArchiveEntry) e.nextElement(); File file = new File(targetFile, zipEntry.getName()); if (zipEntry.isDirectory()) { FileUtils.forceMkdir(file); } else { InputStream is = zipFile.getInputStream(zipEntry); FileOutputStream os = FileUtils.openOutputStream(file); try { IOUtils.copy(is, os); } finally { os.close(); is.close(); } } } } catch (ZipException e) { throw new Exception("Unzipping failed"); } catch (IOException e) { throw new Exception(); } }
Source:
public void setFile(File file) { this.file = file; try { getConfiguration().setDirectory(file.getCanonicalPath()); } catch (IOException e) { LOGGER.warn( "Unable to canonicalize processingMechanism{}. Verify location is accessible.", file.toString()); } }

Target:
public void setFile(File file) { this.file = file; try { getConfiguration().setDirectory(file.getCanonicalPath()); } catch (IOException e) { LOGGER.warn("Unable to canonicalize {}. Verify location is accessible.", file.toString()); } }
Source:
public void getMbusEncryptionKeyStatusByChannel(final DeviceMessageMetadata deviceMessageMetadata, final GetMbusEncryptionKeyStatusByChannelRequestData getMbusEncryptionKeyStatusByChannelRequestData) throws FunctionalException { LOGGER.info( "getMbusEncryptionKeyStatusByChannel for organisationIdentification: for deviceIdentification: {}", deviceMessageMetadata.getOrganisationIdentification(), deviceMessageMetadata.getDeviceIdentification()); final SmartMeter gatewayDevice = this.domainHelperService .findSmartMeter(deviceMessageMetadata.getDeviceIdentification()); if (gatewayDevice == null) { throw new FunctionalException(FunctionalExceptionType.GATEWAY_DEVICE_NOT_SET_FOR_MBUS_DEVICE, ComponentType.DOMAIN_SMART_METERING, new GatewayDeviceNotSetForMbusDeviceException()); } this.osgpCoreRequestMessageSender.send( new RequestMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), gatewayDevice.getDeviceIdentification(), gatewayDevice.getIpAddress(), new GetMbusEncryptionKeyStatusByChannelRequestDataDto( getMbusEncryptionKeyStatusByChannelRequestData.getChannel())), deviceMessageMetadata.getMessageType(), deviceMessageMetadata.getMessagePriority(), deviceMessageMetadata.getScheduleTime()); }

Target:
public void getMbusEncryptionKeyStatusByChannel(final DeviceMessageMetadata deviceMessageMetadata, final GetMbusEncryptionKeyStatusByChannelRequestData getMbusEncryptionKeyStatusByChannelRequestData) throws FunctionalException { LOGGER.info( "getMbusEncryptionKeyStatusByChannel for organisationIdentification: for deviceIdentification: {}", deviceMessageMetadata.getOrganisationIdentification(), deviceMessageMetadata.getDeviceIdentification()); final SmartMeter gatewayDevice = this.domainHelperService .findSmartMeter(deviceMessageMetadata.getDeviceIdentification()); this.osgpCoreRequestMessageSender.send( new RequestMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), gatewayDevice.getDeviceIdentification(), gatewayDevice.getIpAddress(), new GetMbusEncryptionKeyStatusByChannelRequestDataDto( getMbusEncryptionKeyStatusByChannelRequestData.getChannel())), deviceMessageMetadata.getMessageType(), deviceMessageMetadata.getMessagePriority(), deviceMessageMetadata.getScheduleTime()); }
Source:
public void testMakeTimeZone_NoOffsets() throws IOException { int[][] times = {}; int[][] offsets = {}; try { createZoneInfo(times, offsets); fail("Did not detect no transitions"); } catch (IllegalStateException expected) { } }

Target:
public void testMakeTimeZone_NoOffsets() throws Exception { int[][] times = {}; int[][] offsets = {}; try { createZoneInfo(times, offsets); fail("Did not detect no transitions"); } catch (IllegalStateException expected) { } }
Source:
public void terminate(HazelcastInstance instance) { try { Address address = getNode(instance).address; terminateInstance(instance); if (isMockNetwork) { registry.removeInstance(address); } } finally { TestJmxLeakHelper.checkJmxBeans(instance.getName()); } }

Target:
public void terminate(HazelcastInstance instance) { Address address = getNode(instance).address; terminateInstance(instance); if (isMockNetwork) { registry.removeInstance(address); } }
Source:
public void extract(String filename, File archiveFile, @Nullable Predicate<String> filter, Processor<ExtractedFile, Boolean> extractedFileConsumer) { try { if (isZIPFile(Files.getFileExtension(filename))) { extractZIP(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } else { extract7z(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } } catch (Exception e) { throw Exceptions.handle() .error(e) .withSystemErrorMessage("An error occurred while unzipping an archive (%s): %s (%s)", filename) .handle(); } }

Target:
public void extract(String filename, File archiveFile, @Nullable Predicate<String> filter, Processor<ExtractedFile, Boolean> extractedFileConsumer) { try { if (isZipFile(Files.getFileExtension(filename)) || !isSevenZipEnabled()) { extractZip(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } else { extract7z(archiveFile, enhanceFileFilter(filter), extractedFileConsumer); } } catch (Exception e) { throw Exceptions.handle() .error(e) .withSystemErrorMessage("An error occurred while unzipping an archive (%s): %s (%s)", filename) .handle(); } }
Source:
public void addMainContentView(String label, String historyToken, String contentUrl, int priority, boolean defaultPlace) { menuPresenterWidget.addMenuItem(priority, label, historyToken); dynamicUrlContentProxyFactory.create(historyToken, contentUrl); if (defaultPlace && placeManager instanceof WebAdminPlaceManager) { ((WebAdminPlaceManager) placeManager).setDefaultPlace(historyToken); } }

Target:
public void addMainContentView(String label, String historyToken, String contentUrl, int priority, boolean defaultPlace) { menuPresenterWidget.addMenuItem(priority, label, historyToken); dynamicUrlContentProxyFactory.create(historyToken, contentUrl); placeManager.setDefaultPlace(historyToken); }
Source:
public String getString(ByteBuffer byteBuffer) { return BytesType.instance.getString(byteBuffer); }

Target:
public String getString(ByteBuffer byteBuffer) { if (byteBuffer == null) return null; return BytesType.instance.getString(byteBuffer.duplicate()); }
Source:
private ModuleOptionsMetadata inferModuleOptionsMetadata(ModuleDefinition definition, ClassLoader classLoaderToUse) { final SimpleModuleOptionsMetadata result = new SimpleModuleOptionsMetadata(); final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); reader.setResourceLoader(new PathMatchingResourcePatternResolver(classLoaderToUse)); reader.loadBeanDefinitions(definition.getResource()); final PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper("${", "}"); final PlaceholderResolver placeholderResolver = new PlaceholderResolver() { @Override public String resolvePlaceholder(String placeholderName) { int colon = placeholderName.indexOf(':'); String optionName = colon >= 0 ? placeholderName.substring(0, colon) : placeholderName; if (optionName.indexOf('.') == -1) { ModuleOption option = new ModuleOption(optionName, "unknwown").withType(String.class); result.add(option); } return placeholderName; } }; final StringValueResolver resolver = new StringValueResolver() { @Override public String resolveStringValue(String strVal) { helper.replacePlaceholders(strVal, placeholderResolver); return strVal; } }; PlaceholderConfigurerSupport support = new PlaceholderConfigurerSupport() { @Override protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException { } { doProcessProperties(beanFactory, resolver); } }; return result; }

Target:
private ModuleOptionsMetadata inferModuleOptionsMetadata(ModuleDefinition definition, ClassLoader classLoaderToUse) { final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); reader.setResourceLoader(new PathMatchingResourcePatternResolver(classLoaderToUse)); reader.loadBeanDefinitions(definition.getResource()); return defaultModuleOptionsMetadataCollector.collect(beanFactory); }
Source:
public static <M, OM> StreamOperatorSpec<M, OM> createFlatMapOperatorSpec( FlatMapFunction<? super M, ? extends OM> flatMapFn, String opId) { return StreamOperatorSpec.<M, OM>createStreamOperatorSpec((FlatMapFunction<M, OM>) flatMapFn, OperatorSpec.OpCode.FLAT_MAP, opId); }

Target:
public static <M, OM> StreamOperatorSpec<M, OM> createFlatMapOperatorSpec( FlatMapFunction<? super M, ? extends OM> flatMapFn, String opId) { return new FlatMapOperatorSpec<>((FlatMapFunction<M, OM>) flatMapFn, opId); }
Source:
public Future<String> stitchBlob(BlobProperties blobProperties, byte[] userMetadata, List<ChunkInfo> chunksToStitch, Callback<String> callback) { if (blobProperties == null || chunksToStitch == null) { throw new IllegalArgumentException("blobProperties or channel must not be null"); } if (userMetadata == null) { userMetadata = new byte[0]; } currentOperationsCount.incrementAndGet(); if (blobProperties.isEncrypted()) { routerMetrics.stitchEncryptedBlobOperationRate.mark(); } else { routerMetrics.stitchBlobOperationRate.mark(); } routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<>(); if (isOpen.get()) { getOperationController().stitchBlob(blobProperties, userMetadata, chunksToStitch, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException, blobProperties.isEncrypted(), true); completeOperation(futureResult, callback, null, routerException); } return futureResult; }

Target:
public Future<String> stitchBlob(BlobProperties blobProperties, byte[] userMetadata, List<ChunkInfo> chunksToStitch, Callback<String> callback) { if (blobProperties == null || chunksToStitch == null) { throw new IllegalArgumentException("blobProperties or chunksToStitch must not be null"); } if (userMetadata == null) { userMetadata = new byte[0]; } currentOperationsCount.incrementAndGet(); if (blobProperties.isEncrypted()) { routerMetrics.stitchEncryptedBlobOperationRate.mark(); } else { routerMetrics.stitchBlobOperationRate.mark(); } routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<>(); if (isOpen.get()) { getOperationController().stitchBlob(blobProperties, userMetadata, chunksToStitch, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException, blobProperties.isEncrypted(), true); completeOperation(futureResult, callback, null, routerException); } return futureResult; }
Source:
private void updateDeploymentConfigValues(IDeploymentConfig deploymentConfig, DebuggingContext debugContext) { Collection<IContainer> originalContainers = deploymentConfig.getContainers(); if (originalContainers != null && !originalContainers.isEmpty() && debugContext.isDebugEnabled()) { Collection<IContainer> containers = new ArrayList<>(originalContainers); IContainer container = containers.iterator().next(); Set<IPort> ports = new HashSet<>(container.getPorts()); IPort existing = ports.stream().filter(p -> p.getContainerPort() == debugContext.getDebugPort()) .findFirst().orElse(null); boolean added = false; if (existing == null) { PortSpecAdapter newPort = new PortSpecAdapter("debug", "TCP", debugContext.getDebugPort()); added = ports.add(newPort); } else { PortSpecAdapter newPort = new PortSpecAdapter(existing.getName(), existing.getProtocol(), debugContext.getDebugPort()); if (!existing.equals(newPort)) { ports.remove(existing); added = ports.add(newPort); } } if (added) { container.setPorts(ports); deploymentConfig.setContainers(containers); } } deploymentConfig.setEnvironmentVariable("DEBUG_PORT", String.valueOf(debugContext.getDebugPort())); deploymentConfig.setEnvironmentVariable("DEV_MODE", String.valueOf(debugContext.isDebugEnabled())); deploymentConfig.setEnvironmentVariable("DEBUG", String.valueOf(debugContext.isDebugEnabled())); }

Target:
private void updateDeploymentConfigValues(IDeploymentConfig deploymentConfig, DebuggingContext debugContext) { Collection<IContainer> originalContainers = deploymentConfig.getContainers(); if (originalContainers != null && !originalContainers.isEmpty() && debugContext.isDebugEnabled()) { Collection<IContainer> containers = new ArrayList<>(originalContainers); IContainer container = containers.iterator().next(); Set<IPort> ports = new HashSet<>(container.getPorts()); IPort existing = ports.stream().filter(p -> p.getContainerPort() == debugContext.getDebugPort()) .findFirst().orElse(null); boolean added = false; if (existing == null) { PortSpecAdapter newPort = new PortSpecAdapter("debug", "TCP", debugContext.getDebugPort()); added = ports.add(newPort); } else { PortSpecAdapter newPort = new PortSpecAdapter(existing.getName(), existing.getProtocol(), debugContext.getDebugPort()); if (!existing.equals(newPort)) { ports.remove(existing); added = ports.add(newPort); } } if (added) { container.setPorts(ports); deploymentConfig.setContainers(containers); } } deploymentConfig.setEnvironmentVariable(DEBUG_PORT_KEY, String.valueOf(debugContext.getDebugPort())); deploymentConfig.setEnvironmentVariable(DEV_MODE_KEY, String.valueOf(debugContext.isDebugEnabled())); deploymentConfig.setEnvironmentVariable(DEBUG_KEY, String.valueOf(debugContext.isDebugEnabled())); }
Source:
public LayoutLensSupport(VisualizationViewer<V, E> vv) { super(vv, new ModalLensGraphMouse()); LayoutModel<V, Point2D> layoutModel = vv.getModel().getLayoutModel(); Dimension layoutModelSize = new Dimension(layoutModel.getWidth(), layoutModel.getHeight()); Lens lens = new Lens(layoutModelSize); this.lensTransformer = new HyperbolicTransformer( lens, vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)); }

Target:
public LayoutLensSupport(VisualizationViewer<V, E> vv) { this( vv, new HyperbolicTransformer( new Lens(vv.getModel().getLayoutSize()), vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)), new ModalLensGraphMouse()); }
Source:
public void testScriptExecutableContainerNull() throws InvalidScriptException { sec = null; Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); assertEquals(false, result); }

Target:
public void testScriptExecutableContainerNull() throws InvalidScriptException { sec = null; Mockito.when(etd.getInternal()).thenReturn(ist); Mockito.when(ist.getExecutableContainer()).thenReturn(sec); Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); assertFalse(result); }
Source:
public boolean doMonitor(ServiceEmitter emitter) { emitter.emit(new ServiceMetricEvent.Builder().build("segment/max", serverConfig.getMaxSize())); long totalUsed = 0; long totalCount = 0; for (Map.Entry<String, Long> entry : serverManager.getDataSourceSizes().entrySet()) { String dataSource = entry.getKey(); long used = entry.getValue(); totalUsed += used; final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension("priority", String.valueOf(serverConfig.getPriority())); emitter.emit(builder.build("segment/used", used)); final double usedPercent = serverConfig.getMaxSize() == 0 ? 0 : used / (double) serverConfig.getMaxSize(); emitter.emit(builder.build("segment/usedPercent", usedPercent)); } for (Map.Entry<String, Long> entry : serverManager.getDataSourceCounts().entrySet()) { String dataSource = entry.getKey(); long count = entry.getValue(); totalCount += count; final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension( "priority", String.valueOf(serverConfig.getPriority()) ); emitter.emit(builder.build("segment/count", count)); } final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension("tier", serverConfig.getTier()) .setDimension( "priority", String.valueOf(serverConfig.getPriority()) ); emitter.emit(builder.build("segment/totalUsed", totalUsed)); final double totalUsedPercent = serverConfig.getMaxSize() == 0 ? 0 : totalUsed / (double) serverConfig.getMaxSize(); emitter.emit(builder.build("segment/totalUsedPercent", totalUsedPercent)); emitter.emit(builder.build("segment/totalCount", totalCount)); return true; }

Target:
public boolean doMonitor(ServiceEmitter emitter) { emitter.emit(new ServiceMetricEvent.Builder().build("segment/max", serverConfig.getMaxSize())); for (Map.Entry<String, Long> entry : serverManager.getDataSourceSizes().entrySet()) { String dataSource = entry.getKey(); long used = entry.getValue(); final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension("priority", String.valueOf(serverConfig.getPriority())); emitter.emit(builder.build("segment/used", used)); final double usedPercent = serverConfig.getMaxSize() == 0 ? 0 : used / (double) serverConfig.getMaxSize(); emitter.emit(builder.build("segment/usedPercent", usedPercent)); } for (Map.Entry<String, Long> entry : serverManager.getDataSourceCounts().entrySet()) { String dataSource = entry.getKey(); long count = entry.getValue(); final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource) .setDimension("tier", serverConfig.getTier()) .setDimension( "priority", String.valueOf(serverConfig.getPriority()) ); emitter.emit(builder.build("segment/count", count)); } return true; }
Source:
public boolean initialize() { if (libVLC == null) { return false; } if (mediaPlayer == null) { mediaPlayer = new MediaPlayer(libVLC); mediaPlayer.setEventListener(this); } return true; }

Target:
public void initialize() throws IllegalStateException { if (libVLC == null) { throw new IllegalStateException("Trying to initialise VlcPlayer but libVLC is null"); } if (mediaPlayer != null) { throw new IllegalStateException("MediaPlayer is already initialized"); } mediaPlayer = new MediaPlayer(libVLC); mediaPlayer.setEventListener(this); }
Source:
public void testCommandClassExistence() { CommandEnumTestUtils.testCommandsExist(ActionType.class, vat -> CommandsFactory.getCommandClass(vat.name())); }

Target:
public void testCommandClassExistence() { CommandEnumTestUtils.testCommandsExist(ActionType.class, at -> CommandsFactory.getCommandClass(at.name())); }
Source:
public List<WebElement> getFiltersSuggestions() { return seleniumWebDriverHelper.waitVisibilityOfAllElements(By.xpath(" }

Target:
public List<WebElement> getFiltersSuggestions() { String filtersSuggestionBody = " return seleniumWebDriverHelper.waitVisibilityOfAllElements(By.xpath(filtersSuggestionBody)); }
Source:
public ArrayList<int[]> splitGeometryAfter(int segment) { int[] original = geometries.get(pairIndex); ArrayList<int[]> geoms = new ArrayList<>(); geoms.add(Arrays.copyOfRange(original, 0, segment * 2)); geoms.add(Arrays.copyOfRange(original, segment * 2, original.length + 1)); return geoms; }

Target:
public P2<int[]> splitGeometryAfter(int segment) { int[] preSplit = EMPTY_INT_ARRAY; int[] postSplit = EMPTY_INT_ARRAY; int[] original = geometries.get(pairIndex); if (original.length > 0) { if (segment > 0) { preSplit = Arrays.copyOfRange(original, 0, segment * 2); } if (segment * 2 < original.length) { postSplit = Arrays.copyOfRange(original, segment * 2, original.length); } } return new P2<>(preSplit, postSplit); }
Source:
public Date getBarcodeDate() { return Stream.of(getReceivedDate(), getCreationDate(), getCreationDate()).filter(Objects::nonNull).findFirst().orElse(null); }

Target:
public Date getBarcodeDate() { return Stream.of(getReceivedDate(), getCreationDate(), getCreationTime()).filter(Objects::nonNull).findFirst().orElse(null); }
Source:
private Object extractAttributeValue(Data key, Object value) { if (components == null) { QueryEntry queryEntry = new QueryEntry(ss, key, value, extractors); return MapEntryAttributeExtractor.extractAttributeValue(queryEntry, name, queryFieldType); } else { Comparable[] valueComponents = new Comparable[components.length]; QueryEntry queryEntry = new QueryEntry(ss, key, value, extractors); for (int i = 0; i < components.length; ++i) { Object extractedValue = MapEntryAttributeExtractor.extractAttributeValue(queryEntry, components[i], QueryFieldType.fromName(components[i])); if (extractedValue instanceof MultiResult) { throw new IllegalStateException( "Collection/array attributes are not supported by composite indexes: " + components[i]); } else if (extractedValue == null || extractedValue instanceof Comparable) { valueComponents[i] = (Comparable) extractedValue; } else { throw new IllegalStateException("Unsupported non-comparable value type: " + extractedValue.getClass()); } } return new CompositeValue(valueComponents); } }

Target:
private Object extractAttributeValue(Data key, Object value) { if (components == null) { return extractAttributeValueByOrigin(extractors, key, value, name, attributeOrigin); } else { Comparable[] valueComponents = new Comparable[components.length]; for (int i = 0; i < components.length; ++i) { Object extractedValue = extractAttributeValueByOrigin(extractors, key, value, components[i], componentOrigins[i]); if (extractedValue instanceof MultiResult) { throw new IllegalStateException( "Collection/array attributes are not supported by composite indexes: " + components[i]); } else if (extractedValue == null || extractedValue instanceof Comparable) { valueComponents[i] = (Comparable) extractedValue; } else { throw new IllegalStateException("Unsupported non-comparable value type: " + extractedValue.getClass()); } } return new CompositeValue(valueComponents); } }
Source:
public Void call() throws Exception { Objects.requireNonNull(acls, "New acls to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(keyName) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().setAcl(obj, OzoneAcl.parseAcls(acls)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); return null; }

Target:
public Void call() throws Exception { Objects.requireNonNull(acls, "New acls to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(keyName) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().setAcl(obj, OzoneAcl.parseAcls(acls)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); client.close(); return null; }
Source:
public void setup() throws Exception { when(jsonRequest.usePostMethod()).thenReturn(jsonRequest); when(jsonRequest.useGetMethod()).thenReturn(jsonRequest); when(jsonRequest.useDeleteMethod()).thenReturn(jsonRequest); when(jsonRequest.addQueryParam(anyString(), anyString())).thenReturn(jsonRequest); when(jsonRequest.request()).thenReturn(jsonResponse); when(jsonRequest.setBody(any(GenerateSshPairRequest.class))).thenReturn(jsonRequest); when(requestFactory.fromUrl(anyString())).thenReturn(jsonRequest); client = new HttpSshServiceClient(API_URL, requestFactory); }

Target:
public void setup() throws Exception { jsonRequest = mock(HttpJsonRequest.class, new SelfReturningAnswer()); when(jsonRequest.request()).thenReturn(jsonResponse); when(requestFactory.fromUrl(anyString())).thenReturn(jsonRequest); client = new HttpSshServiceClient(API_URL, requestFactory); }
Source:
Cursor findCursor () { Cursor cursor = super.findCursor (); if (cursor == null && OS.VERSION < OS.VERSION(10, 14, 0)) { cursor = display.getSystemCursor (SWT.CURSOR_IBEAM); } return cursor; }

Target:
Cursor findCursor () { Cursor cursor = super.findCursor (); if (cursor == null && (style & SWT.READ_ONLY) == 0 && OS.VERSION < OS.VERSION(10, 14, 0)) { cursor = display.getSystemCursor (SWT.CURSOR_IBEAM); } return cursor; }
Source:
void bindInfrastructure() { bindCommonInfrastructure(WebAdminPlaceManager.class); bind(ApplicationInit.class).asEagerSingleton(); bind(InternalConfiguration.class).asEagerSingleton(); bind(PostMessageDispatcher.class).asEagerSingleton(); bind(CurrentUserRole.class).to(CommonCurrentUserRole.class).in(Singleton.class); }

Target:
void bindInfrastructure() { bindCommonInfrastructure(WebAdminPlaceManager.class); bind(InternalConfiguration.class).asEagerSingleton(); bind(PostMessageDispatcher.class).asEagerSingleton(); bindTypeAndImplAsSingleton(CurrentUserRole.class, CommonCurrentUserRole.class); }
Source:
public String toString() { String startAfter = mStartAfter == null ? "null" : mStartAfter.getId(); String endBefore = mEndBefore == null ? "null" : mEndBefore.getId(); return "PageKey{" + "StartAfter=" + startAfter + ", EndBefore=" + endBefore + '}'; }

Target:
public String toString() { String startAfter = mStartAfter == null ? null : mStartAfter.getId(); String endBefore = mEndBefore == null ? null : mEndBefore.getId(); return "PageKey{" + "StartAfter=" + startAfter + ", EndBefore=" + endBefore + '}'; }
Source:
public void testStateAdvancedChange_deployFails() throws InterruptedException { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void deploy( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }

Target:
public void testStateAdvancedChange_deployFails() { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void deploy( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }
Source:
public Response getVendor(@Context HttpHeaders headers) { try { List<String> vendorNumbers = getVendorNumbersFromRequest(); List<VendorDetail> vendors = SpringContext.getBean(CuCuEinvoiceDaoOjb.class).getVendors(vendorNumbers); List<Properties> vendorsSerialized = vendors.stream().map(vendor -> getVendorProperties(vendor)).collect(Collectors.toList()); return Response.ok(gson.toJson(vendorsSerialized)).build(); } catch (BadRequestException ex) { return respondGetVendorsBadRequest(); } catch (Exception ex) { LOG.error(ex); return respondInternalServerError(ex); } }

Target:
public Response getVendor(@Context HttpHeaders headers) { try { List<String> vendorNumbers = getVendorNumbersFromRequest(); List<VendorDetail> vendors = getCuEinvoiceDao().getVendors(vendorNumbers); List<Properties> vendorsSerialized = vendors.stream().map(vendor -> getVendorProperties(vendor)).collect(Collectors.toList()); return Response.ok(gson.toJson(vendorsSerialized)).build(); } catch (BadRequestException ex) { return respondGetVendorsBadRequest(); } catch (Exception ex) { LOG.error(ex); return respondInternalServerError(ex); } }
Source:
public void errorOccured(String error) { logger.error("Error occured: {}", error); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); }

Target:
public void errorOccured(String error) { logger.error("Error occured: {}", error); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, error); }
Source:
protected void ensureHashTableLoaded() { if (this.hashTables.get().isPresent()) { return; } synchronized (hashTables) { if (this.hashTables.get().isPresent()) { return; } int keyPositionCount = getRawKeyBlock().getPositionCount(); int[] hashTables = new int[keyPositionCount * HASH_MULTIPLIER]; Arrays.fill(hashTables, -1); verify(this.hashTables.getExpectedHashTableCount() <= offsets.length, "incorrect offsets size"); for (int i = 0; i < this.hashTables.getExpectedHashTableCount(); i++) { int keyOffset = offsets[i]; int keyCount = offsets[i + 1] - keyOffset; if (keyCount < 0) { throw new IllegalArgumentException(format("Offset is not monotonically ascending. offsets[%s]=%s, offsets[%s]=%s", i, offsets[i], i + 1, offsets[i + 1])); } if (mapIsNull != null && mapIsNull[i] && keyCount != 0) { throw new IllegalArgumentException("A null map must have zero entries"); } buildHashTable( getRawKeyBlock(), keyOffset, keyCount, keyBlockHashCode, hashTables, keyOffset * HASH_MULTIPLIER, keyCount * HASH_MULTIPLIER); } this.hashTables.set(hashTables); } }

Target:
protected void ensureHashTableLoaded() { if (this.hashTables.get().isPresent()) { return; } synchronized (hashTables) { if (this.hashTables.get().isPresent()) { return; } int[] hashTables = new int[getRawKeyBlock().getPositionCount() * HASH_MULTIPLIER]; Arrays.fill(hashTables, -1); verify(this.hashTables.getExpectedHashTableCount() <= offsets.length, "incorrect offsets size"); for (int i = 0; i < this.hashTables.getExpectedHashTableCount(); i++) { int keyOffset = offsets[i]; int keyCount = offsets[i + 1] - keyOffset; if (keyCount < 0) { throw new IllegalArgumentException(format("Offset is not monotonically ascending. offsets[%s]=%s, offsets[%s]=%s", i, offsets[i], i + 1, offsets[i + 1])); } if (mapIsNull != null && mapIsNull[i] && keyCount != 0) { throw new IllegalArgumentException("A null map must have zero entries"); } buildHashTable( getRawKeyBlock(), keyOffset, keyCount, keyBlockHashCode, hashTables, keyOffset * HASH_MULTIPLIER, keyCount * HASH_MULTIPLIER); } this.hashTables.set(hashTables); } }
Source:
private static void deleteQuotas(final Connection connection, final byte[] rowKey, final byte[] qualifier) throws IOException { Delete delete = new Delete(rowKey); if (qualifier != null) { if (Arrays.equals(qualifier,QUOTA_QUALIFIER_POLICY)) { delete.addColumns(QUOTA_FAMILY_USAGE, qualifier); } else delete.addColumns(QUOTA_FAMILY_INFO, qualifier); } if (isNamespaceRowKey(rowKey)) { NamespaceDescriptor[] descs = connection.getAdmin().listNamespaceDescriptors(); String ns = getNamespaceFromRowKey(rowKey); int index = 0; while (index < descs.length) { if (ns.equals(descs[index].getName())) { Quotas namespaceQuota = getNamespaceQuota(connection,ns); if (namespaceQuota != null && namespaceQuota.hasSpace()) { TableName[] tableArray = connection.getAdmin().listTableNamesByNamespace(ns); for (TableName tableName : tableArray) { deleteQuotas(connection, getTableRowKey(tableName), QUOTA_QUALIFIER_POLICY); } } index = descs.length; } else { index++; } } } doDelete(connection, delete); }

Target:
private static void deleteQuotas(final Connection connection, final byte[] rowKey, final byte[] qualifier) throws IOException { Delete delete = new Delete(rowKey); if (qualifier != null) { delete.addColumns(QUOTA_FAMILY_INFO, qualifier); } if (isNamespaceRowKey(rowKey)) { String ns = getNamespaceFromRowKey(rowKey); Quotas namespaceQuota = getNamespaceQuota(connection,ns); if (namespaceQuota != null && namespaceQuota.hasSpace()) { deleteTableUsageSnapshotsForNamespace(connection, ns); } } doDelete(connection, delete); }
Source:
public void wikipediaSexClassificationDataset() { Map<Integer, double[]> data = new HashMap<>(); double male = 0.; double female = 1.; data.put(0, new double[] {male, 6, 180, 12}); data.put(2, new double[] {male, 5.92, 190, 11}); data.put(3, new double[] {male, 5.58, 170, 12}); data.put(4, new double[] {male, 5.92, 165, 10}); data.put(5, new double[] {female, 5, 100, 6}); data.put(6, new double[] {female, 5.5, 150, 8}); data.put(7, new double[] {female, 5.42, 130, 7}); data.put(8, new double[] {female, 5.75, 150, 9}); GaussianNaiveBayesTrainer trainer = new GaussianNaiveBayesTrainer(); GaussianNaiveBayesModel model = trainer.fit( new LocalDatasetBuilder<>(data, 2), (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)), (k, v) -> v[0] ); Vector observation = new DenseVector(new double[] {6, 130, 8}); Assert.assertEquals(female, model.apply(observation), PRECISION); }

Target:
public void wikipediaSexClassificationDataset() { Map<Integer, double[]> data = new HashMap<>(); double male = 0.; double female = 1.; data.put(0, new double[] {male, 6, 180, 12}); data.put(2, new double[] {male, 5.92, 190, 11}); data.put(3, new double[] {male, 5.58, 170, 12}); data.put(4, new double[] {male, 5.92, 165, 10}); data.put(5, new double[] {female, 5, 100, 6}); data.put(6, new double[] {female, 5.5, 150, 8}); data.put(7, new double[] {female, 5.42, 130, 7}); data.put(8, new double[] {female, 5.75, 150, 9}); GaussianNaiveBayesTrainer trainer = new GaussianNaiveBayesTrainer(); GaussianNaiveBayesModel model = trainer.fit( new LocalDatasetBuilder<>(data, 2), (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)), (k, v) -> v[0] ); Vector observation = VectorUtils.of(6, 130, 8); Assert.assertEquals(female, model.apply(observation), PRECISION); }
Source:
private void syncBreedingTrackers(EntityPlayer player) { IAlleleRegistry alleleRegistry = AlleleManager.alleleRegistry; Collection<ISpeciesRoot> speciesRoots = alleleRegistry.getSpeciesRoot().values(); for (ISpeciesRoot speciesRoot : speciesRoots) { IBreedingTracker breedingTracker = speciesRoot.getBreedingTracker(player.getEntityWorld(), player.getGameProfile()); breedingTracker.synchToPlayer(player); } }

Target:
private static void syncBreedingTrackers(EntityPlayer player) { IAlleleRegistry alleleRegistry = AlleleManager.alleleRegistry; Collection<ISpeciesRoot> speciesRoots = alleleRegistry.getSpeciesRoot().values(); for (ISpeciesRoot speciesRoot : speciesRoots) { IBreedingTracker breedingTracker = speciesRoot.getBreedingTracker(player.getEntityWorld(), player.getGameProfile()); breedingTracker.synchToPlayer(player); } }
Source:
protected boolean isFinished() { log.debug("isFinished called; State is " + (execThread == null ? "[uninitialized]" : execThread.getState().toString())); return execThread != null && execThread.getState() == State.TERMINATED; }

Target:
public boolean isFinished() { log.debug("isFinished called; Thread state is " + (execThread == null ? "[uninitialized]" : execThread.getState().toString())); boolean isFinished = execThread != null && execThread.getState() == State.TERMINATED; log.debug("isFinished is " + isFinished); return isFinished; }
Source:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); this.documentAccessBridge = this.mocker.getInstance(DocumentAccessBridge.class); DocumentReference patientDocument = new DocumentReference("wiki", "patient", "00000001"); doReturn(patientDocument).when(this.patient).getDocument(); doReturn(this.doc).when(this.documentAccessBridge).getDocument(patientDocument); doReturn("first").when(this.firstOntologyVersion).getStringValue("name"); doReturn("1.0").when(this.firstOntologyVersion).getStringValue("version"); doReturn("second").when(this.secondOntologyVersion).getStringValue("name"); doReturn("2.0").when(this.secondOntologyVersion).getStringValue("version"); List<BaseObject> ontologyVersionList = Arrays.asList(firstOntologyVersion, secondOntologyVersion); doReturn(ontologyVersionList).when(this.doc).getXObjects(ONTOLOGY_VERSION_CLASS_REFERENCE); PowerMockito.mockStatic(ComponentManagerRegistry.class); PowerMockito.when(ComponentManagerRegistry.getContextComponentManager()) .thenReturn(this.contextComponentManager); doReturn(this.distributionManager).when(this.contextComponentManager).getInstance(DistributionManager.class); CoreExtension coreExtension = Mockito.mock(CoreExtension.class); doReturn(coreExtension).when(this.distributionManager).getDistributionExtension(); ExtensionId id = Mockito.mock(ExtensionId.class); doReturn(id).when(coreExtension).getId(); Version version = Mockito.mock(Version.class); doReturn(version).when(id).getVersion(); when(version.toString()).thenReturn(PHENOTIPS_VERSION_STRING); }

Target:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); this.documentAccessBridge = this.mocker.getInstance(DocumentAccessBridge.class); DocumentReference patientDocument = new DocumentReference("wiki", "patient", "00000001"); doReturn(patientDocument).when(this.patient).getDocument(); doReturn(this.doc).when(this.documentAccessBridge).getDocument(patientDocument); doReturn("first").when(this.firstOntologyVersion).getStringValue("name"); doReturn("1.0").when(this.firstOntologyVersion).getStringValue("version"); doReturn("second").when(this.secondOntologyVersion).getStringValue("name"); doReturn("2.0").when(this.secondOntologyVersion).getStringValue("version"); List<BaseObject> ontologyVersionList = Arrays.asList(firstOntologyVersion, secondOntologyVersion); doReturn(ontologyVersionList).when(this.doc).getXObjects(ONTOLOGY_VERSION_CLASS_REFERENCE); ReflectionUtils.setFieldValue(new ComponentManagerRegistry(), "cmProvider", this.cmProvider); doReturn(this.contextComponentManager).when(this.cmProvider).get(); doReturn(this.distributionManager).when(this.contextComponentManager).getInstance(DistributionManager.class); CoreExtension coreExtension = Mockito.mock(CoreExtension.class); doReturn(coreExtension).when(this.distributionManager).getDistributionExtension(); ExtensionId id = Mockito.mock(ExtensionId.class); doReturn(id).when(coreExtension).getId(); Version version = Mockito.mock(Version.class); doReturn(version).when(id).getVersion(); when(version.toString()).thenReturn(PHENOTIPS_VERSION_STRING); }
Source:
public S batchSize(int batchSize) { attributes.attribute(BATCH_SIZE).set(batchSize); return self(); }

Target:
public S batchSize(int batchSize) { this.batchSize = batchSize; maxBatchSize(batchSize); return self(); }
Source:
public static String getExtensionLocation(String extensionName, JSONObject extensionDetailJson) { String extensionType; try { extensionType = extensionDetailJson.get(LOCATION).toString(); } catch (JSONException e) { OUT.get().print("Error. " + extensionName + " not found "); throw new FalconCLIException("Failed to get extension type for the given extension"); } return extensionType; }

Target:
public static String getExtensionLocation(String extensionName, JSONObject extensionDetailJson) { String extensionBuildPath; try { extensionBuildPath = extensionDetailJson.get(LOCATION).toString(); } catch (JSONException e) { OUT.get().print("Error. " + extensionName + " not found "); throw new FalconCLIException("Failed to get extension type for the given extension"); } return extensionBuildPath; }
Source:
public void define(final Service service) { service.get(DOMAIN_MAPPINGS, this::get, jsonTransformer); service.put(SPECIFIC_MAPPING, this::addDomainMapping); service.delete(SPECIFIC_MAPPING, this::removeDomainMapping); }

Target:
public void define(final Service service) { service.get(DOMAIN_MAPPINGS, this::getAllMappings, jsonTransformer); service.get(SPECIFIC_MAPPING, this::getMapping, jsonTransformer); service.put(SPECIFIC_MAPPING, this::addDomainMapping); service.delete(SPECIFIC_MAPPING, this::removeDomainMapping); }
Source:
public String toString() { String s; String c = ""; for (AST child : children) if (child != null) c = c + child.toString(); s = "[" + type.toString() + ": " + c + "]"; return s; }

Target:
public String toString() { StringBuilder s = new StringBuilder(); s.append("[" + type.toString() + ": "); for (AST child : children) if (child != null) s.append(child.toString()); s.append("]"); return s.toString(); }
Source:
public byte[] sign(byte[] contentBytes) throws SignatureGenerationException { try { if (privateKey == null) { throw new IllegalArgumentException("The given Private Key is null."); } return crypto.createSignatureFor(getDescription(), privateKey, contentBytes); } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalArgumentException e) { throw new SignatureGenerationException(this, e); } }

Target:
public byte[] sign(byte[] contentBytes) throws SignatureGenerationException { try { if (privateKey == null) { throw new IllegalStateException("The given Private Key is null."); } return crypto.createSignatureFor(getDescription(), privateKey, contentBytes); } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) { throw new SignatureGenerationException(this, e); } }
Source:
public void deallocateIfExternal() { if (getNetwork() != null && getNetwork().isExternal()) { Provider<?> provider = getProviderDao().get(getNetwork().getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); try { providerProxy.deallocate(nic); } catch (EngineException e) { AuditLogableBase removePortFailureEvent = new AuditLogableBase(); removePortFailureEvent.addCustomValue("NicName", nic.getName()); removePortFailureEvent.addCustomValue("NicId", nic.getId().toString()); removePortFailureEvent.addCustomValue("ProviderName", provider.getName()); getAuditLogDirector().log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED); } } }

Target:
public void deallocateIfExternal() { if (getNetwork() != null && getNetwork().isExternal()) { Provider<?> provider = getProviderDao().get(getNetwork().getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = getProviderProxyFactory().create(provider); try { providerProxy.deallocate(nic); } catch (EngineException e) { AuditLogableBase removePortFailureEvent = new AuditLogableBase(); removePortFailureEvent.addCustomValue("NicName", nic.getName()); removePortFailureEvent.addCustomValue("NicId", nic.getId().toString()); removePortFailureEvent.addCustomValue("ProviderName", provider.getName()); getAuditLogDirector().log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED); } } }
Source:
public void should_execute_on_python_project() { Project project = mock(Project.class); assertThat(sensor.toString()).isEqualTo("PythonSquidSensor"); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); fs.add(new DefaultInputFile(TestUtils.MODULE, "test.py").setLanguage(Python.KEY)); assertThat(sensor.shouldExecuteOnProject(project)).isTrue(); }

Target:
public void should_execute_on_python_project() { Project project = mock(Project.class); assertThat(sensor.toString()).isEqualTo("PythonSquidSensor"); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); fs.add(new DefaultInputFile("", "test.py").setLanguage(Python.KEY)); assertThat(sensor.shouldExecuteOnProject(project)).isTrue(); }
Source:
Worker createWorker() { return Worker.create(pathToVerifier); }

Target:
protected Worker createWorker() { return Worker.create(pathToVerifier); }