auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Override public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { final Map map = (Map) operand; final ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); try { final String coordinatesString = (String) map.get("coordinates"); Preconditions.checkState(coordinatesString != null, "'coordinates' is missing in configuration"); final Map<String, Integer> coordinates = mapper.readValue(coordinatesString, new TypeReference<Map<String, Integer>>() { }); final String scheme = (String) map.get("scheme"); final RestClient client = connect(coordinates, scheme); final String index = (String) map.get("index"); return new ElasticsearchSchema(client, new ObjectMapper(), index); } catch (IOException e) { throw new RuntimeException("Cannot parse values from json", e); } }

Target:
@Override public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { final Map map = (Map) operand; final ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); try { List<HttpHost> hosts; if (map.containsKey("hosts")) { final List<String> configHosts = mapper.readValue((String) map.get("hosts"), new TypeReference<List<String>>() { }); hosts = configHosts .stream() .map(host -> HttpHost.create(host)) .collect(Collectors.toList()); } else if (map.containsKey("coordinates")) { final Map<String, Integer> coordinates = mapper.readValue((String) map.get("coordinates"), new TypeReference<Map<String, Integer>>() { }); hosts = coordinates .entrySet() .stream() .map(entry -> new HttpHost(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); LOGGER.warn("Prefer using hosts, coordinates is deprecated."); } else { throw new IllegalArgumentException ("Both 'coordinates' and 'hosts' is missing in configuration. Provide one of them."); } final RestClient client = connect(hosts); final String index = (String) map.get("index"); return new ElasticsearchSchema(client, new ObjectMapper(), index); } catch (IOException e) { throw new RuntimeException("Cannot parse values from json", e); } }
Source:
public void testSanitizeForSaving() { AdminEmailAttributes actualAdminEmail = adminEmailAttributes; AdminEmailAttributes expectedAdminEmail = adminEmailAttributes; actualAdminEmail.sanitizeForSaving(); assertEquals(SanitizationHelper.sanitizeTextField(expectedAdminEmail.subject), actualAdminEmail.subject); assertEquals(SanitizationHelper.sanitizeForRichText(expectedAdminEmail.content), actualAdminEmail.content); }

Target:
public void testSanitizeForSaving() { String subjectWithWhitespaces = " subject to be sanitized by removing leading/trailing whitespace "; Text contentWithWhitespaces = new Text(" content to be sanitized by removing leading/trailing whitespace "); ______TS("valid sanitation of admin email"); AdminEmailAttributes adminEmailAttributes = new AdminEmailAttributes( subjectWithWhitespaces, addressReceiverListString, groupReceiverListFileKey, contentWithWhitespaces, date); ______TS("success: sanitized whitespace"); adminEmailAttributes.sanitizeForSaving(); assertEquals("subject to be sanitized by removing leading/trailing whitespace", adminEmailAttributes.getSubject()); assertEquals("content to be sanitized by removing leading/trailing whitespace", adminEmailAttributes.getContentValue()); ______TS("success: sanitized code block"); adminEmailAttributes.content = new Text("<code>System.out.println(\"Hello World\");</code>"); adminEmailAttributes.sanitizeForSaving(); assertEquals("<code>System.out.println(&#34;Hello World&#34;);</code>", adminEmailAttributes.getContentValue()); ______TS("success: sanitized superscript"); adminEmailAttributes.content = new Text("f(x) = x<sup>2</sup>"); adminEmailAttributes.sanitizeForSaving(); assertEquals("f(x) &#61; x<sup>2</sup>", adminEmailAttributes.getContentValue()); ______TS("success: sanitized chemical formula"); adminEmailAttributes.content = new Text("<p>Chemical formula: C<sub>6</sub>H<sub>12</sub>O<sub>6</sub></p>"); adminEmailAttributes.sanitizeForSaving(); assertEquals("<p>Chemical formula: C<sub>6</sub>H<sub>12</sub>O<sub>6</sub></p>", adminEmailAttributes.getContentValue()); ______TS("success: sanitized invalid closing tag"); adminEmailAttributes.content = new Text("</td></option></div> invalid closing tags"); adminEmailAttributes.sanitizeForSaving(); assertEquals(" invalid closing tags", adminEmailAttributes.getContentValue()); }
Source:
private Result checkFileInSourceFolders(VirtualFile file, Module module) { ProjectFileIndex fileIndex = projectRootManager.getFileIndex(); if (fileIndex.isExcluded(file)) { return Result.excluded("file is excluded or ignored in IntelliJ's project structure"); } if (SonarLintUtils.isGeneratedSoruce(module, fileIndex.getSourceRootForFile(file))) { return Result.excluded("file is generated in IntelliJ's project structure"); } if (fileIndex.isInSourceContent(file)) { return Result.notExcluded(); } return Result.excluded("file does not belong to sources in IntelliJ's project structure"); }

Target:
private Result checkFileInSourceFolders(VirtualFile file, Module module) { ProjectFileIndex fileIndex = projectRootManager.getFileIndex(); if (fileIndex.isExcluded(file)) { return Result.excluded("file is excluded or ignored in IntelliJ's project structure"); } SourceFolder sourceFolder = SonarLintUtils.getSourceFolder(fileIndex.getSourceRootForFile(file), module); if (sourceFolder != null) { if (SonarLintUtils.isGeneratedSource(sourceFolder)) { return Result.excluded("file is classified as generated in IntelliJ's project structure"); } if (SonarLintUtils.isJavaResource(sourceFolder)) { return Result.excluded("file is classified as resource in IntelliJ's project structure"); } } return Result.notExcluded(); }
Source:
public void testRequestUsesElseForward() throws Exception { PipeForward forw = new PipeForward("custom_else", "random/path"); pipe.registerForward(forw); pipe.setElseForwardName("custom_else"); assertEquals(pipe.doPipe(request, session).getPipeForward().getName().toString(), "custom_else"); }

