auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean validate() { if (isImagesAlreadyOnTarget()) { ImportValidator importValidator = getImportValidator(); if (!validate(importValidator.validateUnregisteredEntity(vmFromConfiguration, ovfEntityData))) { return false; } if (!validate(importValidator.validateStorageExistForUnregisteredEntity(getImages(), getParameters().isAllowPartialImport(), imageToDestinationDomainMap, failedDisksToImportForAuditLog))) { return false; } if (!validate(importValidator.validateStorageExistsForMemoryDisks(getVm().getSnapshots(), getParameters().isAllowPartialImport(), failedDisksToImportForAuditLog))) { return false; } setImagesWithStoragePoolId(getParameters().getStoragePoolId(), getVm().getImages()); } if (!validateExternalVnicProfileMapping()) { return false; } return super.validate(); }

Target:
protected boolean validate() { if (!super.validate()) { return false; } if (isImagesAlreadyOnTarget()) { if (!validateExternalVnicProfileMapping()) { return false; } ImportValidator importValidator = getImportValidator(); if (!validate(importValidator.validateUnregisteredEntity(ovfEntityData))) { return false; } if (!validate(importValidator.validateDiskNotAlreadyExistOnDB(getImages(), getParameters().isAllowPartialImport(), imageToDestinationDomainMap, failedDisksToImportForAuditLog))) { return false; } if (!validate(importValidator.validateStorageExistForUnregisteredEntity(getImages(), getParameters().isAllowPartialImport(), imageToDestinationDomainMap, failedDisksToImportForAuditLog))) { return false; } if (!validate(importValidator.validateStorageExistsForMemoryDisks(getVm().getSnapshots(), getParameters().isAllowPartialImport(), failedDisksToImportForAuditLog))) { return false; } setImagesWithStoragePoolId(getParameters().getStoragePoolId(), getVm().getImages()); } return true; }
Source:
public boolean containsRepo(String projectName) { SWTBotTable table = bot.table(0); int repoCount = configuredRepoCount(); for (int i = 0; i < repoCount; i++) { String rowName = table.getTableItem(i).getText(); if (rowName.contains(projectName)) { return true; } } return false; }

Target:
public boolean containsRepo(String projectName) { SWTBotTable table = bot.table(0); int repoCount = configuredRepoCount(); for (int i = 0; i < repoCount; i++) { String rowName = table.getTableItem(i).getText(); if (rowName.contains(projectName)) return true; } return false; }
Source:
protected Object execute(Object data) { if (data == null) { throw new ExecutionPlanRuntimeException("Data can not be null."); } if (data instanceof HashMap) { log.info("hashmap checked"); return Boolean.TRUE; } return Boolean.FALSE; }

Target:
protected Boolean execute(Object data) { if (data == null) { throw new ExecutionPlanRuntimeException("Data can not be null."); } if (data instanceof HashMap) { return Boolean.TRUE; } return Boolean.FALSE; }
Source:
protected void validatePresenceOfAlert() { String browser = Grid.getWebTestSession().getBrowser(); logger.finest("Validating presense of alert with browser " + browser); if (doesNotHandleAlerts(browser)) { logger.info(ALERTS_ARE_NOT_SUPPORTED_ERR_MSG); return; } try { Grid.driver().switchTo().alert(); String errorMsg = "Encountered an alert. Cannot wait for an element when an operation triggers an alert."; throw new InvalidElementStateException(errorMsg); } catch (NoAlertPresentException exception) { } }

Target:
protected void validatePresenceOfAlert() { String browser = Grid.getWebTestSession().getBrowser(); logger.finest("Validating presence of alert with browser " + browser); if (doesNotHandleAlerts(browser)) { logger.info(ALERTS_ARE_NOT_SUPPORTED_ERR_MSG); return; } try { Grid.driver().switchTo().alert(); String errorMsg = "Encountered an alert. Cannot wait for an element when an operation triggers an alert."; throw new InvalidElementStateException(errorMsg); } catch (NoAlertPresentException exception) { } }
Source:
public void register() { final ItemStack waterBottle = new ItemStack(Items.potionitem, 1, 0); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), Items.water_bucket, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), waterBottle, waterBottle, waterBottle, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); if (GrowthCraftBees.fluids.honey != null) { final ItemStack honeyBottleStack = GrowthCraftBees.fluids.honey.asBottleItemStack(); final ItemStack meadBucket = GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(); GameRegistry.addShapelessRecipe(meadBucket, Items.water_bucket, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); GameRegistry.addShapelessRecipe(meadBucket, waterBottle, waterBottle, waterBottle, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); } { GrowthCraftCellar.boozeBuilderFactory.create(beeWaste.fluid.getFluid()) .brewsFrom(FluidRegistry.WATER(250), new ItemStack(GrowthCraftBees.ItemHoneyCombEmpty), TickUtils.minutes(1), new Residue(GrowthCraftBees.ItemBeesWax.asStack(1), 1.0f)); } registerRecipes(); }

