auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CardPayment(String chargeId, long amount, PaymentState state, String returnUrl, String description, String reference, String email, String paymentProvider, String createdDate, RefundSummary refundSummary, SettlementSummary settlementSummary, CardDetails cardDetails, SupportedLanguage language, boolean delayedCapture, Long corporateCardSurcharge, Long totalAmount, String providerId, ExternalMetadata metadata) { super(chargeId, amount, state, returnUrl, description, reference, email, paymentProvider, createdDate); this.refundSummary = refundSummary; this.settlementSummary = settlementSummary; this.cardDetails = cardDetails; this.providerId = providerId; this.metadata = metadata == null || metadata.getMetadata().isEmpty() ? Optional.empty() : Optional.of(metadata.getMetadata()); this.paymentType = CARD.getFriendlyName(); this.language = language; this.delayedCapture = delayedCapture; this.corporateCardSurcharge = corporateCardSurcharge; this.totalAmount = totalAmount; }

Target:
public CardPayment(String chargeId, long amount, PaymentState state, String returnUrl, String description, String reference, String email, String paymentProvider, String createdDate, RefundSummary refundSummary, SettlementSummary settlementSummary, CardDetails cardDetails, SupportedLanguage language, boolean delayedCapture, Long corporateCardSurcharge, Long totalAmount, String providerId, ExternalMetadata metadata) { super(chargeId, amount, state, returnUrl, description, reference, email, paymentProvider, createdDate); this.refundSummary = refundSummary; this.settlementSummary = settlementSummary; this.cardDetails = cardDetails; this.providerId = providerId; this.metadata = metadata; this.paymentType = CARD.getFriendlyName(); this.language = language; this.delayedCapture = delayedCapture; this.corporateCardSurcharge = corporateCardSurcharge; this.totalAmount = totalAmount; }
Source:
public void addFrame(String obfuscatedMethodName, String clearMethodName, String clearSignature, int obfuscatedLine, int obfuscatedLineEnd, int clearLine) { for (int i = obfuscatedLine; i <= obfuscatedLineEnd; i++) { String key = obfuscatedMethodName + clearSignature + i; mFrames.put(key, new FrameData(clearMethodName, obfuscatedLine - clearLine)); } }

Target:
public void addFrame(String obfuscatedMethodName, String clearMethodName, String clearSignature, int obfuscatedLine, int obfuscatedLineEnd, int clearLine) { String key = obfuscatedMethodName + clearSignature; FrameData data = mFrames.get(key); if (data == null) { data = new FrameData(clearMethodName); } data.lineNumbers.put( obfuscatedLine, new LineNumber(obfuscatedLine, obfuscatedLineEnd, clearLine)); mFrames.put(key, data); }
Source:
void showTree(final Newick newick) { try { DrawableNewick subNewick = new DrawableNewick(newick.getSelectedSubGraph()); subNewick.getNewick().getRoot().getSourcesProperty().addListener(event -> { graphController.updateSelectedSources(subNewick.getNewick().getRoot().getSources()); }); List<DrawableEdge> edgeList = subNewick.edgeSet().stream() .map(edge -> new DrawableEdge(subNewick, edge)) .collect(Collectors.toList()); List<Label> nodeList = subNewick.vertexSet().stream() .map(NewickLabel::new) .collect(Collectors.toList()); newickContainer.getChildren().addAll(edgeList); newickContainer.getChildren().addAll(nodeList); } catch (Exception e) { e.printStackTrace(); } }

Target:
void showTree(final Newick newick) { DrawableNewick subNewick = new DrawableNewick(newick.getSelectedSubGraph()); subNewick.getNewick().getRoot().getSourcesProperty().addListener(event -> { graphController.updateSelectedSources(subNewick.getNewick().getRoot().getSources()); }); List<DrawableEdge> edgeList = subNewick.edgeSet().stream() .map(edge -> new DrawableEdge(subNewick, edge)) .collect(Collectors.toList()); List<Label> nodeList = subNewick.vertexSet().stream() .map(NewickLabel::new) .collect(Collectors.toList()); newickContainer.getChildren().addAll(edgeList); newickContainer.getChildren().addAll(nodeList); }
Source:
protected void executeCommand() { log.info("Executing ScheduleGlusterVolumeSnapshotCommand "); if (!checkAndDisableCliScheduler()) { setSucceeded(false); return; } Time originalExecutionTime = getSchedule().getExecutionTime(); log.info("ScheduleGlusterVolumeSnapshotCommand--------originalExecutionTime {}", originalExecutionTime); try { String jobId = scheduleJob(); setSucceeded(true); getSchedule().setJobId(jobId); getSchedule().setExecutionTime(originalExecutionTime); glusterVolumeSnapshotScheduleDao.save(getSchedule()); } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED, ex.getMessage()); } }

Target:
protected void executeCommand() { log.debug("Executing ScheduleGlusterVolumeSnapshotCommand "); if (!checkAndDisableCliScheduler()) { setSucceeded(false); return; } Time originalExecutionTime = getSchedule().getExecutionTime(); log.debug("ScheduleGlusterVolumeSnapshotCommand--------originalExecutionTime {}", originalExecutionTime); try { Guid jobId = scheduleJob(); setSucceeded(true); getSchedule().setJobId(jobId); getSchedule().setExecutionTime(originalExecutionTime); glusterVolumeSnapshotScheduleDao.save(getSchedule()); } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED, ex.getMessage()); } }
Source:
public Map<String, String> createImageServerContent(String scheme) throws IOException { HashMap<String, String> map = new HashMap<>(); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml", createServerEntry("WikiToDocTaskIntegrationTest1.xml")); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml&gimcontinue=49671%7Cpict1.gif", createServerEntry("WikiToDocTaskIntegrationTest2.xml")); return map; }