Target:
public void testRequestUsesElseForward() throws Exception { PipeForward forw = new PipeForward("custom_else", "random/path"); pipe.registerForward(forw); pipe.setElseForwardName("custom_else"); PipeRunResult res = doPipe(pipe, request, session); PipeForward forward = res.getPipeForward(); assertEquals(forward.getName(), "custom_else"); }
Source:
private StoredObject generateNewFile(VersionedFile file, String uniqueIdentifier, String code) { String fullPath = uniqueIdentifier + file.getTimestamp(); if (storage.findByPath(file.getTenant().fetchValue(), VERSIONED_FILES, fullPath).isPresent()) { throw Exceptions.createHandled() .withNLSKey("VersionedFiles.versionExistsConflict") .set("date", NLS.toUserString(file.getTimestamp())) .set("path", uniqueIdentifier) .handle(); } StoredObject object = storage.createTemporaryObject(file.getTenant().fetchValue(), VERSIONED_FILES, file.getStoredFile().getReference(), fullPath); try (OutputStream out = storage.updateFile(object)) { out.write(code.getBytes()); } catch (IOException e) { throw Exceptions.handle(Storage.LOG, e); } return object; }

Target:
private StoredObject generateNewFile(VersionedFile file, String uniqueIdentifier, String code) { String fullPath = uniqueIdentifier + file.getTimestamp(); if (storage.findByPath(tenants.fetchCachedRequiredTenant(file.getTenant()), VERSIONED_FILES, fullPath) .isPresent()) { throw Exceptions.createHandled() .withNLSKey("VersionedFiles.versionExistsConflict") .set("date", NLS.toUserString(file.getTimestamp())) .set("path", uniqueIdentifier) .handle(); } StoredObject object = storage.createTemporaryObject(tenants.fetchCachedRequiredTenant(file.getTenant()), VERSIONED_FILES, file.getStoredFile().getReference(), fullPath); try (OutputStream out = storage.updateFile(object)) { out.write(code.getBytes()); } catch (IOException e) { throw Exceptions.handle(Storage.LOG, e); } return object; }
Source:
private void createLayout() { setLayout(new GridLayout(1, false)); searchControl = new SearchControl(this, model, model); searchControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); searchControl.setSearcher(model); lblTableTitle = new Label(this, SWT.NONE); lblTableTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); tableViewer = new TableViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); tableViewer.setComparator(comparator); tableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); jmsStatusLabel = new Label(this, SWT.BORDER); jmsStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); setConnectionStatus(model.getConnectionStatus()); createTableColumns(tableViewer); createContextMenu(tableViewer); addDoubleClickListener(tableViewer); final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { clearSelectedMessages(); } } }); table.addMenuDetectListener(new MenuDetectListener() { @Override public void menuDetected(MenuDetectEvent e) { updateContextMenu(); } }); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); setData(new LogMessage[0]); }

Target:
private void createLayout() { setLayout(new GridLayout(1, false)); searchControl = new SearchControl(this, model); searchControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); searchControl.setSearcher(model); lblTableTitle = new Label(this, SWT.NONE); lblTableTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); tableViewer = new TableViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); tableViewer.setComparator(comparator); tableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); jmsStatusLabel = new Label(this, SWT.BORDER); jmsStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); setConnectionStatus(model.getConnectionStatus()); createTableColumns(tableViewer); createContextMenu(tableViewer); addDoubleClickListener(tableViewer); final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { clearSelectedMessages(); } } }); table.addMenuDetectListener(new MenuDetectListener() { @Override public void menuDetected(MenuDetectEvent e) { updateContextMenu(); } }); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); setData(new LogMessage[0]); }
Source:
public void testEncodePrettily() throws Exception { jsonObject.put("mystr", "foo"); jsonObject.put("myint", 123); jsonObject.put("mylong", 1234l); jsonObject.put("myfloat", 1.23f); jsonObject.put("mydouble", 2.34d); jsonObject.put("myboolean", true); byte[] bytes = TestUtils.randomByteArray(10); jsonObject.put("mybinary", bytes); jsonObject.put("myobj", new JsonObject().put("foo", "bar")); jsonObject.put("myarr", new JsonArray().add("foo").add(123)); String strBytes = Base64.getEncoder().encodeToString(bytes); String expected = "{" + System.getProperty("line.separator") + " \"mystr\" : \"foo\"," + System.getProperty("line.separator") + " \"myint\" : 123," + System.getProperty("line.separator") + " \"mylong\" : 1234," + System.getProperty("line.separator") + " \"myfloat\" : 1.23," + System.getProperty("line.separator") + " \"mydouble\" : 2.34," + System.getProperty("line.separator") + " \"myboolean\" : true," + System.getProperty("line.separator") + " \"mybinary\" : \"" + strBytes + "\"," + System.getProperty("line.separator") + " \"myobj\" : {" + System.getProperty("line.separator") + " \"foo\" : \"bar\"" + System.getProperty("line.separator") + " }," + System.getProperty("line.separator") + " \"myarr\" : [ \"foo\", 123 ]" + System.getProperty("line.separator") + "}"; String json = jsonObject.encodePrettily(); assertEquals(expected, json); }