Target:
public void register() { final ItemStack waterBottle = new ItemStack(Items.potionitem, 1, 0); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), Items.water_bucket, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), waterBottle, waterBottle, waterBottle, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); if (GrowthCraftBees.fluids.honey != null) { final ItemStack honeyBottleStack = GrowthCraftBees.fluids.honey.asBottleItemStack(); final ItemStack meadBucket = GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(); GameRegistry.addShapelessRecipe(meadBucket, Items.water_bucket, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); GameRegistry.addShapelessRecipe(meadBucket, waterBottle, waterBottle, waterBottle, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); } { GrowthCraftCellar.boozeBuilderFactory.create(GrowthCraftBees.fluids.beeWaste.fluid.getFluid()) .brewsFrom(new FluidStack(FluidRegistry.WATER, 250), GrowthCraftBees.items.honeyCombEmpty.asStack(), TickUtils.minutes(1), new Residue(GrowthCraftBees.items.beesWax.asStack(1), 1.0f)); } registerRecipes(); }
Source:
public void onSucceeded() { TransactionSupport.executeInNewTransaction(() -> { syncDbRecords(true); return null; }); log.info("Successfully merged snapshot '{}' images '{}'..'{}'", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)"); }

Target:
onSucceeded() { syncDbRecords(true); log.info("Successfully merged snapshot '{}' images '{}'..'{}'", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)"); }
Source:
protected boolean proceedVdsStats() { boolean returnValue = true; try { runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(getVds())); if (IrsBrokerCommand.isDomainsReportedAsProblematic(getVds().getstorage_pool_id(), getVds().getDomains())) { log.errorFormat("One of the domains of host {0} in pool {1} is problematic", getVds().getvds_name(), getStoragePool() .getname()); returnValue = false; } } catch (VdcBLLException e) { log.errorFormat("Could not get vds stats for vds {0} because of error {1}", getVds().getvds_name(), e); returnValue = false; } return returnValue; }

Target:
protected boolean proceedVdsStats() { boolean returnValue = true; try { runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(getVds())); if (IrsBrokerCommand.isDomainsReportedAsProblematic(getVds().getstorage_pool_id(), getVds().getDomains())) { log.errorFormat("One of the Storage Domains of host {0} in pool {1} is problematic", getVds().getvds_name(), getStoragePool() .getname()); returnValue = false; } } catch (VdcBLLException e) { log.errorFormat("Could not get Host statistics for Host {0}, Error is {1}", getVds().getvds_name(), e); returnValue = false; } return returnValue; }
Source:
public void storeSettings() { if (preferences.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE) != fontOverrideProperty.getValue()) { restartWarnings.add(Localization.lang("Override font settings")); preferences.putBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE, fontOverrideProperty.getValue()); } int newFontSize = Integer.parseInt(fontSizeProperty.getValue()); if (preferences.getInt(JabRefPreferences.MAIN_FONT_SIZE) != newFontSize) { restartWarnings.add(Localization.lang("Override font size")); preferences.putInt(JabRefPreferences.MAIN_FONT_SIZE, newFontSize); } if (themeLightProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.MAIN_CSS)) { restartWarnings.add(Localization.lang("Theme changed to light theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.MAIN_CSS); } else if (themeDarkProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.DARK_CSS)) { restartWarnings.add(Localization.lang("Theme changed to dark theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.DARK_CSS); } else if (themeCustomProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.getCustomCss())) { restartWarnings.add(Localization.lang("Theme change to a custom theme.")); preferences.put(JabRefPreferences.FX_THEME, preferences.getPathToCustomTheme()); } }

Target:
public void storeSettings() { if (preferences.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE) != fontOverrideProperty.getValue()) { restartWarnings.add(Localization.lang("Override font settings")); preferences.putBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE, fontOverrideProperty.getValue()); } int newFontSize = Integer.parseInt(fontSizeProperty.getValue()); if (preferences.getInt(JabRefPreferences.MAIN_FONT_SIZE) != newFontSize) { restartWarnings.add(Localization.lang("Override font size")); preferences.putInt(JabRefPreferences.MAIN_FONT_SIZE, newFontSize); } if (themeLightProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.MAIN_CSS)) { restartWarnings.add(Localization.lang("Theme changed to light theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.MAIN_CSS); } else if (themeDarkProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.DARK_CSS)) { restartWarnings.add(Localization.lang("Theme changed to dark theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.DARK_CSS); } else if (themeCustomProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.getCustomCss())) { restartWarnings.add(Localization.lang("Theme changed to a custom theme.")); preferences.put(JabRefPreferences.FX_THEME, preferences.getPathToCustomTheme()); } }
Source:
public void process(Exchange exchange) throws Exception { log.debug("Processing solr update"); final Message in = exchange.getIn(); Document msgBody = MessageUtil.getDocumentBody(in); Element body = msgBody.getRootElement(); String pidValue = body.getChild("pid", ATOM_NS).getTextTrim(); String action = body.getChild("actionType", ATOM_NS).getTextTrim(); IndexingActionType actionType = IndexingActionType.getAction(action); PID pid = PIDs.get(pidValue); in.setHeader(FCREPO_URI, pid.getRepositoryPath()); in.setHeader(CdrUpdateAction, actionType.getName()); }

Target:
public void process(Exchange exchange) throws Exception { log.debug("Processing solr update"); final Message in = exchange.getIn(); Document msgBody = MessageUtil.getDocumentBody(in); Element body = msgBody.getRootElement(); String pidValue = body.getChild("pid", ATOM_NS).getTextTrim(); PID pid = PIDs.get(pidValue); String action = body.getChild("actionType", ATOM_NS).getTextTrim(); IndexingActionType actionType = IndexingActionType.getAction(action); in.setHeader(FCREPO_URI, pid.getRepositoryPath()); in.setHeader(CdrUpdateAction, actionType.getName()); }
Source:
public List<VariantSourceMongo> findAllVariantSourcesForBeacon() { return repository.findAllForBeacon(); }