Target:
public Map<String, String> createImageServerContent(String scheme) throws IOException { Map<String, String> map = new HashMap<>(); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml", createServerEntry("WikiToDocTaskIntegrationTest1.xml")); map.put(scheme + "://wiki.eclipse.org/api.php?action=query&titles=Some%2FMy_Page&generator=images&prop=imageinfo&iiprop=url&format=xml&gimcontinue=49671%7Cpict1.gif", createServerEntry("WikiToDocTaskIntegrationTest2.xml")); return map; }
Source:
public PeriodicMeterReadsContainer(final PeriodType periodType, final List<PeriodicMeterReads> meterReads) { this.meterReads = Collections.unmodifiableList(meterReads); this.periodType = periodType; }

Target:
public PeriodicMeterReadsContainer(final PeriodType periodType, final List<PeriodicMeterReads> meterReads) { this.meterReads = new ArrayList<PeriodicMeterReads>(meterReads); this.periodType = periodType; }
Source:
public final Response act(final Request req) throws IOException { final Iterable<String> hdit = req.head(); String aliashd = ""; for (final String hdr:hdit) { if (hdr.contains("TkAuth")) { aliashd = this.base.user( URN.create(hdr.replace("TkAuth: ", "") .replaceAll("%3A", ":") ) ).aliases().iterate().iterator().next().name(); } } return new RsWithHeader( this.take.act(req), String.format(this.header, aliashd) ); }

Target:
public final Response act(final Request req) throws IOException { return new RsWithHeader( this.take.act(req), String.format( "X-Netbout-Alias: %s", new RqAlias(this.base, req).alias().name() ) ); }
Source:
public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj != null && obj.getClass() == InternalContainerResource.class) { InternalContainerResource that = (InternalContainerResource) obj; return Objects.equals(this.memory, that.memory) && Objects.equals(this.vcores, that.vcores); } return false; }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj instanceof InternalContainerResource) { final InternalContainerResource other = (InternalContainerResource) obj; return this.memory == other.memory && this.vcores == other.vcores; } return false; }
Source:
public AvailabilityType getAvailability() { ReadAttribute op = new ReadAttribute(getAddress(), "cache-status"); Result res = getASConnection().execute(op); if (res != null && res.isSuccess()) { if (res.getResult().equals("RUNNING")) { return AvailabilityType.UP; } } return AvailabilityType.DOWN; }

Target:
public AvailabilityType getAvailability() { ReadAttribute op = new ReadAttribute(getAddress(), "cache-status"); Result res = getASConnection().execute(op); if (res != null && res.isSuccess()) { if ("RUNNING".equals(res.getResult())) { return AvailabilityType.UP; } } return AvailabilityType.DOWN; }
Source:
public void testSquash() throws Exception { new Git(db).commit().setMessage("initial commit").call(); new Git(db).branchCreate().setName("side").call(); writeTrashFile("file1", "content1"); new Git(db).add().addFilepattern("file1").call(); new Git(db).commit().setMessage("file1 commit").call(); writeTrashFile("file2", "content2"); new Git(db).add().addFilepattern("file2").call(); new Git(db).commit().setMessage("file2 commit").call(); new Git(db).checkout().setName("side").call(); writeTrashFile("side", "content"); new Git(db).add().addFilepattern("side").call(); new Git(db).commit().setMessage("side commit").call(); assertArrayEquals( new String[] { "Squash commit -- not updating HEAD", "Automatic merge went well; stopped before committing as requested", "" }, execute("git merge master --squash")); }

Target:
public void testSquash() throws Exception { git.branchCreate().setName("side").call(); writeTrashFile("file1", "content1"); git.add().addFilepattern("file1").call(); git.commit().setMessage("file1 commit").call(); writeTrashFile("file2", "content2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("file2 commit").call(); git.checkout().setName("side").call(); writeTrashFile("side", "content"); git.add().addFilepattern("side").call(); git.commit().setMessage("side commit").call(); assertArrayEquals( new String[] { "Squash commit -- not updating HEAD", "Automatic merge went well; stopped before committing as requested", "" }, execute("git merge master --squash")); }
Source:
protected boolean processInteract(PlayerEntity player, Hand hand) { if (!this.world.isRemote() && isLord(player) && minionData != null) { ItemStack heldItem = player.getHeldItem(hand); if (heldItem.getItem() instanceof MinionUpgradeItem) { int upgradeLevel = ((MinionUpgradeItem) heldItem.getItem()).getLevel(); if (this.minionData.level < upgradeLevel) { this.minionData.level++; if (!player.abilities.isCreativeMode) heldItem.shrink(1); player.sendStatusMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_upgrade"), false); player.sendStatusMessage(new TranslationTextComponent("text.vampirism.minion.upgraded"), true); HelperLib.sync(this); } else { player.sendMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_wrong")); } return true; } } return super.processInteract(player, hand); }