Target:
public void testEncodePrettily() throws Exception { jsonObject.put("mystr", "foo"); jsonObject.put("myint", 123); jsonObject.put("mylong", 1234l); jsonObject.put("myfloat", 1.23f); jsonObject.put("mydouble", 2.34d); jsonObject.put("myboolean", true); byte[] bytes = TestUtils.randomByteArray(10); jsonObject.put("mybinary", bytes); jsonObject.put("myobj", new JsonObject().put("foo", "bar")); jsonObject.put("myarr", new JsonArray().add("foo").add(123)); String strBytes = Base64.getEncoder().encodeToString(bytes); String expected = "{" + Utils.LINE_SEPARATOR + " \"mystr\" : \"foo\"," + Utils.LINE_SEPARATOR + " \"myint\" : 123," + Utils.LINE_SEPARATOR + " \"mylong\" : 1234," + Utils.LINE_SEPARATOR + " \"myfloat\" : 1.23," + Utils.LINE_SEPARATOR + " \"mydouble\" : 2.34," + Utils.LINE_SEPARATOR + " \"myboolean\" : true," + Utils.LINE_SEPARATOR + " \"mybinary\" : \"" + strBytes + "\"," + Utils.LINE_SEPARATOR + " \"myobj\" : {" + Utils.LINE_SEPARATOR + " \"foo\" : \"bar\"" + Utils.LINE_SEPARATOR + " }," + Utils.LINE_SEPARATOR + " \"myarr\" : [ \"foo\", 123 ]" + Utils.LINE_SEPARATOR + "}"; String json = jsonObject.encodePrettily(); assertEquals(expected, json); }
Source:
public AssetUri getPrefabURI() { if (exists()) { EntityInfoComponent info = getComponent(EntityInfoComponent.class); if (info != null && !info.parentPrefab.exists()) { return new AssetUri(AssetType.PREFAB, info.parentPrefab.getName()); } } return null; }

Target:
public AssetUri getPrefabURI() { if (exists()) { EntityInfoComponent info = getComponent(EntityInfoComponent.class); if (info != null && info.parentPrefab.exists()) { return new AssetUri(AssetType.PREFAB, info.parentPrefab.getName()); } } return null; }
Source:
public void close() throws Exception { this.isFinished = true; }

Target:
public void close() { this.isFinished = true; }
Source:
public DefaultInternalRunner(Class<?> testClass, final Supplier<MockitoTestListener> listenerSupplier) throws InitializationError { runner = new BlockJUnit4ClassRunner(testClass) { private Object target; private MockitoTestListener mockitoTestListener; protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { this.target = target; mockitoTestListener = listenerSupplier.get(); Mockito.framework().addListener(mockitoTestListener); MockitoAnnotations.initMocks(target); return super.withBefores(method, target, statement); } public void run(final RunNotifier notifier) { final RunListener listener = new RunListener() { Throwable failure; boolean started; public void testStarted(Description description) throws Exception { started = true; } public void testFailure(Failure failure) throws Exception { this.failure = failure.getException(); if (!started && mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); } } public void testFinished(Description description) throws Exception { try { if (mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); mockitoTestListener.testFinished(new DefaultTestFinishedEvent(target, description.getMethodName(), failure)); } Mockito.validateMockitoUsage(); } catch (Throwable t) { notifier.fireTestFailure(new Failure(description, t)); } } }; notifier.addListener(listener); super.run(notifier); } }; }

Target:
public DefaultInternalRunner(Class<?> testClass, final Supplier<MockitoTestListener> listenerSupplier) throws InitializationError { runner = new BlockJUnit4ClassRunner(testClass) { public Object target; private MockitoTestListener mockitoTestListener; protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { this.target = target; mockitoTestListener = listenerSupplier.get(); Mockito.framework().addListener(mockitoTestListener); MockitoAnnotations.initMocks(target); return super.withBefores(method, target, statement); } public void run(final RunNotifier notifier) { RunListener listener = new RunListener() { private boolean started; Throwable failure; @Override public void testStarted(Description description) throws Exception { started = true; } @Override public void testFailure(Failure failure) throws Exception { this.failure = failure.getException(); if (!started && mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); } } @Override public void testFinished(Description description) throws Exception { try { if (mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); mockitoTestListener.testFinished(new DefaultTestFinishedEvent(target, description.getMethodName(), failure)); } Mockito.validateMockitoUsage(); } catch (Throwable t) { notifier.fireTestFailure(new Failure(description, t)); } } }; notifier.addListener(listener); super.run(notifier); } }; }
Source:
private InetSocketAddress getNativeAddressFromPeers(AdminRow row) { InetAddress nativeAddress = row.getInetAddress("native_address"); if (nativeAddress == null) { nativeAddress = row.getInetAddress("rpc_address"); } if (nativeAddress == null) { return null; } Integer row_port = row.getInteger("native_port"); if (row_port == null) { row_port = port; } return addressTranslator.translate(new InetSocketAddress(nativeAddress, row_port)); }

Target:
private InetSocketAddress getNativeAddressFromPeers(AdminRow row) { InetAddress nativeAddress = row.getInetAddress("native_address"); if (nativeAddress == null) { nativeAddress = row.getInetAddress("rpc_address"); } if (nativeAddress == null) { return null; } Integer rowPort = row.getInteger("native_port"); if (rowPort == null || rowPort == 0) { rowPort = port; } return addressTranslator.translate(new InetSocketAddress(nativeAddress, rowPort)); }
Source:
public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) { this.tokenRefreshOffset = tokenRefreshOffset; return this; }