Target:
public List<VariantSource> findAllVariantSourcesForBeacon() { return convert(repository.findAllForBeacon()); }
Source:
protected static Set<Object> setupSingletons() { Set<Object> result = new HashSet<>(); AutomationServer as = Framework.getService(AutomationServer.class); for (Class<? extends MessageBodyReader<?>> readerKlass : as.getReaders()) { try { result.add(readerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { log.error("Unable to instantiate MessageBodyReader : " + readerKlass, e); } } for (Class<? extends MessageBodyWriter<?>> writerKlass : as.getWriters()) { try { result.add(writerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { log.error("Unable to instantiate MessageBodyWriter : " + writerKlass, e); } } result.add(new AutomationServiceProvider()); result.add(new AutomationServerProvider()); result.add(new JsonFactoryProvider()); result.add(new CoreSessionProvider()); result.add(new CoreIODelegate()); return result; }

Target:
protected static Set<Object> setupSingletons() { Set<Object> result = new HashSet<>(); AutomationServer as = Framework.getService(AutomationServer.class); for (Class<? extends MessageBodyReader<?>> readerKlass : as.getReaders()) { try { result.add(readerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { log.error("Unable to instantiate MessageBodyReader: {}", readerKlass, e); } } for (Class<? extends MessageBodyWriter<?>> writerKlass : as.getWriters()) { try { result.add(writerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { log.error("Unable to instantiate MessageBodyWriter: {}", writerKlass, e); } } result.add(new AutomationServiceProvider()); result.add(new AutomationServerProvider()); result.add(new JsonFactoryProvider()); result.add(new CoreSessionProvider()); result.add(new CoreIODelegate()); return result; }
Source:
static public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; }

Target:
static public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); return Long.compare(v1, v2); }
Source:
private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { try { this.location = location; this.databaseName = location.toString(); this.database = new DatabaseImpl(location, keyProvider); this.query = new IndexManagerImpl(database); } catch (DatastoreException e) { closeQuietlyOnException(); throw e; } catch (IOException e) { closeQuietlyOnException(); throw e; } catch (SQLException e) { closeQuietlyOnException(); throw e; } }

Target:
private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { try { this.location = location; this.extensionsLocation = new File(location, EXTENSIONS_LOCATION_NAME); this.databaseName = location.toString(); this.database = new DatabaseImpl(location, extensionsLocation, keyProvider); this.query = new IndexManagerImpl(database, extensionsLocation, keyProvider); } catch (DatastoreException e) { closeQuietlyOnException(); throw e; } catch (IOException e) { closeQuietlyOnException(); throw e; } catch (SQLException e) { closeQuietlyOnException(); throw e; } }
Source:
private void writeGarbageToLogUnit(RuntimeLayout runtimeLayout, String logUnitServer, @NonNull IToken token, @NonNull LogData garbageEntry) { LogUnitClient client = runtimeLayout.getLogUnitClient(logUnitServer); garbageEntry.setId(runtime.getParameters().getClientId()); final int numRetries = 3; for (int x = 0; x < numRetries; x++) { try { CFUtils.getUninterruptibly(client.writeGarbageEntries(Collections.singletonList(garbageEntry)), NetworkException.class, TimeoutException.class, WrongEpochException.class); } catch (NetworkException | TimeoutException e) { log.warn("writeGarbageToLogUnit: accessing LogUnit encounters a network error on try {}", logUnitServer, x, e); Duration retryRate = runtime.getParameters().getConnectionRetryRate(); Sleep.sleepUninterruptibly(retryRate); } catch (WrongEpochException wee) { long serverEpoch = wee.getCorrectEpoch(); long runtimeEpoch = runtime.getLayoutView().getLayout().getEpoch(); log.warn("writeGarbageToLogUnit[{}]: wrongEpochException, runtime is in epoch {}, " + "while server is in epoch {}. Invalidate layout for this client and retry, attempt: " + "{}/{}", token.getSequence(), runtimeEpoch, serverEpoch, x + 1, numRetries); runtime.invalidateLayout(); } } }

Target:
private void writeGarbageToLogUnit(RuntimeLayout runtimeLayout, String logUnitServer, @NonNull IToken token, @NonNull LogData garbageEntry) { LogUnitClient client = runtimeLayout.getLogUnitClient(logUnitServer); garbageEntry.setId(runtime.getParameters().getClientId()); final int numRetries = 3; for (int x = 0; x < numRetries; x++) { try { CFUtils.getUninterruptibly(client.writeGarbageEntries(Collections.singletonList(garbageEntry)), NetworkException.class, TimeoutException.class, WrongEpochException.class); return; } catch (NetworkException | TimeoutException e) { log.warn("writeGarbageToLogUnit: accessing LogUnit encounters a network error. " + "Invalidate layout for this client and retry, attempt: {}/{}", logUnitServer, x + 1, numRetries, e); Duration retryRate = runtime.getParameters().getConnectionRetryRate(); Sleep.sleepUninterruptibly(retryRate); } catch (WrongEpochException wee) { long serverEpoch = wee.getCorrectEpoch(); long runtimeEpoch = runtime.getLayoutView().getLayout().getEpoch(); log.warn("writeGarbageToLogUnit[{}]: wrongEpochException, runtime is in epoch {}, " + "while server is in epoch {}. Invalidate layout for this client and retry, attempt: " + "{}/{}", token.getSequence(), runtimeEpoch, serverEpoch, x + 1, numRetries); runtime.invalidateLayout(); } } String errorMsg = String.format("Writing garbage to %s fails after %d attempts", logUnitServer, numRetries); log.warn(errorMsg); throw new RetryExhaustedException(errorMsg); }
Source:
private void authorizeResourceView(final Resource resource) throws AccessDeniedException { try { if (!adminService.isAdmin(AuthorizationService.Operation.ADMIN)) { if (!authorizationService.isAuthorized(AuthorizationService.Operation.VIEW, resource)) { throw new AccessDeniedException(AuthorizationService.Operation.VIEW, resource); } } } catch (final PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }

Target:
private void authorizeResourceView(final Resource resource) throws AccessDeniedException { try { if (!(adminService.isAdmin(AuthorizationService.Operation.ADMIN) || authorizationService.isAuthorized(AuthorizationService.Operation.VIEW, resource))) { throw new AccessDeniedException(AuthorizationService.Operation.VIEW, resource); } } catch (final PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }
Source:
public void put(String url, String response) throws IOException { final File transcriptDir = getTranscriptDir(); if (transcriptDir == null) throw new IOException("Transcript directory doesn't exist"); String hash = Sha1Util.SHA1(url); File file = new File(transcriptDir, hash); FileOutputStream out = new FileOutputStream(file); out.write(response.getBytes()); out.close(); }

Target:
public void put(String url, String response) throws IOException { final File transcriptDir = getTranscriptDir(); if (transcriptDir == null) throw new IOException("Transcript directory not found"); String hash = Sha1Util.SHA1(url); File file = new File(transcriptDir, hash); FileOutputStream out = new FileOutputStream(file); out.write(response.getBytes()); out.close(); }
Source:
private void treeExpandingCollapsingAction(final TreeItem treeItem, final DTreeItem dTreeItem, final boolean expand, final String errorMessage) { if ((expand && !dTreeItem.isExpanded()) || (!expand && dTreeItem.isExpanded())) { final Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); activeShell.getDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkbench wb = PlatformUI.getWorkbench(); IProgressService ps = wb.getProgressService(); try { ps.busyCursorWhile(new ExpandDTreeItemRunnableWithProgress(session, dTreeItem, expand)); } catch (InvocationTargetException e) { TreeUIPlugin.INSTANCE.log(new Status(IStatus.ERROR, TreeUIPlugin.ID, "Error while " + errorMessage, e)); } catch (InterruptedException e) { Display.getDefault().asyncExec(new ChangeExpandeStateRunnable(treeItem, !expand)); } } }); } }

Target:
private void treeExpandingCollapsingAction(final TreeItem treeItem, final DTreeItem dTreeItem, final boolean expand, final String errorMessage) { if ((expand && !dTreeItem.isExpanded()) || (!expand && dTreeItem.isExpanded())) { final Shell activeShell = tree.getShell(); activeShell.getDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkbench wb = PlatformUI.getWorkbench(); IProgressService ps = wb.getProgressService(); try { ps.busyCursorWhile(new ExpandDTreeItemRunnableWithProgress(session, dTreeItem, expand)); } catch (InvocationTargetException e) { TreeUIPlugin.INSTANCE.log(new Status(IStatus.ERROR, TreeUIPlugin.ID, "Error while " + errorMessage, e)); } catch (InterruptedException e) { Display.getDefault().asyncExec(new ChangeExpandeStateRunnable(treeItem, !expand)); } } }); } }
Source:
public void testSendSerialData802Timeout() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (TimeoutException e) { } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (TimeoutException e) { } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (TimeoutException e) { } }