Target:
protected boolean processInteract(PlayerEntity player, Hand hand) { if (!this.world.isRemote() && isLord(player) && minionData != null) { ItemStack heldItem = player.getHeldItem(hand); if (heldItem.getItem() instanceof MinionUpgradeItem && ((MinionUpgradeItem) heldItem.getItem()).getFaction() == this.getFaction()) { if (this.minionData.level + 1 >= ((MinionUpgradeItem) heldItem.getItem()).getMinLevel() && this.minionData.level + 1 <= ((MinionUpgradeItem) heldItem.getItem()).getMaxLevel()) { this.minionData.level++; if (!player.abilities.isCreativeMode) heldItem.shrink(1); player.sendStatusMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_upgrade"), false); HelperLib.sync(this); } else { player.sendMessage(new TranslationTextComponent("text.vampirism.hunter_minion.equipment_wrong")); } return true; } } return super.processInteract(player, hand); }
Source:
public List<AnviltopServices.MutateRowResponse> delete(List<Delete> deletes) throws IOException { List<AnviltopServices.MutateRowResponse> responses; try { responses = Futures.allAsList(issueDeleteRequests(deletes)).get(); } catch (ExecutionException | InterruptedException e) { throw new IOException("Error in batch put", e); } return responses; }

Target:
public List<AnviltopServices.MutateRowResponse> delete(List<Delete> deletes) throws IOException { List<AnviltopServices.MutateRowResponse> responses; try { responses = Futures.allAsList(issueDeleteRequests(deletes)).get(); } catch (ExecutionException | InterruptedException e) { throw new IOException("Error in batch delete", e); } return responses; }
Source:
public void deleteDraft() throws Exception { PushOneCommit.Result r = createChange(); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput.CommentInput comment = newCommentInfo( "file1", Comment.Side.REVISION, 1, "comment 1"); CommentInfo returned = addDraft(changeId, revId, comment); deleteDraft(changeId, revId, returned.id); Map<String, List<CommentInfo>> drafts = getDraftComments(changeId, revId); assertThat(drafts.isEmpty()).isTrue(); }

Target:
public void deleteDraft() throws Exception { PushOneCommit.Result r = createChange(); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput.CommentInput comment = newCommentInfo( "file1", Comment.Side.REVISION, 1, "comment 1"); CommentInfo returned = addDraft(changeId, revId, comment); deleteDraft(changeId, revId, returned.id); Map<String, List<CommentInfo>> drafts = getDraftComments(changeId, revId); assertThat(drafts).isEmpty(); }
Source:
private static boolean validNodeFor( Node pNode, Diagram pGraph ) { for( Node node : pGraph.getNodePrototypes() ) { if( pNode.getClass() == node.getClass() || pNode.getClass() == PointNode.class ) { return true; } } return false; }

Target:
private static boolean validNodeFor( Node pNode, Diagram pGraph ) { if ( pNode.getClass() == PointNode.class ) { return true; } for( Node node : pGraph.getNodePrototypes() ) { if( pNode.getClass() == node.getClass() ) { return true; } } return false; }
Source:
private void doConcurrentDestroyInTx() throws Exception { for (int i = 0; i < totalNumberOfBuckets; i++) { synchronized (list) { list.add(i); } } Thread[] threads = new Thread[totalNumberOfBuckets]; for (int i = 0; i < totalNumberOfBuckets; i++) { threads[i] = new Thread(this::doDestroyOpInTx); } for (int i = 0; i < totalNumberOfBuckets; i++) { threads[i].start(); } for (int i = 0; i < totalNumberOfBuckets; i++) { threads[i].join(); } }

Target:
private void doConcurrentDestroyInTx() throws Exception { for (int i = 0; i < totalNumberOfBuckets; i++) { queue.add(i); } ExecutorService pool = Executors.newCachedThreadPool(); Collection<Callable<Object>> tasks = new ArrayList<>(); Callable<Object> task = () -> { doDestroyOpInTx(); return null; }; for (int i = 0; i < totalNumberOfBuckets; i++) { tasks.add(task); } List<Future<Object>> futures = pool.invokeAll(tasks); for (Future future : futures) { future.get(); } }
Source:
public void test() { List<Command<?>> commands = new ArrayList<Command<?>>(); Person person = new Person("PAUL"); ListHolder listHolder = new ListHolder(); List<String> list = new ArrayList<String>(); list.add("eins"); list.add("zwei"); list.add("drei"); listHolder.setList(list); commands.add(KieServices.Factory.get().getCommands().newInsert(person)); commands.add(KieServices.Factory.get().getCommands().newInsert(listHolder)); commands.add(KieServices.Factory.get().getCommands().newFireAllRules()); session.execute(KieServices.Factory.get().getCommands().newBatchExecution(commands, null)); Assertions.assertThat(firedRules.isRuleFired("PERSON_PAUL")).isTrue(); Assertions.assertThat(firedRules.isRuleFired("PERSON_PETER")).isTrue(); }

Target:
public void test() { session.setGlobal("LOGGER", LOGGER); List<Command<?>> commands = new ArrayList<Command<?>>(); Person person = new Person("PAUL"); ListHolder listHolder = new ListHolder(); List<String> list = Arrays.asList("eins", "zwei", "drei"); listHolder.setList(list); commands.add(getCommands().newInsert(person)); commands.add(getCommands().newInsert(listHolder)); commands.add(getCommands().newFireAllRules()); session.execute(getCommands().newBatchExecution(commands, null)); Assertions.assertThat(firedRules.isRuleFired("PERSON_PAUL")).isTrue(); Assertions.assertThat(firedRules.isRuleFired("PERSON_PETER")).isTrue(); }
Source:
public GwtInput (CanvasElement canvas, GwtApplicationConfiguration config) { this.canvas = canvas; this.config = config; if (config.useAccelerometer) { if (GwtApplication.agentInfo().isFirefox()) setupAccelerometer(); else GwtPermissions.queryPermission(GwtAccelerometer.PERMISSION, new GwtPermissions.GwtPermissionResult() { @Override public void granted() { setupAccelerometer(); } @Override public void denied() { } @Override public void prompt() { setupAccelerometer(); } }); } hookEvents(); }

Target:
public GwtInput (CanvasElement canvas, GwtApplicationConfiguration config) { this.canvas = canvas; this.config = config; if (config.useAccelerometer) { if (GwtApplication.agentInfo().isFirefox()) { setupAccelerometer(); } else { GwtPermissions.queryPermission(GwtAccelerometer.PERMISSION, new GwtPermissions.GwtPermissionResult() { @Override public void granted() { setupAccelerometer(); } @Override public void denied() { } @Override public void prompt() { setupAccelerometer(); } }); } } hookEvents(); }
Source:
public void shutdownContainer(String containerId) throws NoSuchContainerException { Container container = this.containerRepository.findOne(containerId); if (container != null) { String containerHost = container.getAttributes().getIp(); String containerPort = container.getAttributes().get(ContainerAttributes.PORT_KEY); RestTemplate restTemplate = new RestTemplate(new SimpleClientHttpRequestFactory()); restTemplate.postForObject(CONTAINER_HOST_URI_PROTOCOL + containerHost + ":" + containerPort + managementContextPath + SHUTDOWN_ENDPOINT, Object.class, Object.class); } else { throw new NoSuchContainerException("Container could not be found with id " + containerId); } }

Target:
public void shutdownContainer(String containerId) throws NoSuchContainerException, ContainerShutdownException { Container container = this.containerRepository.findOne(containerId); if (container != null) { String containerHost = container.getAttributes().getIp(); String containerManagementPort = container.getAttributes().getManagementPort(); RestTemplate restTemplate = new RestTemplate(new SimpleClientHttpRequestFactory()); try { restTemplate.postForObject(CONTAINER_HOST_URI_PROTOCOL + containerHost + ":" + containerManagementPort + managementContextPath + SHUTDOWN_ENDPOINT, Object.class, Object.class); } catch (RestClientException e) { throw new ContainerShutdownException(e.getMessage()); } } else { throw new NoSuchContainerException("Container could not be found with id " + containerId); } }
Source:
protected boolean checkArgumentTypeCardinality(final Expression argument, @Nullable final SequenceType argType, final int argPosition) throws XPathException { boolean cardinalityMatches = argument instanceof VariableReference || argType.getCardinality() == Cardinality.ZERO_OR_MORE; if (!cardinalityMatches) { cardinalityMatches = argument.getCardinality().isSubCardinalityOrEqualOf(argType.getCardinality()); if (!cardinalityMatches) { if (argument.getCardinality() == Cardinality.EMPTY_SEQUENCE && argType.getCardinality().atLeastOne()) { throw new XPathException(this, ErrorCodes.XPTY0004, Messages.getMessage(Error.FUNC_EMPTY_SEQ_DISALLOWED, argPosition, ExpressionDumper.dump(argument))); } } } return cardinalityMatches; }

Target:
protected boolean checkArgumentTypeCardinality(final Expression argument, @Nullable final SequenceType argType, final int argPosition) throws XPathException { boolean cardinalityMatches = argument instanceof VariableReference || argType.getCardinality() == Cardinality.ZERO_OR_MORE; if (!cardinalityMatches) { cardinalityMatches = argument.getCardinality().isSubCardinalityOrEqualOf(argType.getCardinality()); } if (!cardinalityMatches) { if (argument.getCardinality() == Cardinality.EMPTY_SEQUENCE && argType.getCardinality().atLeastOne()) { throw new XPathException(this, ErrorCodes.XPTY0004, Messages.getMessage(Error.FUNC_EMPTY_SEQ_DISALLOWED, argPosition, ExpressionDumper.dump(argument))); } } return cardinalityMatches; }
Source:
public static void verifyNotContains(LiveSearchResults<String> results, List<Pair<String, String>> values) { values.forEach(value -> assertFalse("Expected value <" + value.getK1() + ", " + value.getK2() + "> is present in results but wasn't expected", results.stream() .filter(entry -> value.getK1().equals(entry.getKey()) && value.getK2().equals(entry.getValue())) .findFirst() .isPresent())); }

Target:
public static void verifyNotContains(LiveSearchResults<String> results, List<Pair<String, String>> values) { values.forEach(value -> assertFalse("Expected value <" + value.getK1() + ", " + value.getK2() + "> is present in results but wasn't expected", results.stream() .anyMatch(entry -> value.getK1().equals(entry.getKey()) && value.getK2().equals(entry.getValue())))); }
Source:
protected List<SimpleObject> getEncounterListAsJson(User user, ParseEncounterToJson parseEncounterToJson, VisitDomainWrapper visitWrapper, User authenticatedUser, int encounterIndex, int encounterCount) { List<Encounter> sortedEncounters = safeSubList(visitWrapper.getSortedEncounters(), encounterIndex, encounterCount + encounterIndex); List<SimpleObject> encounterJson = new ArrayList<SimpleObject>(); for (Encounter encounter : sortedEncounters) { if (encounter.getEncounterType() != null) { if (encounter.getEncounterType().getViewPrivilege() != null) { if (user.getPrivileges().contains(encounter.getEncounterType().getViewPrivilege()) || user.isSuperUser()) { encounterJson.add(parseEncounterToJson.createEncounterJSON(authenticatedUser, encounter)); } } else { encounterJson.add(parseEncounterToJson.createEncounterJSON(authenticatedUser, encounter)); } } else { encounterJson.add(parseEncounterToJson.createEncounterJSON(authenticatedUser, encounter)); } } return encounterJson; }

Target:
protected List<SimpleObject> getEncounterListAsJson(User user, ParseEncounterToJson parseEncounterToJson, VisitDomainWrapper visitWrapper, User authenticatedUser, int encounterIndex, int encounterCount) { List<Encounter> sortedEncounters = safeSubList(visitWrapper.getSortedEncounters(), encounterIndex, encounterCount + encounterIndex); List<SimpleObject> encounterJson = new ArrayList<SimpleObject>(); for (Encounter encounter : sortedEncounters) { boolean addEncounter = false; if (encounter.getEncounterType() != null) { if (encounter.getEncounterType().getViewPrivilege() != null) { if (user.getPrivileges().contains(encounter.getEncounterType().getViewPrivilege()) || user.isSuperUser()) { addEncounter = true; } } else { addEncounter = true; } } else { addEncounter = true; } if(addEncounter){ encounterJson.add(parseEncounterToJson.createEncounterJSON(authenticatedUser, encounter)); } } return encounterJson; }
Source:
public OpenBuilder newOpenLedgerOp() { return new OpenBuilder() { long ledgerId; byte[] password; org.apache.bookkeeper.client.api.DigestType digestType; @Override public OpenBuilder withLedgerId(long ledgerId) { this.ledgerId = ledgerId; return this; } @Override public OpenBuilder withRecovery(boolean recovery) { return this; } @Override public OpenBuilder withPassword(byte[] password) { this.password = password; return this; } @Override public OpenBuilder withDigestType(org.apache.bookkeeper.client.api.DigestType digestType) { this.digestType = digestType; return this; } @Override public CompletableFuture<ReadHandle> execute() { CompletableFuture<ReadHandle> promise = new CompletableFuture<ReadHandle>(); if (getProgrammedFailStatus()) { if (failReturnCode != BkTimeoutOperation) { promise.completeExceptionally(BKException.create(failReturnCode)); } return promise; } else if (stopped.get()) { promise.completeExceptionally(BKException.create(BKException.Code.WriteException)); return promise; } MockLedgerHandle lh = ledgers.get(ledgerId); if (lh == null) { promise.completeExceptionally(BKException.create(BKException.Code.NoSuchLedgerExistsException)); } else if (lh.digest != DigestType.fromApiDigestType(digestType)) { promise.completeExceptionally(BKException.create(BKException.Code.DigestMatchException)); } else if (!Arrays.equals(lh.passwd, password)) { promise.completeExceptionally(BKException.create(BKException.Code.UnauthorizedAccessException)); } else { promise.complete(new MockReadHandle(MockBookKeeper.this, ledgerId, lh.getLedgerMetadata(), lh.entries)); } return promise; } }; }

Target:
public OpenBuilder newOpenLedgerOp() { return new OpenBuilderBase() { @Override public CompletableFuture<ReadHandle> execute() { CompletableFuture<ReadHandle> promise = new CompletableFuture<ReadHandle>(); if (!validate()) { promise.completeExceptionally(new BKException.BKNoSuchLedgerExistsException()); return promise; } else if (getProgrammedFailStatus()) { if (failReturnCode != BkTimeoutOperation) { promise.completeExceptionally(BKException.create(failReturnCode)); } return promise; } else if (stopped.get()) { promise.completeExceptionally(new BKException.BKClientClosedException()); return promise; } MockLedgerHandle lh = ledgers.get(ledgerId); if (lh == null) { promise.completeExceptionally(new BKException.BKNoSuchLedgerExistsException()); } else if (lh.digest != DigestType.fromApiDigestType(digestType)) { promise.completeExceptionally(new BKException.BKDigestMatchException()); } else if (!Arrays.equals(lh.passwd, password)) { promise.completeExceptionally(new BKException.BKUnauthorizedAccessException()); } else { promise.complete(new MockReadHandle(MockBookKeeper.this, ledgerId, lh.getLedgerMetadata(), lh.entries)); } return promise; } }; }
Source:
public void doFilter(ServletRequest baseRequest, ServletResponse baseResponse, FilterChain chain) throws IOException, ServletException { try { super.doFilter(baseRequest, baseResponse, chain); } catch (ServletException e) { SecurityContextRepository repo = new HttpSessionSecurityContextRepository(); HttpServletRequest baseHttpRequest = (HttpServletRequest) baseRequest; HttpRequestResponseHolder holder = new HttpRequestResponseHolder(baseHttpRequest, (HttpServletResponse) baseResponse); SecurityContext securityContext = repo.loadContext(holder); if (securityContext.getAuthentication() == null) { baseHttpRequest.setAttribute("sessionTimeout", true); failureHandler.onAuthenticationFailure((HttpServletRequest) baseRequest, (HttpServletResponse) baseResponse, new AuthenticationException("Session Time Out") { private static final long serialVersionUID = 1L; }); } else { String previousLocation = baseHttpRequest.getHeader("referer"); HttpServletResponse response = (HttpServletResponse) baseResponse; response.sendRedirect(previousLocation); } } }

Target:
public void doFilter(ServletRequest baseRequest, ServletResponse baseResponse, FilterChain chain) throws IOException, ServletException { try { super.doFilter(baseRequest, baseResponse, chain); } catch (ServletException e) { if (e.getCause() instanceof ServiceException) { HttpServletRequest baseHttpRequest = (HttpServletRequest) baseRequest; if (SecurityContextHolder.getContext().getAuthentication() == null) { baseHttpRequest.setAttribute("sessionTimeout", true); failureHandler.onAuthenticationFailure((HttpServletRequest) baseRequest, (HttpServletResponse) baseResponse, new SessionAuthenticationException("Session Time Out")); } } else { throw e; } } }
Source:
public static <T> void set(T obj, String fieldName, Object value) { try { Field f1 = obj.getClass().getDeclaredField(fieldName); AccessController.doPrivileged(new PrivilegedAction<T>() { @Override public T run() { f1.setAccessible(true); return null; } }); f1.set(obj, value); } catch (NoSuchFieldException | IllegalAccessException e) { throw LOGGER.logExceptionAsError(new RuntimeException(e)); } }

Target:
public static <T> void set(T obj, String fieldName, Object value) { try { Field field = obj.getClass().getDeclaredField(fieldName); if (!field.isAccessible()) { AccessController.doPrivileged(new PrivilegedAction<T>() { @Override public T run() { field.setAccessible(true); return null; } }); } field.set(obj, value); } catch (NoSuchFieldException | IllegalAccessException e) { throw LOGGER.logExceptionAsError(new RuntimeException(e)); } }
Source:
public SfMenuBehavior(String selector, Options options, Boolean verticalSfMenu) { super(selector, METHOD, options); this.add(new CssResourceReference(SfMenuBehavior.class, "css/superfish.css")); if(verticalSfMenu) { this.add(new CssResourceReference(SfMenuBehavior.class, "css/superfish-vertical.css")); } this.add(new JavaScriptResourceReference(SfMenuBehavior.class, "js/hoverIntent.js")); this.add(new JavaScriptResourceReference(SfMenuBehavior.class, "js/superfish.min.js")); }

Target:
public SfMenuBehavior(String selector, Options options, Boolean verticalSfMenu) { super(selector, METHOD, options); ISuperfishLibrarySettings settings = getLibrarySettings(); if(settings.getSuperfishStyleSheetReference() != null) { this.add(settings.getSuperfishStyleSheetReference()); } if(verticalSfMenu && settings.getSuperfishVerticalStyleSheetReference() != null) { this.add(settings.getSuperfishVerticalStyleSheetReference()); } this.add(HoverIntentJavaScriptResourceReference.get()); this.add(SuperfishJavaScriptResourceReference.get()); }
Source:
private WindowState<WV> applyFoldFunction(WindowState<WV> existingState, M message) { WV wv; long earliesttimestamp; if (existingState == null) { wv = window.getInitializer().get(); earliesttimestamp = clock.currentTimeMillis(); } else { wv = existingState.getWindowValue(); earliesttimestamp = existingState.getEarliestRecvTime(); } WV newVal = window.getFoldFunction().apply(message, wv); WindowState<WV> newState = new WindowState(newVal, earliesttimestamp); return newState; }

Target:
private WindowState<WV> applyFoldFunction(WindowState<WV> existingState, M message) { WV wv; long earliestTimestamp; if (existingState == null) { LOG.trace("No existing state found for key"); wv = window.getInitializer().get(); earliestTimestamp = clock.currentTimeMillis(); } else { wv = existingState.getWindowValue(); earliestTimestamp = existingState.getEarliestTimestamp(); } WV newVal = window.getFoldLeftFunction().apply(message, wv); WindowState<WV> newState = new WindowState(newVal, earliestTimestamp); return newState; }
Source:
public void enter() { mUseEap = (IkeSessionOptions.IKE_AUTH_METHOD_EAP == mIkeSessionOptions.getLocalAuthConfig().mAuthMethod); super.enter(); }

Target:
public void enter() { super.enter(); mUseEap = (IkeSessionOptions.IKE_AUTH_METHOD_EAP == mIkeSessionOptions.getLocalAuthConfig().mAuthMethod); }
Source:
private static boolean shouldCheckWhitespaceAfter(DetailAST ast) { boolean checkWhitespace = true; if (ast.getNextSibling() != null) { final DetailAST sibling = ast.getNextSibling(); if (sibling.getType() == TokenTypes.ANNOTATIONS) { checkWhitespace = false; } else if (sibling.getType() == TokenTypes.ARRAY_DECLARATOR) { checkWhitespace = sibling.getFirstChild().getType() != TokenTypes.ANNOTATIONS; } } return checkWhitespace; }

Target:
private static boolean shouldCheckWhitespaceAfter(DetailAST ast) { boolean checkWhitespace = true; final DetailAST sibling = ast.getNextSibling(); if (sibling != null) { if (sibling.getType() == TokenTypes.ANNOTATIONS) { checkWhitespace = false; } else if (sibling.getType() == TokenTypes.ARRAY_DECLARATOR) { checkWhitespace = sibling.getFirstChild().getType() != TokenTypes.ANNOTATIONS; } } return checkWhitespace; }
Source:
public List<? extends ICompletionProposal> getCompletionProposals(String path, JsonNode data, String prefix,int documentOffset) { final JsonNode definition = schema.getDefinitionForPath(path); final Set<JsonNode> proposals = createProposals(data, definition); final List<ICompletionProposal> result = new ArrayList<>(); prefix = Strings.emptyToNull(prefix); Styler typeStyler = new StyledString.Styler() { @Override public void applyStyles(TextStyle textStyle) { textStyle.foreground = new Color(Display.getCurrent(), new RGB(120, 120, 120)); } }; for (JsonNode proposal: proposals) { String value = proposal.get("value").asText(); String label = proposal.get("label").asText(); String type = proposal.has("type") ? proposal.get("type").asText() : null; StyledString styledString = new StyledString(label); if (type != null) { styledString .append(": ", typeStyler) .append(type, typeStyler); } if (prefix != null) { if (value.startsWith(prefix)) { value = value.substring(prefix.length(), value.length()); result.add(new StyledCompletionProposal(value, styledString, documentOffset, 0, value.length())); } } else { result.add(new StyledCompletionProposal(value, styledString, documentOffset, 0, value.length())); } } return result; }

Target:
public List<? extends ICompletionProposal> getCompletionProposals(String path, JsonNode data, String prefix,int documentOffset) { final JsonNode definition = schema.getDefinitionForPath(path); final Set<JsonNode> proposals = createProposals(data, definition); final List<ICompletionProposal> result = new ArrayList<>(); prefix = Strings.emptyToNull(prefix); for (JsonNode proposal: proposals) { String value = proposal.get("value").asText(); String label = proposal.get("label").asText(); String type = proposal.has("type") ? proposal.get("type").asText() : null; StyledString styledString = new StyledString(label); if (type != null) { styledString .append(": ", typeStyler) .append(type, typeStyler); } if (prefix != null) { if (value.startsWith(prefix)) { value = value.substring(prefix.length(), value.length()); result.add(new StyledCompletionProposal(value, styledString, documentOffset, 0, value.length())); } } else { result.add(new StyledCompletionProposal(value, styledString, documentOffset, 0, value.length())); } } return result; }
Source:
public void testCorruptedRegionManifest() throws IOException { SnapshotTestingUtils.SnapshotMock snapshotMock = new SnapshotTestingUtils.SnapshotMock(TEST_UTIL.getConfiguration(), fs, rootDir); SnapshotTestingUtils.SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2( SNAPSHOT_NAME_STR, TABLE_NAME_STR); builder.addRegionV2(); builder.corruptOneRegionManifest(); long period = Long.MAX_VALUE; SnapshotFileCache cache = new SnapshotFileCache(fs, rootDir, period, 10000000, "test-snapshot-file-cache-refresh", new SnapshotFiles()); try { cache.getSnapshotsInProgress(); } finally { fs.delete(SnapshotDescriptionUtils.getWorkingSnapshotDir(rootDir, TEST_UTIL.getConfiguration()), true); } }

Target:
public void testCorruptedRegionManifest() throws IOException { SnapshotTestingUtils.SnapshotMock snapshotMock = new SnapshotTestingUtils.SnapshotMock(conf, fs, rootDir); SnapshotTestingUtils.SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2( SNAPSHOT_NAME_STR, TABLE_NAME_STR); builder.addRegionV2(); builder.corruptOneRegionManifest(); long period = Long.MAX_VALUE; SnapshotFileCache cache = new SnapshotFileCache(conf, period, 10000000, "test-snapshot-file-cache-refresh", new SnapshotFiles()); try { cache.getSnapshotsInProgress(); } finally { fs.delete(SnapshotDescriptionUtils.getWorkingSnapshotDir(rootDir, conf), true); } }
Source:
public void testBuilder() throws Exception { final TableLayoutDesc layoutDesc = KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE); final KijiTableLayout layout = new KijiTableLayout(layoutDesc, null); final EntityIdFactory eidFactory = EntityIdFactory.create(layoutDesc.getKeysFormat()); final EntityId id1 = eidFactory.fromKijiRowKey("row1"); final EntityId id2 = eidFactory.fromKijiRowKey("row2"); final Map<String, Kiji> environment = new EnvironmentBuilder() .withInstance("inst1") .withTable("table", layout) .withRow(id1) .withFamily("family") .withQualifier("column").withValue(2, "foo1") .withQualifier("column").withValue(1, "foo2") .withRow(id2) .withFamily("family") .withQualifier("column").withValue(100, "foo3") .build(); final KijiTable table = environment.get("inst1").openTable("table"); final KijiTableReader reader = table.openTableReader(); final KijiRowData row1 = reader.get(id1, new KijiDataRequest() .addColumn(new KijiDataRequest.Column("family", "column"))); assertEquals("foo2", row1.getValue("family", "column", 1).toString()); final KijiRowData row2 = reader.get(id2, new KijiDataRequest() .addColumn(new KijiDataRequest.Column("family", "column"))); assertEquals("foo3", row2.getValue("family", "column", 100).toString()); }

Target:
public void testBuilder() throws Exception { final KijiTableLayout layout = new KijiTableLayout(KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE), null); final Map<String, Kiji> environment = new EnvironmentBuilder() .withInstance("inst1") .withTable("table", layout) .withRow("row1") .withFamily("family") .withQualifier("column").withValue(1, "foo1") .withValue(2, "foo2") .withRow("row2") .withFamily("family") .withQualifier("column").withValue(100, "foo3") .build(); final KijiTable table = environment.get("inst1").openTable("table"); final KijiTableReader reader = table.openTableReader(); final KijiRowData row1 = reader.get(table.getEntityId("row1"), new KijiDataRequest() .addColumn(new KijiDataRequest.Column("family", "column"))); assertEquals("foo2", row1.getValue("family", "column", 2).toString()); final KijiRowData row2 = reader.get(table.getEntityId("row2"), new KijiDataRequest() .addColumn(new KijiDataRequest.Column("family", "column"))); assertEquals("foo3", row2.getValue("family", "column", 100).toString()); IOUtils.closeQuietly(reader); IOUtils.closeQuietly(table); IOUtils.closeQuietly(environment.get("inst1")); }
Source:
public NewLineSeparator getNewLineSeparator() { String newline = get(JabRefPreferences.NEWLINE); if ("\r".equals(newline)) { return NewLineSeparator.CR; } else if ("\n".equals(newline)) { return NewLineSeparator.LF; } else { return NewLineSeparator.CRLF; } }

Target:
public NewLineSeparator getNewLineSeparator() { return NewLineSeparator.parse(get(JabRefPreferences.NEWLINE)); }
Source:
private void fillDefaults(Map<String, Object> argMap) { for(ParserArgument arg : arguments.values()) { if (!argMap.containsKey(arg.getName())) { if (arg.getDefaultValue() != null) { argMap.put( arg.getName(), Util.getObjectValueByString(arg.getConvert(), arg.getDefaultValue()) ); } } } }

Target:
private void fillDefaults(Map<String, Object> argMap) { for(ParserArgument arg : arguments.values()) { if (!argMap.containsKey(arg.getName()) && arg.getDefaultValue() != null) { putValue( argMap, arg, Util.getObjectValueByString(arg.getConvert(), arg.getDefaultValue()) ); } } }
Source:
protected AbstractTestIntegrationSmokeTest(QueryRunnerSupplier supplier) { super(supplier, FeatureSelection.all()); }

Target:
protected AbstractTestIntegrationSmokeTest(QueryRunnerSupplier supplier) { super(supplier); }
Source:
public AbstractDiskVmCommand(T parameters) { super(parameters); if (parameters.getDiskInfo() != null && DiskStorageType.IMAGE == parameters.getDiskInfo().getDiskStorageType()) { setQuotaId(((DiskImage) parameters.getDiskInfo()).getQuotaId()); } if (parameters.getStoragePoolId() != null && !parameters.getStoragePoolId().equals(Guid.Empty)) { setStoragePoolId(parameters.getStoragePoolId()); } else if (getVm() != null) { setStoragePoolId(getVm().getstorage_pool_id()); } }

Target:
public AbstractDiskVmCommand(T parameters) { super(parameters); if (parameters.getDiskInfo() != null && DiskStorageType.IMAGE == parameters.getDiskInfo().getDiskStorageType()) { setQuotaId(((DiskImage) parameters.getDiskInfo()).getQuotaId()); } else if (getVm() != null) { setStoragePoolId(getVm().getstorage_pool_id()); } }
Source:
public void cipherCanEncodeWithGivenKey() { String expectedOutput = "abcdefghij"; assertEquals(expectedOutput, cipherWithSetKey.encode("aaaaaaaaaa")); }

Target:
public void cipherCanEncodeWithGivenKey() { String cipherText = "abcdefghij"; assertEquals(cipherText, cipherWithSetKey.encode("aaaaaaaaaa")); }
Source:
public void run() throws Exception { HadoopConfigurationInjector.prepareResourcesToInject(getJobProps(), getWorkingDirectory()); File tokenFile = null; if (shouldProxy && obtainTokens) { userToProxy = getJobProps().getString(USER_TO_PROXY); getLog().info("Need to proxy. Getting tokens."); Props props = new Props(); props.putAll(getJobProps()); props.putAll(getSysProps()); tokenFile = getHadoopTokens(props); getJobProps().put("env." + HADOOP_TOKEN_FILE_LOCATION, tokenFile.getAbsolutePath()); } try { super.run(); } catch (Exception e) { e.printStackTrace(); getLog().error("caught exception running the job"); throw new Exception(e); } catch (Throwable t) { t.printStackTrace(); getLog().error("caught error running the job"); throw new Exception(t); } finally { if (tokenFile != null) { cancelHadoopTokens(tokenFile); if (tokenFile.exists()) { tokenFile.delete(); } } } }

Target:
public void run() throws Exception { HadoopConfigurationInjector.prepareResourcesToInject(getJobProps(), getWorkingDirectory()); File tokenFile = null; if (shouldProxy && obtainTokens) { userToProxy = getJobProps().getString(USER_TO_PROXY); getLog().info("Need to proxy. Getting tokens."); Props props = new Props(); props.putAll(getJobProps()); props.putAll(getSysProps()); tokenFile = HadoopJobUtils.getHadoopTokens(hadoopSecurityManager, props, getLog()); getJobProps().put("env." + HADOOP_TOKEN_FILE_LOCATION, tokenFile.getAbsolutePath()); } try { super.run(); } catch (Throwable t) { t.printStackTrace(); getLog().error("caught error running the job"); throw new Exception(t); } finally { if (tokenFile != null) { HadoopJobUtils.cancelHadoopTokens(hadoopSecurityManager, userToProxy, tokenFile, getLog()); if (tokenFile.exists()) { tokenFile.delete(); } } } }
Source:
protected boolean makeFileFromResourceFile(String fileName, String postFix) { String resourceFileName = fileName + postFix; File dbDir = new File(absolutePathOfStorageDir); if (!dbDir.exists() && !dbDir.mkdir()) log.warn("make dir failed.\ndbDir=" + dbDir.getAbsolutePath()); File destinationFile = new File(Paths.get(absolutePathOfStorageDir, fileName).toString()); if (!destinationFile.exists()) { try { log.info("We copy resource to file: resourceFileName={}, destinationFile={}", resourceFileName, destinationFile); FileUtil.resourceToFile(resourceFileName, destinationFile); return true; } catch (ResourceNotFoundException e) { log.info("Could not find resourceFile " + resourceFileName + ". That is expected if none is provided yet."); } catch (Throwable e) { log.error("Could not copy resourceFile " + resourceFileName + " to " + destinationFile.getAbsolutePath() + ".\n" + e.getMessage()); e.printStackTrace(); } } else { log.info("No resource file have been copied. exists already.", fileName); } return false; }

Target:
protected boolean makeFileFromResourceFile(String fileName, String postFix) { String resourceFileName = fileName + postFix; File dbDir = new File(absolutePathOfStorageDir); if (!dbDir.exists() && !dbDir.mkdir()) log.warn("make dir failed.\ndbDir=" + dbDir.getAbsolutePath()); File destinationFile = new File(Paths.get(absolutePathOfStorageDir, fileName).toString()); if (!destinationFile.exists()) { try { log.info("We copy resource to file: resourceFileName={}, destinationFile={}", resourceFileName, destinationFile); FileUtil.resourceToFile(resourceFileName, destinationFile); return true; } catch (ResourceNotFoundException e) { log.info("Could not find resourceFile " + resourceFileName + ". That is expected if none is provided yet."); } catch (Throwable e) { log.error("Could not copy resourceFile " + resourceFileName + " to " + destinationFile.getAbsolutePath() + ".\n" + e.getMessage()); e.printStackTrace(); } } else { log.info("No resource file was copied. exists already.", fileName); } return false; }
Source:
public Invocation toInvocation() { if (method == null) { if (argTypes == null) { argTypes = new LinkedList<Class<?>>(); for (Object arg : args) { if (arg == null) { argTypes.add(Object.class); } else { argTypes.add(arg.getClass()); } } } try { method = IMethods.class.getMethod(methodName, argTypes.toArray(new Class[argTypes.size()])); } catch (Exception e) { throw new RuntimeException("builder only creates invocations of IMethods interface", e); } } Invocation i = new InvocationImpl(mock, new SerializableMethod(method), args, sequenceNumber, new RealMethod() { @Override public Object invoke(Object target, Object[] arguments) throws Throwable { AccessibilityChanger accessibilityChanger = new AccessibilityChanger(); try { accessibilityChanger.enableAccess(method); return method.invoke(target, arguments); } finally { accessibilityChanger.safelyDisableAccess(method); } } }, location == null ? new LocationImpl() : location); if (verified) { i.markVerified(); } return i; }

Target:
public Invocation toInvocation() { if (method == null) { if (argTypes == null) { argTypes = new LinkedList<Class<?>>(); for (Object arg : args) { if (arg == null) { argTypes.add(Object.class); } else { argTypes.add(arg.getClass()); } } } try { method = IMethods.class.getMethod(methodName, argTypes.toArray(new Class[argTypes.size()])); } catch (Exception e) { throw new RuntimeException("builder only creates invocations of IMethods interface", e); } } Invocation i = new InvocationImpl(mock, new SerializableMethod(method), args, sequenceNumber, toDumbRealMethod(), location == null ? new LocationImpl() : location); if (verified) { i.markVerified(); } return i; }
Source:
public ResourceRequest process(ResourceRequest input) throws PluginExecutionException, StopProcessingException { Object subjectObj = input.getPropertyValue(SecurityConstants.SECURITY_SUBJECT); if (subjectObj instanceof Subject) { String username = SubjectUtils.getName((Subject) subjectObj); String msg = "User [" + username + "] is attempting to retrieve resource [" + input .getAttributeValue() + "] by [" + input.getAttributeName() + "]."; SecurityLogger.logInfo(msg); } return input; }

Target:
public ResourceRequest process(ResourceRequest input) throws PluginExecutionException, StopProcessingException { if (input != null) { Object subjectObj = input.getPropertyValue(SecurityConstants.SECURITY_SUBJECT); if (subjectObj instanceof Subject) { String username = SubjectUtils.getName((Subject) subjectObj); String msg = "User [" + username + "] is attempting to retrieve resource [" + input .getAttributeValue() + "] by [" + input.getAttributeName() + "]."; SecurityLogger.logInfo(msg); } } return input; }
Source:
public Optional<Object> select(GenericRecord record) { Object current = record; Iterator<String> iter = path.iterator(); while (iter.hasNext()) { String selector = iter.next(); current = ((GenericRecord) current).get(selector); if (!(current instanceof GenericRecord)) { break; } } return iter.hasNext() ? empty() : Optional.ofNullable(current); }

Target:
private Optional<Object> select(GenericRecord record) { Object current = record; Iterator<String> iter = path.iterator(); while (iter.hasNext()) { String selector = iter.next(); current = ((GenericRecord) current).get(selector); if (!(current instanceof GenericRecord)) { break; } } return iter.hasNext() ? empty() : Optional.ofNullable(current); }
Source:
public void testDefaultAesCipherParams() throws InvalidParametersException { String msg1 = "AAAAAA"; String msg2 = "AAAAAAAAAABBBBBBBBBBCCCCCCCCCCCC"; String msg3 = "AAAAAAAAAABBBBBBBBBBCCCCCCCCCCCCAAAAAAAAAABBBBBBBBBBCCCCCCCCCCCC"; String expectedCiphertext; String actualCiphertext; String[] inputMsg = {msg1, msg2, msg3}; for (String msg : inputMsg) { actualCiphertext = encryptWithoutSpecifyingAlgorithmParams(msg); expectedCiphertext = StringHelper.encrypt(msg); assertEquals(actualCiphertext, expectedCiphertext); } }

Target:
public void testDefaultAesCipherParams() throws Exception { String plaintextLength124 = StringHelper.generateStringOfLength(31, 'A'); assertEncryptionUsesExpectedDefaultParams(plaintextLength124); String plaintextLength128 = StringHelper.generateStringOfLength(32, 'A'); assertEncryptionUsesExpectedDefaultParams(plaintextLength128); String plaintextLength132 = StringHelper.generateStringOfLength(33, 'A'); assertEncryptionUsesExpectedDefaultParams(plaintextLength132); }