Target:
public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) { if (tokenRefreshOffset != null) { this.tokenRefreshOffset = tokenRefreshOffset; } return this; }
Source:
protected void handleError(final Exception e, final DeviceMessageMetadata deviceMessageMetadata) { LOGGER.info("handeling error: for message type: {}", e.getMessage(), deviceMessageMetadata.getMessageType()); final OsgpException osgpException = this.ensureOsgpException(e); this.webServiceResponseMessageSender.send( ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()) .withResult(ResponseMessageResultType.NOT_OK).withOsgpException(osgpException) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
protected void handleError(final Exception e, final DeviceMessageMetadata deviceMessageMetadata) { LOGGER.info("handeling error: for message type: {}", e.getMessage(), deviceMessageMetadata.getMessageType()); final OsgpException osgpException = this.ensureOsgpException(e); final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()) .withResult(ResponseMessageResultType.NOT_OK).withOsgpException(osgpException) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
private String getDefaultFilePath() { String defaultFilePath = null; FormController formController = Collect.getInstance().getFormController(); if (formController != null) { if (binaryName.startsWith("jr://images/")) { try { defaultFilePath = referenceManager.deriveReference(binaryName).getLocalURI(); } catch (InvalidReferenceException e) { Timber.w(e); } } else { defaultFilePath = formController.getMediaFolder() + File.separator + binaryName; } } return defaultFilePath; }

Target:
String getDefaultFilePath() { try { return referenceManager.deriveReference(binaryName).getLocalURI(); } catch (InvalidReferenceException e) { Timber.w(e); } return ""; }
Source:
private FedoraResource getResourceOrParentFromPath(final FedoraId fedoraId) { FedoraResource resource = null; log.debug("Attempting to get FedoraResource for {}", fedoraId.getFullIdPath()); try { resource = resource(fedoraId); log.debug("Got FedoraResource for {}", fedoraId.getFullIdPath()); } catch (final PathNotFoundException e) { log.debug("Path does not exist", fedoraId.getFullIdPath()); if (fedoraId.getFullId().length() > 1) { final int lastSlash = fedoraId.getFullId().lastIndexOf("/"); final int end = lastSlash > 0 ? lastSlash : lastSlash + 1; resource = getResourceOrParentFromPath(FedoraId.create(fedoraId.getFullId().substring(0, end))); } } return resource; }

Target:
private FedoraResource getResourceOrParentFromPath(final FedoraId fedoraId) { try { log.debug("Testing FedoraResource for {}", fedoraId.getFullIdPath()); return this.resourceFactory.getResource(transaction(), fedoraId); } catch (final PathNotFoundException exc) { log.debug("Resource not found getting container", fedoraId.getFullIdPath()); final String txID = transaction() == null ? null : transaction().getId(); final FedoraId containerId = containmentIndex.getContainerIdByPath(txID, fedoraId); log.debug("Attempting to get FedoraResource for {}", fedoraId.getFullIdPath()); try { log.debug("Got FedoraResource for {}", containerId.getFullIdPath()); return this.resourceFactory.getResource(transaction(), containerId); } catch (final PathNotFoundException exc2) { log.debug("Path does not exist, but we should never end up here.", containerId.getFullIdPath()); return null; } } }
Source:
public String getEndpointHost() { if(endpointHost.startsWith("https://")){ return endpointHost.substring(8); } return endpointHost; }

Target:
public String getEndpointHost() { if(endpointHost.startsWith("https://")){ return endpointHost.substring("https://".length()); } return endpointHost; }
Source:
public MetastoreHiveStatisticsProvider(TypeManager typeManager, SemiTransactionalHiveMetastore metastore, DateTimeZone timeZone) { this.typeManager = requireNonNull(typeManager, "typeManager is null"); this.metastore = requireNonNull(metastore, "metastore is null"); this.timeZone = timeZone; }

Target:
public MetastoreHiveStatisticsProvider(TypeManager typeManager, SemiTransactionalHiveMetastore metastore, DateTimeZone timeZone) { this.typeManager = requireNonNull(typeManager, "typeManager is null"); this.metastore = requireNonNull(metastore, "metastore is null"); this.timeZone = requireNonNull(timeZone, "timeZone is null"); }
Source:
public static ByteBuf writeArgs(ByteBufAllocator allocator, ByteBuf header, List<ByteBuf> args) { int writableBytes = TFrame.MAX_FRAME_PAYLOAD_LENGTH - header.readableBytes(); List<ByteBuf> bufs = new ArrayList<>(7); bufs.add(header); while (!args.isEmpty()) { ByteBuf arg = args.get(0); int len = writeArg(allocator, arg, writableBytes, bufs); writableBytes -= len; if (writableBytes <= 2) { break; } if (arg.readableBytes() == 0) { args.remove(0); } } CompositeByteBuf comp = allocator.compositeBuffer(); comp.addComponents(bufs); comp.writerIndex(TFrame.MAX_FRAME_PAYLOAD_LENGTH - writableBytes); return comp; }

Target:
public static ByteBuf writeArgs(ByteBufAllocator allocator, ByteBuf header, List<ByteBuf> args) { int writableBytes = TFrame.MAX_FRAME_PAYLOAD_LENGTH - header.readableBytes(); List<ByteBuf> bufs = new ArrayList<>(7); bufs.add(header); while (!args.isEmpty()) { ByteBuf arg = args.get(0); int len = writeArg(allocator, arg, writableBytes, bufs); writableBytes -= len; if (writableBytes <= TFrame.FRAME_SIZE_LENGTH) { break; } if (arg.readableBytes() == 0) { args.remove(0); } } CompositeByteBuf comp = allocator.compositeBuffer(); comp.addComponents(bufs); comp.writerIndex(TFrame.MAX_FRAME_PAYLOAD_LENGTH - writableBytes); return comp; }
Source:
public Collection<FederatedSource> getFederatedSources() { List<FederatedSource> sources = new ArrayList<>(federatedSources); sources.addAll(oauthFederatedSources); return sources; }

Target:
public Collection<FederatedSource> getFederatedSources() { return federatedSources; }
Source:
public void basicSimpleTest() { final Message message = new SimpleMessage("Test Message"); final StringMap contextData = ContextDataFactory.createContextData(); contextData.putValue("service", "log4j2"); final LogEvent event = Log4jLogEvent.newBuilder().setLoggerName(LOGGER.getName()).setLevel(Level.DEBUG) .setContextData(contextData).setIncludeLocation(true) .setLoggerFqcn("org.talend.logging.event.Log4j2JSONLayoutTest").setMessage(message).build(); AbstractStringLayout layout = Log4j2JSONLayout.createLayout(true, true, true, true, false, Charset.defaultCharset(), null); LOGGER.debug("I shouldn't have MDC data in my log"); String actualJSON = layout.toSerializable(event); System.out.println(actualJSON); assertThat(actualJSON, sameJSONAs(EXPECTED_BASIC_SIMPLE_JSON_TEST).allowingExtraUnexpectedFields().allowingAnyArrayOrdering()); }

Target:
public void basicSimpleTest() { final Message message = new SimpleMessage("Test Message"); final StringMap contextData = ContextDataFactory.createContextData(); contextData.putValue("service", "log4j2"); final LogEvent event = Log4jLogEvent.newBuilder().setLoggerName(LOGGER.getName()).setLevel(Level.DEBUG) .setContextData(contextData).setIncludeLocation(true) .setLoggerFqcn("org.talend.logging.event.Log4j2JSONLayoutTest").setMessage(message).build(); AbstractStringLayout layout = Log4j2JSONLayout.createLayout(true, true, true, true, false, Charset.defaultCharset(), null); LOGGER.debug("I shouldn't have MDC data in my log"); String actualJSON = layout.toSerializable(event); assertThat(actualJSON, sameJSONAs(EXPECTED_BASIC_SIMPLE_JSON_TEST).allowingExtraUnexpectedFields().allowingAnyArrayOrdering()); }
Source:
public void getExpandedItems_tryToAddItemsToCollection_shouldThrowException() { exceptionRule.expect(UnsupportedOperationException.class); TreeNode root = new TreeNode("root", null); TreeNode first1 = new TreeNode("first-1", root); TreeNode second1 = new TreeNode("second-2", root); TreeNode first11 = new TreeNode("first-1-1", first1); TreeNode second11 = new TreeNode("second-1-1", second1); HierarchicalDataProvider<TreeNode, Void> dataProvider = new AbstractBackEndHierarchicalDataProvider<TreeNode, Void>() { @Override public int getChildCount(HierarchicalQuery<TreeNode, Void> query) { if (query.getParent() == null) { return 2; } if (query.getParent().getName().equals("first-1") || query.getParent().getName().equals("second-1")) { return 1; } return 0; } @Override public boolean hasChildren(TreeNode item) { return item.getParent() == null || item.getParent().getName().equals("first-1") || item.getParent().getName().equals("second-1"); } @Override protected Stream<TreeNode> fetchChildrenFromBackEnd( HierarchicalQuery<TreeNode, Void> query) { if (query.getParent() == null) { return Arrays.stream(new TreeNode[]{ first1, second1 }); } if (query.getParent().getName().equals("first-1")) { return Arrays.stream(new TreeNode[]{first11}); } return Arrays.stream(new TreeNode[]{second11}); } }; HierarchyMapper<TreeNode, Void> hierarchyMapper = new HierarchyMapper<>( dataProvider ); hierarchyMapper.expand(root); hierarchyMapper.expand(second1); Map<Object, TreeNode> expandedItems = hierarchyMapper.getExpandedItems(); expandedItems.put(new Object(), new TreeNode("third-1")); }

Target:
public void getExpandedItems_tryToAddItemsToCollection_shouldThrowException() { exceptionRule.expect(UnsupportedOperationException.class); TreeNode root = new TreeNode("root", null); TreeNode second1 = new TreeNode("second-1", root); TreeNode second2 = new TreeNode("second-2", root); TreeNode third11 = new TreeNode("third-1-1", second1); TreeNode third21 = new TreeNode("third-2-1", second2); HierarchicalDataProvider<TreeNode, Void> dataProvider = new ThreeLevelStaticHierarchicalDataProvider(root, new TreeNode[]{second1, second2}, new TreeNode[]{third11, third21}); HierarchyMapper<TreeNode, Void> hierarchyMapper = new HierarchyMapper<>( dataProvider ); hierarchyMapper.expand(root); hierarchyMapper.expand(second1); Collection<TreeNode> expandedItems = hierarchyMapper.getExpandedItems(); expandedItems.add(new TreeNode("third-1")); }
Source:
public GetObjectRequest(final String bucketName, final String objectName, final long offset, final UUID jobId) { this.bucketName = bucketName; this.objectName = objectName; this.jobId = jobId; this.offset = offset; if(jobId != null) { this.getQueryParams().put("job", jobId.toString()); } this.getQueryParams().put("offset", Long.toString(offset)); }

Target:
public GetObjectRequest(final String bucketName, final String objectName, final long offset, final UUID jobId) { this.bucketName = bucketName; this.objectName = objectName; this.jobId = jobId; this.offset = offset; this.getQueryParams().put("job", jobId.toString()); this.getQueryParams().put("offset", Long.toString(offset)); }
Source:
private void doWhoIsRequest(VoiceInput voiceInput, SsmlDocumentBuilder builder) { String bot = (String) voiceInput.getMetadata().get("bot"); String botInQuestion = voiceInput.getMessageAsMap().get("botName"); if(bot == null || bot.isEmpty() || botInQuestion == null || botInQuestion.isEmpty()){ builder.text("I don't have any info for this situation."); return; } switch(bot){ case "complibot": if(botInQuestion.equals(bot)){ builder.text("That's me! ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("insultibot")){ builder.text("That's my bestie. ").endSentence().text("It can act grumpy sometimes, but it has a heart of gold.").endSentence(); }else{ builder.text("I don't know that bot, but I bet it's awesome.").endSentence(); } break; case "insultibot": if(botInQuestion.equals(bot)){ builder.text("Are you trolling me? ").endSentence().text("That's me. ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("complibot")){ builder.text("That's the annoyingly cheerful bot that won't shut up.").endSentence(); }else{ builder.text("I don't know that bot, and I'm perfectly fine with that.").endSentence(); } break; default: builder.text("I don't have that info for the bot named '" + bot + "'.").endSentence(); return; } }

Target:
private void doWhoIsRequest(VoiceInput voiceInput, SsmlDocumentBuilder builder) { String bot = (String) voiceInput.getMetadata().get("bot"); String botInQuestion = voiceInput.getMessageAsMap().get("botName"); if(StringUtils.isEmpty(bot) || StringUtils.isEmpty(botInQuestion)){ builder.text("I don't have any info for this situation."); return; } switch(bot){ case "complibot": if(botInQuestion.equals(bot)){ builder.text("That's me! ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("insultibot")){ builder.text("That's my bestie. ").endSentence().text("It can act grumpy sometimes, but it has a heart of gold.").endSentence(); }else{ builder.text("I don't know that bot, but I bet it's awesome.").endSentence(); } break; case "insultibot": if(botInQuestion.equals(bot)){ builder.text("Are you trolling me? ").endSentence().text("That's me. ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("complibot")){ builder.text("That's the annoyingly cheerful bot that won't shut up.").endSentence(); }else{ builder.text("I don't know that bot, and I'm perfectly fine with that.").endSentence(); } break; default: builder.text("I don't have any info for the bot named '" + bot + "'.").endSentence(); return; } }
Source:
public boolean updateCertificateTS(String oldAlias, Certificate cert) throws CertificateManagerException { final Map<String, String> trustStoreProperties = cmHelper.getTrustStoreSystemProperties(); String storeType = trustStoreProperties.get(TRUST_STORE_TYPE_KEY); final String storeLoc = trustStoreProperties.get(TRUST_STORE_KEY); final String passkey = trustStoreProperties.get(TRUST_STORE_PASSWORD_KEY); FileInputStream is = null; FileOutputStream os = null; boolean isUpdateSuccessful = false; try { KeyStore tstore = KeyStore.getInstance(storeType); if (!PKCS11_TYPE.equalsIgnoreCase(storeType)) { is = new FileInputStream(storeLoc); } tstore.load(is, passkey.toCharArray()); if (tstore.containsAlias(oldAlias)) { certToRestore = cert; os = updateCert(oldAlias, cert, storeLoc, passkey, tstore); isUpdateSuccessful = true; } } catch (final IOException | NoSuchAlgorithmException | CertificateException | KeyStoreException ex) { isUpdateSuccessful = false; LOG.error("Unable to update the Certifiate: ", ex.getLocalizedMessage(), ex); throw new CertificateManagerException(ex.getMessage(), ex); } finally { closeFiles(is, os); } return isUpdateSuccessful; }

Target:
public boolean updateCertificateTS(String oldAlias, Certificate cert) throws CertificateManagerException { final Map<String, String> trustStoreProperties = cmHelper.getTrustStoreSystemProperties(); String storeType = trustStoreProperties.get(TRUST_STORE_TYPE_KEY); final String storeLoc = trustStoreProperties.get(TRUST_STORE_KEY); final String passkey = trustStoreProperties.get(TRUST_STORE_PASSWORD_KEY); KeyStore storeCert; try { storeCert = KeyStore.getInstance(storeType); return updateCertificate(oldAlias, cert, storeType, storeLoc, passkey, storeCert); } catch (final KeyStoreException ex) { LOG.error("Unable to update the Certifiate: ", ex.getLocalizedMessage(), ex); throw new CertificateManagerException(ex.getMessage(), ex); } }
Source:
private String getUgiUserName() throws IOException { UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); return ugi.getShortUserName(); }

Target:
private static String getUgiUserName() throws IOException { UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); return ugi.getShortUserName(); }
Source:
public Node buildNode() throws Exception { config.saveSessionToFile(); if (daemon) { } Node node = new Node(port); node.configureAddressing(port, local); node.storageController = new StorageController(new File( this.storageDir).toPath(), node.addressTable); if (!adam && bootstrapNode != null) { node.addressTable.add(bootstrapNode); } Node.singleton = node; return Node.getInstance(); }

Target:
public Node buildNode() throws NodeException { config.saveSessionToFile(); if (daemon) { } Node node = new Node(); node.configureAddressing(port); node.storageController = new StorageController(new File( this.storageDir).toPath(), node.addressTable); if (!adam && bootstrapNode != null) { node.addressTable.add(bootstrapNode); } Node.singleton = node; node.startServer(port); return Node.getInstance(); }
Source:
protected void map(NullWritable key, ViewInfoTracker value, Context context) { final Configuration config = context.getConfiguration(); if (this.multiViewJobStatusTracker == null) { initMultiViewJobStatusTracker(config); } LOGGER.debug(String.format("Deleting from view %s, TenantID %s, and TTL value: %d", value.getViewName(), value.getTenantId(), value.getViewTtl())); try (PhoenixConnection connection =(PhoenixConnection) ConnectionUtil.getInputConnection(config) ){ if (value.getTenantId() != null && !value.getTenantId().equals("NULL")) { try (PhoenixConnection tenantConnection = (PhoenixConnection)PhoenixViewTtlUtil. buildTenantConnection(connection.getURL(), value.getTenantId())) { deletingExpiredRows(tenantConnection, value, config); } } else { deletingExpiredRows(connection, value, config); } } catch (SQLException e) { LOGGER.error(e.getErrorCode() + e.getSQLState(), e.getStackTrace()); } }

Target:
protected void map(NullWritable key, ViewInfoTracker value, Context context) { final Configuration config = context.getConfiguration(); if (this.multiViewJobStatusTracker == null) { initMultiViewJobStatusTracker(config); } LOGGER.debug(String.format("Deleting from view %s, TenantID %s, and TTL value: %d", value.getViewName(), value.getTenantId(), value.getViewTtl())); try (PhoenixConnection connection =(PhoenixConnection) ConnectionUtil.getInputConnection(config) ){ if (value.getTenantId() != null && !value.getTenantId().equals("NULL")) { try (PhoenixConnection tenantConnection = (PhoenixConnection)PhoenixViewTtlUtil. buildTenantConnection(connection.getURL(), value.getTenantId())) { deletingExpiredRows(tenantConnection, value, config); } } else { deletingExpiredRows(connection, value, config); } } catch (SQLException e) { LOGGER.error("Mapper got an exception while deleting expired rows : " + e.getErrorCode() + e.getSQLState(), e.getStackTrace()); } }
Source:
protected void assertSelectionEquals(String message, TestElement expected) { ISelection selection = fViewer.getStructuredSelection(); assertTrue(selection instanceof IStructuredSelection); List expectedList = new ArrayList(); expectedList.add(expected); IStructuredSelection structuredSelection = (IStructuredSelection)selection; assertEquals("selectionEquals - " + message, expectedList, (structuredSelection).toList()); }

Target:
protected void assertSelectionEquals(String message, TestElement expected) { IStructuredSelection selection = fViewer.getStructuredSelection(); List expectedList = new ArrayList(); expectedList.add(expected); assertEquals("selectionEquals - " + message, expectedList, selection.toList()); }
Source:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Missing arguments. Usage: " + usageMessage); return false; } GameMode gamemode; final String inputMode = args[0]; switch (inputMode.toLowerCase()) { case "s": case "0": case "survival": gamemode = GameMode.SURVIVAL; break; case "c": case "1": case "creative": gamemode = GameMode.CREATIVE; break; case "a": case "2": case "adventure": gamemode = GameMode.ADVENTURE; break; case "sp": case "3": case "spectator": gamemode = GameMode.SPECTATOR; break; default: sender.sendMessage(ChatColor.RED + "Unknown mode '" + inputMode + "'."); return false; } Bukkit.getServer().setDefaultGameMode(gamemode); sender.sendMessage("Default game mode set to " + ChatColor.GRAY + "" + ChatColor.ITALIC + gamemode.toString().toLowerCase()); return true; }

Target:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } final String inputMode = args[0]; final GameMode gamemode = GameModeUtils.build(inputMode); if (gamemode == null) { sender.sendMessage(ChatColor.RED + "Unknown mode '" + inputMode + "'."); return false; } Bukkit.getServer().setDefaultGameMode(gamemode); sender.sendMessage("The world's default game mode is now " + ChatColor.GRAY + "" + ChatColor.ITALIC + GameModeUtils.prettyPrint(gamemode) + " Mode"); return true; }
Source:
private static ExternalMetadata validateAndGetMetadata(JsonNode paymentRequest) { Map<String, Object> metadataMap = null; try { metadataMap = objectMapper.convertValue(paymentRequest.get("metadata"), Map.class); } catch (IllegalArgumentException e) { PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, "Must be an object of JSON key-value pairs."); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } ExternalMetadata metadata = new ExternalMetadata(metadataMap); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(metadata); if (violations.size() > 0) { String message = violations.stream() .map(v -> capitalize(v.getMessage().replace("Field [metadata] ", "") + ".")) .collect(Collectors.joining(" ")); PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, message); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } return metadata; }