Target:
public void testSendSerialData802Timeout() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(TimeoutException.class, e.getClass()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(TimeoutException.class, e.getClass()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(TimeoutException.class, e.getClass()); } }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRestoreSnapshotCommand())) { restoreSnapshot(); } else if (command.equals(getDeleteSnapshotCommand())) { deleteSnapshot(); } else if (command.equals(getDeleteAllSnapshotsCommand())) { deleteAllSnapshots(); } else if (command.equals(getActivateSnapshotCommand())) { activateSnapshot(); } else if (command.equals(getDeactivateSnapshotCommand())) { deactivateSnapshot(); } else if (command.getName().equals("onRestoreSnapshot")) { onRestoreSnapshot(); } else if (command.getName().equals("onDeleteSnapshot")) { onDeleteSnapshot(); } else if (command.getName().equals("onDeleteAllSnapshots")) { onDeleteAllSnapshots(); } else if (command.getName().equals("onActivateSnapshot")) { onActivateSnapshot(); } else if (command.getName().equals("onDeactivateSnapshot")) { onDeactivateSnapshot(); } else if (command.getName().equals("cancelConfirmation")) { setConfirmWindow(null); } else if (command.equals(getCreateSnapshotCommand())) { createSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotScheduleWithoutConfirmation")) { onEditSnapshotScheduleWithoutConfirmation(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRestoreSnapshotCommand())) { restoreSnapshot(); } else if (command.equals(getDeleteSnapshotCommand())) { deleteSnapshot(); } else if (command.equals(getDeleteAllSnapshotsCommand())) { deleteAllSnapshots(); } else if (command.equals(getActivateSnapshotCommand())) { activateSnapshot(); } else if (command.equals(getDeactivateSnapshotCommand())) { deactivateSnapshot(); } else if (command.getName().equals("onRestoreSnapshot")) { onRestoreSnapshot(); } else if (command.getName().equals("onDeleteSnapshot")) { onDeleteSnapshot(); } else if (command.getName().equals("onDeleteAllSnapshots")) { onDeleteAllSnapshots(); } else if (command.getName().equals("onActivateSnapshot")) { onActivateSnapshot(); } else if (command.getName().equals("onDeactivateSnapshot")) { onDeactivateSnapshot(); } else if (command.getName().equals("cancelConfirmation")) { setConfirmWindow(null); } else if (command.equals(getCreateSnapshotCommand())) { createSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotScheduleInternal")) { onEditSnapshotScheduleInternal(); } }
Source:
private String executeBashScript(final String script) { final Script command = new Script("/bin/bash", _timeout.getMillis(), s_logger); command.add("-c"); command.add(script); return command.execute(); }