Target:
private static ExternalMetadata validateAndGetMetadata(JsonNode paymentRequest) { Map<String, Object> metadataMap = null; try { metadataMap = objectMapper.convertValue(paymentRequest.get("metadata"), Map.class); } catch (IllegalArgumentException e) { PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, "Must be an object of JSON key-value pairs"); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } ExternalMetadata metadata = new ExternalMetadata(metadataMap); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(metadata); if (violations.size() > 0) { String message = violations.stream() .map(ConstraintViolation::getMessage) .map(msg -> msg.replace("Field [metadata] ", "")) .map(StringUtils::capitalize) .collect(Collectors.joining(". ")); PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, message); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } return metadata; }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("ExpressionEvaluatingSelector [expressionParser=") .append(expressionParser.toString()) .append(", expressionString=") .append(this.expressionString) .append("]"); return builder.toString(); }

Target:
public String toString() { return "ExpressionEvaluatingSelector for: [" + this.expressionString + "]"; }
Source:
public static synchronized Log getLog(String logTag) { if (logTag.length() > 23) { android.util.Log.w(TAG, "Truncating log tag length as it exceed 23, the limit imposed by android on certain API Levels"); logTag = logTag.substring(0, 23); } Log log = logMap.get(logTag); if (log == null) { if (checkApacheCommonsLoggingExists()) { try { log = new ApacheCommonsLogging(logTag); logMap.put(logTag, log); } catch (Exception e) { android.util.Log.w(TAG, "Could not create log from " + APACHE_COMMONS_LOGGING_LOGFACTORY, e); } } if (log == null) { log = new AndroidLog(logTag); logMap.put(logTag, log); } } return log; }

Target:
public static synchronized Log getLog(String logTag) { logTag = getTruncatedLogTag(logTag); Log log = logMap.get(logTag); if (log == null) { if (checkApacheCommonsLoggingExists()) { try { log = new ApacheCommonsLogging(logTag); logMap.put(logTag, log); } catch (Exception e) { android.util.Log.w(TAG, "Could not create log from " + APACHE_COMMONS_LOGGING_LOGFACTORY, e); } } if (log == null) { log = new AndroidLog(logTag); logMap.put(logTag, log); } } return log; }
Source:
private void deserializeBlobIdAndAssert(short version, String srcBlobIdStr) throws Exception { List<BlobId> blobIds = new ArrayList<>(); blobIds.add(BlobId.fromStringId(srcBlobIdStr, referenceClusterMap)); blobIds.add(BlobId.fromDataInputStream(getStreamFromBase64(srcBlobIdStr), referenceClusterMap)); blobIds.add(BlobId.fromDataInputStream(getStreamFromBase64(srcBlobIdStr + "EXTRA"), referenceClusterMap)); for (BlobId blobId : blobIds) { assertEquals("Wrong partition ID in blobId: " + blobId, referencePartitionId, blobId.getPartition()); assertEquals("Wrong base-64 ID in blobId: " + blobId, srcBlobIdStr, blobId.getID()); assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); switch (version) { case BLOB_ID_V1: assertEquals("Wrong flag in blobId: " + blobId, BlobId.DEFAULT_FLAG, blobId.getFlag()); assertEquals("Wrong datacenter ID in blobId: " + blobId, LEGACY_DATACENTER_ID, blobId.getDatacenterId()); assertEquals("Wrong account ID in blobId: " + blobId, Account.LEGACY_ACCOUNT_ID, blobId.getAccountId()); assertEquals("Wrong container ID in blobId: " + blobId, Container.LEGACY_CONTAINER_ID, blobId.getContainerId()); break; case BLOB_ID_V2: assertEquals("Wrong flag in blobId: " + blobId, referenceFlag, blobId.getFlag()); assertEquals("Wrong datacenter ID in blobId: " + blobId, referenceDatacenterId, blobId.getDatacenterId()); assertEquals("Wrong account ID in blobId: " + blobId, referenceAccountId, blobId.getAccountId()); assertEquals("Wrong container ID in blobId: " + blobId, referenceContainerId, blobId.getContainerId()); break; default: throw new IllegalArgumentException("invalid version number blob" + version); } } }