Target:
private String executeBashScript(final String script) { final Script command = new Script("/bin/bash", _timeout, s_logger); command.add("-c"); command.add(script); return command.execute(); }
Source:
public DataSet<V> distinct(String name, boolean isLast, OperationContext context, boolean pushScope, String scopeDetail) { pushScopeIfNeeded(context, pushScope, scopeDetail); try { int numPartitions = SparkUtils.getPartitions(rdd, defaultPartitions); Dataset<Row> result = toSparkRow(this,context) .distinct(); return toSpliceLocatedRow(result,context); } catch (Exception se){ throw new RuntimeException(se); } finally { if (pushScope) context.popScope(); } }

Target:
public DataSet<V> distinct(String name, boolean isLast, OperationContext context, boolean pushScope, String scopeDetail) { pushScopeIfNeeded(context, pushScope, scopeDetail); try { Dataset<Row> result = toSparkRow(this,context) .distinct(); return toSpliceLocatedRow(result,context); } catch (Exception se){ throw new RuntimeException(se); } finally { if (pushScope) context.popScope(); } }
Source:
protected String buildItemKey(ConcurStandardAccountingExtractDetailLine saeLine) { String objectCodeForKey = saeLine.getJournalAccountCode(); if (Boolean.TRUE.equals(saeLine.getJournalAccountCodeOverridden())) { objectCodeForKey = buildFakeObjectCodeToLeaveDetailLineUnmerged(); } return new StringBuilder(INITIAL_BUILDER_SIZE) .append(makeEmptyIfBlank(saeLine.getReportId())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getChartOfAccountsCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getAccountNumber())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubAccountNumber(), getDashSubAccountNumber())) .append(PIPE_CHAR).append(makeEmptyIfBlank(objectCodeForKey)) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubObjectCode(), getDashSubObjectCode())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getProjectCode(), getDashProjectCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getOrgRefId())) .toString(); }

Target:
protected String buildItemKey(ConcurStandardAccountingExtractDetailLine saeLine) { String objectCodeForKey = saeLine.getJournalAccountCode(); if (Boolean.TRUE.equals(saeLine.getJournalAccountCodeOverridden())) { objectCodeForKey = buildFakeObjectCodeToLeaveDetailLineUnmerged(); } return new StringBuilder(INITIAL_BUILDER_SIZE) .append(saeLine.getReportId()) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getChartOfAccountsCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getAccountNumber())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubAccountNumber(), getDashSubAccountNumber())) .append(PIPE_CHAR).append(makeEmptyIfBlank(objectCodeForKey)) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubObjectCode(), getDashSubObjectCode())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getProjectCode(), getDashProjectCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getOrgRefId())) .toString(); }
Source:
protected String generateHelpMessage() { StringBuilder sb = new StringBuilder(); sb.append( "News Categories (example: !news toronto):" ); for ( String category : newsFeedsByCategory.keySet() ) { if ( category.equals( "top" ) ) { sb.append( "\n" ); sb.append( " General:" ); } else if ( category.equals( "redhat" ) ) { sb.append( "\n" ); sb.append( " Open Source:" ); } else if ( category.equals( "politics" ) ) { sb.append( "\n" ); sb.append( " Topics:" ); } else if ( category.equals( "sports" ) ) { sb.append( "\n" ); sb.append( " Sports:" ); } else if ( category.equals( "bc" ) ) { sb.append( "\n" ); sb.append( " Regional:" ); } sb.append( " { " + category + " }" ); } return sb.toString(); }

Target:
protected String generateHelpMessage() { StringBuilder sb = new StringBuilder(); sb.append( "News Categories (example: !news toronto):" ); String prevGenre = null; for ( String category : newsFeedsByCategory.keySet() ) { String currentGenre = newsFeedsByCategory.get( category ).getLeft(); if ( !currentGenre.equals( prevGenre ) ) { sb.append( "\n" ); sb.append( " " + currentGenre + ":" ); prevGenre = currentGenre; } sb.append( " { " + category + " }" ); } return sb.toString(); }
Source:
public void sendTerminationNotification(InstanceGroup group, String instance) { String propEmailGlobalReceiver = "simianarmy.chaos.notification.global.receiverEmail"; String propEmailGroupEnabled = String.format("%s%s.%s.notification.enabled", NS, group.type(), group.name()); if (cfg.getStr(propEmailGlobalReceiver) == null) { LOGGER.debug(String.format("No global notification termination turned on, set %s", propEmailGlobalReceiver)); if (!cfg.getBoolOrElse(propEmailGroupEnabled, false)) { LOGGER.debug(String.format("Group %s [type %s] does not turn on termination notification, " + "set %s=true to enable it.", group.name(), group.type(), propEmailGroupEnabled)); return; } } ChaosEmailNotifier notifier = context().chaosEmailNotifier(); if (notifier == null) { String msg = "Chaos email notifier is not set."; LOGGER.error(msg); throw new RuntimeException(msg); } notifier.sendTerminationNotification(group, instance); }

Target:
public void sendTerminationNotification(InstanceGroup group, String instance) { String propEmailGlobalEnabled = "simianarmy.chaos.notification.global.enabled"; String propEmailGroupEnabled = String.format("%s%s.%s.notification.enabled", NS, group.type(), group.name()); ChaosEmailNotifier notifier = context().chaosEmailNotifier(); if (notifier == null) { String msg = "Chaos email notifier is not set."; LOGGER.error(msg); throw new RuntimeException(msg); } if (cfg.getBoolOrElse(propEmailGroupEnabled, false)) { notifier.sendTerminationNotification(group, instance); } if (cfg.getBoolOrElse(propEmailGlobalEnabled, false)) { notifier.sendTerminationGlobalNotification(group, instance); } }
Source:
public void setLicenses(LicenseConfiguration[] licenses) { }

Target:
public void setLicenses(LicenseConfiguration[] licenses) { this.licenses = (MavenLicenseConfiguration[]) licenses; }
Source:
protected void updateElementsInSessionThread(final IChildrenUpdate update) { IProcesses procService = getServicesTracker().getService(IProcesses.class); final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class); if (procService == null || contDmc == null) { handleFailedUpdate(update); return; } procService.getProcessesBeingDebugged( contDmc, new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update){ @Override public void handleCompleted() { if (!isSuccess() || !(getData() instanceof IExecutionDMContext[])) { handleFailedUpdate(update); return; } IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData(); if (fHideRunningThreadsProperty) { IRunControl runControl = getServicesTracker().getService(IRunControl.class); if (runControl == null) { handleFailedUpdate(update); return; } Vector<IExecutionDMContext> execDmcsNotRunning = new Vector<IExecutionDMContext>(); for (IExecutionDMContext execDmc : execDmcs) { if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) { execDmcsNotRunning.add(execDmc); } } execDmcs = execDmcsNotRunning.toArray(new IExecutionDMContext[execDmcsNotRunning.size()]); } fillUpdateWithVMCs(update, execDmcs); update.done(); } }); }

Target:
protected void updateElementsInSessionThread(final IChildrenUpdate update) { IProcesses procService = getServicesTracker().getService(IProcesses.class); final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class); if (procService == null || contDmc == null) { handleFailedUpdate(update); return; } procService.getProcessesBeingDebugged( contDmc, new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update){ @Override public void handleCompleted() { if (!isSuccess() || !(getData() instanceof IExecutionDMContext[])) { handleFailedUpdate(update); return; } IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData(); if (fHideRunningThreadsProperty) { IRunControl runControl = getServicesTracker().getService(IRunControl.class); if (runControl == null) { handleFailedUpdate(update); return; } List<IExecutionDMContext> execDmcsNotRunning = new ArrayList<IExecutionDMContext>(); for (IExecutionDMContext execDmc : execDmcs) { if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) { execDmcsNotRunning.add(execDmc); } } execDmcs = execDmcsNotRunning.toArray(new IExecutionDMContext[execDmcsNotRunning.size()]); } fillUpdateWithVMCs(update, execDmcs); update.done(); } }); }
Source:
private static List<ExceptionInfo> getThrows(DetailAST ast) { final List<ExceptionInfo> returnValue = new ArrayList<>(); final DetailAST throwsAST = ast .findFirstToken(TokenTypes.LITERAL_THROWS); if (throwsAST != null) { DetailAST exception = throwsAST.getFirstChild(); while (exception != null) { if (exception.getType() == TokenTypes.IDENT || exception.getType() == TokenTypes.DOT) { DetailAST child = exception; final FullIdent ident = FullIdent.createFullIdent(child); while (child.getType() == TokenTypes.DOT) { child = child.getFirstChild(); } final ExceptionInfo exceptionInfo = new ExceptionInfo(child, new ClassInfo(new Token(ident))); returnValue.add(exceptionInfo); } exception = exception.getNextSibling(); } } return returnValue; }

Target:
private static List<ExceptionInfo> getThrows(DetailAST ast) { final List<ExceptionInfo> returnValue = new ArrayList<>(); final DetailAST throwsAST = ast .findFirstToken(TokenTypes.LITERAL_THROWS); if (throwsAST != null) { DetailAST child = throwsAST.getFirstChild(); while (child != null) { if (child.getType() == TokenTypes.IDENT || child.getType() == TokenTypes.DOT) { returnValue.add(getExceptionInfo(child)); } child = child.getNextSibling(); } } return returnValue; }
Source:
private void confirmVerify() { try { StringBuffer message = new StringBuffer(); message.append(getString(R.string.fingerprint_for_you)).append("\n").append(prettyPrintFingerprint(mOtrSession.getLocalFingerprint())).append("\n\n"); message.append(getString(R.string.fingerprint_for_)).append(remoteAddress).append("\n").append(prettyPrintFingerprint(mOtrSession.getRemoteFingerprint())).append("\n\n"); message.append(getString(R.string.are_you_sure_you_want_to_confirm_this_key_)); new AlertDialog.Builder(this).setTitle(R.string.verify_key_).setMessage(message.toString()) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { verifyRemoteFingerprint(); } }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).show(); } catch (Exception e) { LogCleaner.error(ImApp.LOG_TAG, "unable to perform manual key verification", e); } }