Target:
private void deserializeBlobIdAndAssert(short version, String srcBlobIdStr) throws Exception { List<BlobId> blobIds = new ArrayList<>(); blobIds.add(new BlobId(srcBlobIdStr, referenceClusterMap)); blobIds.add(new BlobId(getStreamFromBase64(srcBlobIdStr), referenceClusterMap)); blobIds.add(new BlobId(getStreamFromBase64(srcBlobIdStr + "EXTRA"), referenceClusterMap)); for (BlobId blobId : blobIds) { assertEquals("Wrong base-64 ID in blobId: " + blobId, srcBlobIdStr, blobId.getID()); assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); assertBlobIdFieldValues(version, blobId, referenceFlag, referenceDatacenterId, referenceAccountId, referenceContainerId, referencePartitionId); } }
Source:
public void validate(Object o, Errors errors) { Diagnosis diagnosis = (Diagnosis)o; if(diagnosis == null){ throw new APIException("Diagnosis can't be null"); } else if (diagnosis.getVoided()) { return; } ValidationUtils.rejectIfEmptyOrWhitespace(errors, "rank", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "certainty", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "diagnosis", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "encounter", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "diagnosisId", "field.required"); }

Target:
public void validate(Object o, Errors errors) { Diagnosis diagnosis = (Diagnosis)o; if(diagnosis == null){ throw new APIException("Diagnosis can't be null"); } else if (diagnosis.getVoided()) { return; } if (diagnosis.getEncounter() == null){ errors.rejectValue("encounter", "error.null"); } if (diagnosis.getDiagnosis() == null){ errors.rejectValue("diagnosis", "error.null"); } if (diagnosis.getCertainty() == null){ errors.rejectValue("certainty", "error.null"); } Integer rank = diagnosis.getRank(); if (rank == null){ errors.rejectValue("rank", "error.null"); }else if(rank < 0){ errors.rejectValue("rank", "error.rank.notPositiveInteger"); } }
Source:
public void setElements(String elements) { String[] entries = elements.split(","); clearEntries(); int tupleSize = getTupleSize(); for (int i = 0; i < entries.length; i += tupleSize) { if (i + tupleSize - 1 >= entries.length) { break; } String[] tuple = new String[tupleSize]; for (int j = 0; j < tupleSize; ++j) { tuple[j] = entries[i + j]; } addEntryFromTuple(tuple); } postDataImportAction(); }