Target:
private void confirmVerify() { try { StringBuffer message = new StringBuffer(); message.append(getString(R.string.fingerprint_for_you)).append("\n").append(prettyPrintFingerprint(mOtrSession.getLocalFingerprint())).append("\n\n"); message.append(getString(R.string.fingerprint_for_)).append(remoteAddress).append("\n").append(prettyPrintFingerprint(mOtrSession.getRemoteFingerprint())).append("\n\n"); message.append(getString(R.string.are_you_sure_you_want_to_confirm_this_key_)); new AlertDialog.Builder(this).setTitle(R.string.verify_key_).setMessage(message.toString()) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { verifyRemoteFingerprint(); } }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).show(); } catch (RemoteException e) { LogCleaner.error(ImApp.LOG_TAG, "unable to perform manual key verification", e); } }
Source:
private static byte getByteFromType(ITmfStateValue.Type type) { switch (type) { case NULL: return TYPE_NULL; case INTEGER: return TYPE_INTEGER; case STRING: return TYPE_STRING; case LONG: return TYPE_LONG; case DOUBLE: default: throw new IllegalStateException("Data type not supported"); } }

Target:
private static byte getByteFromType(ITmfStateValue.Type type) { switch (type) { case NULL: return TYPE_NULL; case INTEGER: return TYPE_INTEGER; case STRING: return TYPE_STRING; case LONG: return TYPE_LONG; case DOUBLE: default: throw new IllegalStateException("Data type " + type + " not supported"); } }
Source:
public static void setNetworkVdsmName(Network network) { if (network == null) { return; } String networkName = network.getName(); Guid networkId = network.getId(); if (networkId == null ) { networkId = Guid.newGuid(); } if (networkName.length() > BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH || !networkName.matches("^[0-9a-zA-Z_-]+$")) { network.setVdsmName("on" + networkId.toString() .replaceAll("[^a-zA-Z0-9]+", "") .substring(0, BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH - 2)); } else { network.setVdsmName(networkName); } }

Target:
public static void setNetworkVdsmName(Network network) { if (network == null) { return; } String networkName = network.getName(); Guid networkId = network.getId(); if (networkId == null ) { networkId = Guid.newGuid(); } Matcher vdsmNameMatcher = VALID_VDS_NAME_PATTERN.matcher(networkName); if (networkName.length() > BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH || !vdsmNameMatcher.matches()) { network.setVdsmName("on" + networkId.toString() .replaceAll("[^a-zA-Z0-9]+", "") .substring(0, BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH - 2)); } else { network.setVdsmName(networkName); } }
Source:
public void open() { new Thread(new Runnable() { @Override public void run() { open.set(true); try { startProcess(); } catch (IOException e) { e.printStackTrace(); } } }).start(); }

Target:
public void open() { if (!open.compareAndSet(false, true)) { return; } try { startProcess(); } catch (IOException e) { e.printStackTrace(); } }
Source:
protected void writeRecord(AggregateStateId id, EntityRecord record) { final TypeUrl recordType = TypeUrl.parse(record.getState() .getTypeUrl()); final TypeUrl recordTypeFromId = id.getStateType(); if (!recordTypeFromId.equals(recordType)) { throw newIllegalStateException(TYPE_URL_MISMATCH_MESSAGE_PATTERN, recordType, recordTypeFromId); } recordStorage.write(id, record); }

Target:
protected void writeRecord(AggregateStateId id, EntityRecord record) { final TypeUrl recordType = TypeUrl.parse(record.getState() .getTypeUrl()); final TypeUrl recordTypeFromId = id.getStateType(); checkState(recordTypeFromId.equals(recordType), TYPE_URL_MISMATCH_MESSAGE_PATTERN, recordType, recordTypeFromId); recordStorage.write(id, record); }
Source:
public Page<CommunityRest> findAllTop(Pageable pageable) { List<Community> topCommunities = new ArrayList<Community>(); int total = 0; try { List<Community> it = cs.findAllTop(obtainContext()); total = it.size(); for (Community c : it) { topCommunities.add(c); } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<CommunityRest> page = utils.getPage(topCommunities, pageable).map(converter); return page; }

Target:
public Page<CommunityRest> findAllTop(Pageable pageable) { List<Community> topCommunities = null; try { topCommunities = cs.findAllTop(obtainContext()); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<CommunityRest> page = utils.getPage(topCommunities, pageable).map(converter); return page; }
Source:
public Map getData(){ if (data == null && buffer != null){ try (ByteBufInputStream byteBufInputStream = new ByteBufInputStream(buffer)){ data = MAPPER.readValue((InputStream)byteBufInputStream, Map.class); } catch (IOException e){ throw new RuntimeException("Unable to parse beats payload ", e); } } return data; }

Target:
public Map getData(){ if (data == null && buffer != null){ try (ByteBufInputStream byteBufInputStream = new ByteBufInputStream(buffer)){ data = MAPPER.readValue((InputStream)byteBufInputStream, Map.class); buffer = null; } catch (IOException e){ throw new RuntimeException("Unable to parse beats payload ", e); } } return data; }
Source:
public static <T> boolean equalLists(List<T> one, List<T> two){ if (one == null && two == null){ return true; } if((one == null && two != null) || one != null && two == null || one.size() != two.size()){ return false; } one = new ArrayList<>(one); two = new ArrayList<>(two); return one.containsAll(two) && two.containsAll(one); }

Target:
public static <T> boolean equalLists(List<T> one, List<T> two){ if (one == null && two == null){ return true; } if((one == null && two != null) || one != null && two == null || one.size() != two.size()){ return false; } one = new ArrayList<>(one); two = new ArrayList<>(two); for (T element: one) { boolean exists = false; for (int i = 0; i < two.size(); i++) { if (two.get(i).equals(element)) { exists = true; two.remove(i); break; } } if (!exists) return false; } return true; }
Source:
private static IStatus setAdvancedInfo(AutLaunch launch, ExecutionStatus resultStatus) { AdvancedInformation info = null; try { info = execute(launch); } catch (Exception e) { return RcpttPlugin.createStatus(e); } if (info != null) { resultStatus.setAdvancedInfo(info); } return resultStatus; }

Target:
private static IStatus setAdvancedInfo(AutLaunch launch, ExecutionStatus resultStatus) { AdvancedInformation info = null; try { info = execute(launch); } catch (Exception e) { MultiStatus status = new MultiStatus(Q7LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e); status.add(resultStatus); return status; } if (info != null) { resultStatus.setAdvancedInfo(info); } return resultStatus; }
Source:
public void removeNetworkFromParameters(SetupNetworksParameters params, VdsNetworkInterface nic, Network net) { if (NetworkUtils.isVlan(net)) { VdsNetworkInterface vlan = getVlanDevice(params.getInterfaces(), nic, net); if (vlan == null) { throw new VdcBLLException(VdcBllErrors.NETWORK_LABEL_CONFLICT); } else { params.getInterfaces().remove(vlan); } } }

Target:
public void removeNetworkFromParameters(SetupNetworksParameters params, VdsNetworkInterface nic, Network net) { if (NetworkUtils.isVlan(net)) { VdsNetworkInterface vlan = getVlanDevice(params.getInterfaces(), nic, net); if (vlan == null) { throw new VdcBLLException(VdcBllErrors.NETWORK_LABEL_CONFLICT); } else { params.getInterfaces().remove(vlan); } } else { if (StringUtils.equals(net.getName(), nic.getNetworkName())) { nic.setNetworkName(null); } } }
Source:
public void shouldBuildReviewInput() { Configuration config = ConfigurationBuilder.initFromResource("test.properties"); Review review = ReviewBuilder.buildReview(config); ReviewInput reviewInput = new ReviewInputBuilder(CommentFilter.EMPTY_FILTER).toReviewInput(review); assertThat(reviewInput.message).isEqualTo("Total 8 violations found"); assertThat(reviewInput.comments).hasSize(4); assertThat(reviewInput.comments.get("filename1")).hasSize(2); assertThat(reviewInput.comments.get("filename1").get(0).message).isEqualTo("test1"); assertThat(reviewInput.labels.get("Code-Review")).isEqualTo((short) 1); }

Target:
public void shouldBuildReviewInput() { Configuration config = ConfigurationBuilder.initFromResource("test.properties"); Review review = ReviewBuilder.buildReview(config); ReviewInput reviewInput = new ReviewInputBuilder(commentFilter).toReviewInput(review); assertThat(reviewInput.message).isEqualTo("Total 8 violations found"); assertThat(reviewInput.comments).hasSize(4); assertThat(reviewInput.comments.get("filename1")).hasSize(2); assertThat(reviewInput.comments.get("filename1").get(0).message).isEqualTo("test1"); assertThat(reviewInput.labels.get("Code-Review")).isEqualTo((short) 1); }
Source:
public static Iterable<Object[]> paramFeeder() { final Map<String, Object> map1 = new HashMap<>(); map1.put(DIMS.get(0), ImmutableList.<String>of("dim00", "dim01")); map1.put(DIMS.get(1), "dim10"); final List<String> nullList = new ArrayList<>(); nullList.add(null); final Map<String, Object> map2 = new HashMap<>(); map2.put(DIMS.get(0), nullList); map2.put(DIMS.get(1), "dim10"); final Map<String, Object> map3 = new HashMap<>(); map3.put(DIMS.get(0), ImmutableList.<String>of("dim00", "dim01")); final Map<String, Object> map4 = new HashMap<>(); final Map<String, Object> map5 = new HashMap<>(); map5.put(DIMS.get(1), "dim10"); final Map<String, Object> map6 = new HashMap<>(); map6.put(DIMS.get(1), null); return Iterables.<Object[]>concat( permute(map1) ,permute(map1, map4) ,permute(map1, map5) ,permute(map5, map6) ,permute(map4, map5) ,Iterables.transform(ImmutableList.of(Arrays.asList(map1, map2, map3, map4, map5, map6)), OBJECT_MAKER) ); }

Target:
public static Iterable<Object[]> paramFeeder() { final Map<String, Object> map1 = ImmutableMap.<String, Object>of( DIMS.get(0), ImmutableList.<String>of("dim00", "dim01"), DIMS.get(1), "dim10" ); final List<String> nullList = Collections.singletonList(null); final Map<String, Object> map2 = ImmutableMap.<String, Object>of( DIMS.get(0), nullList, DIMS.get(1), "dim10" ); final Map<String, Object> map3 = ImmutableMap.<String, Object>of( DIMS.get(0), ImmutableList.<String>of("dim00", "dim01") ); final Map<String, Object> map4 = ImmutableMap.<String, Object>of(); final Map<String, Object> map5 = ImmutableMap.<String, Object>of(DIMS.get(1), "dim10"); final Map<String, Object> map6 = new HashMap<>(); map6.put(DIMS.get(1), null); return Iterables.<Object[]>concat( permute(map1) , permute(map1, map4) , permute(map1, map5) , permute(map5, map6) , permute(map4, map5) , Iterables.transform(ImmutableList.of(Arrays.asList(map1, map2, map3, map4, map5, map6)), OBJECT_MAKER) ); }