Target:
public void setElements(String elements) { String[] entries = elements.split(","); clearEntries(); int tupleSize = getTupleSize(); for (int i = 0; i < entries.length; i += tupleSize) { if (i + tupleSize - 1 >= entries.length) { break; } String[] tuple = new String[tupleSize]; System.arraycopy(entries, i, tuple, 0, tupleSize); addEntryFromTuple(tuple); } postDataImportAction(); }
Source:
public void noMdevs() { vm.setCustomProperties("key=value"); List<VDS> result = filter(); assertThat(result == vdsList).isTrue(); }

Target:
public void noMdevs() { vm.setCustomProperties("key=value"); List<VDS> result = filter(); assertSame(vdsList, result); }
Source:
public RunAmok(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}"); this.getSpellAbility().addEffect(new BoostTargetEffect(3, 3, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetAttackingCreature()); }

Target:
public RunAmok(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}"); this.getSpellAbility().addEffect(new BoostTargetEffect(3, 3, Duration.EndOfTurn).setText("Target attacking creature gets +3/+3")); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn).setText("and gains trample until end of turn")); this.getSpellAbility().addTarget(new TargetAttackingCreature()); }
Source:
public void testGetPositionWhenSelectorIsNull() { final Rect position = positionProvider.getPosition(null); verify(console).warn("[Guided Tour - Position Provider] Invalid custom query selector: null"); assertNotNull(position); }

Target:
public void testGetPositionWhenSelectorIsNull() { final Rect position = positionProvider.getPosition(null); verify(console).warn("[Guided Tour - Position Provider] Invalid custom query selector: null"); assertEquals(none, position); }