auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PurgeUpToDatePopup(FormSummary formSummary) { super(); this.summary = formSummary; confirm = new AggregateButton(BUTTON_TXT, TOOLTIP_TXT, HELP_BALLOON_TXT); confirm.addClickHandler(new PurgeHandler()); confirm.setEnabled(false); picker = new DatePicker(); picker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if ( selectedDate != null ) { picker.removeStyleFromDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } selectedDate = event.getValue(); if ( selectedDate != null ) { picker.addTransientStyleToDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } confirm.setEnabled(selectedDate != null); }}); FlexTable layout = new FlexTable(); layout.setWidget(0, 0, new HTML(new SafeHtmlBuilder() .appendEscaped("Purge submissions data for:") .appendHtmlConstant("<br/>") .appendHtmlConstant("<b>" + summary.getTitle() + " [" + summary.getId() + "]</b>") .appendHtmlConstant("<br>") .appendEscaped("up to the chosen GMT date.") .appendHtmlConstant("<br>") .appendEscaped("Incomplete submissions will") .appendHtmlConstant("<br>") .appendEscaped("not be deleted.") .toSafeHtml())); layout.setWidget(0, 1, picker); layout.setWidget(0, 2, confirm); layout.setWidget(0, 3, new ClosePopupButton(this)); setWidget(layout); }

Target:
public PurgeUpToDatePopup(FormSummary formSummary) { super(); this.summary = formSummary; confirm = new AggregateButton(BUTTON_TXT, TOOLTIP_TXT, HELP_BALLOON_TXT); confirm.addClickHandler(new PurgeHandler()); confirm.setEnabled(false); picker = new DatePicker(); picker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if ( selectedDate != null ) { picker.removeStyleFromDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } selectedDate = event.getValue(); if ( selectedDate != null ) { picker.addTransientStyleToDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } confirm.setEnabled(selectedDate != null); }}); FlexTable layout = new FlexTable(); layout.setWidget(0, 0, new HTML(new SafeHtmlBuilder() .appendEscaped("Purge submissions data for:") .appendHtmlConstant("<br/>") .appendHtmlConstant("<b>" + formSummary.getTitle() + " [" + formSummary.getId() + "]</b>") .appendHtmlConstant("<br>") .appendEscaped("up to the chosen GMT date.") .appendHtmlConstant("<br>") .appendEscaped("Incomplete submissions will") .appendHtmlConstant("<br>") .appendEscaped("not be deleted.") .toSafeHtml())); layout.setWidget(0, 1, picker); layout.setWidget(0, 2, confirm); layout.setWidget(0, 3, new ClosePopupButton(this)); setWidget(layout); }
Source:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public ContentResolver getContentResolver() { MockContentProvider mcp = new MockContentProvider(mContext) { @Override public Bundle call(String method, String request, Bundle args) { return new Bundle(); } }; MockContentResolver mockContentResolver = new MockContentResolver(); mockContentResolver.addProvider(Settings.AUTHORITY, mcp); return mockContentResolver; }

Target:
public ContentResolver getContentResolver() { MockContentProvider mockContentProvider = new MockContentProvider(mContext) { @Override public Bundle call(String method, String request, Bundle args) { return new Bundle(); } }; MockContentResolver mockContentResolver = new MockContentResolver(); mockContentResolver.addProvider(Settings.AUTHORITY, mockContentProvider); return mockContentResolver; }
Source:
public void theResponseDataHasValues(final Map<String, String> settings) throws Throwable { final String correlationUid = settings.get(PlatformKeys.KEY_CORRELATION_UID); final short expectedNumberOfNotificationsSent = Short .parseShort(settings.get(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT)); final String expectedMessageType = settings.get(PlatformKeys.KEY_MESSAGE_TYPE); try { this.assertResponseDataHasNotificationsAndMessageType(correlationUid, expectedNumberOfNotificationsSent, expectedMessageType); } catch (final AssertionError e) { Thread.sleep(500); this.assertResponseDataHasNotificationsAndMessageType(correlationUid, expectedNumberOfNotificationsSent, expectedMessageType); } }

Target:
public void theResponseDataHasValues(final Map<String, String> settings) throws Throwable { final String correlationUid = settings.get(PlatformKeys.KEY_CORRELATION_UID); final short expectedNumberOfNotificationsSent = Short .parseShort(settings.get(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT)); final String expectedMessageType = settings.get(PlatformKeys.KEY_MESSAGE_TYPE); RetryableAssert.assertWithRetries(() -> ResponseDataSteps.this.assertResponseDataHasNotificationsAndMessageType( correlationUid, expectedNumberOfNotificationsSent, expectedMessageType), 3, 200, TimeUnit.MILLISECONDS); }
Source:
public void testGetCommunicationSummaryStatisticsServiceNameMissingURI() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setOperation("op1"); ct1.setBusinessTransaction("testapp"); ct1.getProperties().add(new Property("prop", "val")); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertEquals("wildfly", communicationSummaryStatistics.getServiceName()); }

Target:
public void testGetCommunicationSummaryStatisticsServiceNameMissingURI() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setOperation("op1"); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertEquals("wildfly", communicationSummaryStatistics.getServiceName()); }
Source:
public void remoteCallsElidedIfTalkingToLocalServer() throws IOException, InterruptedException { doAnswer(invocation -> { PingableLeader localPingableLeader = invocation.getArgumentAt(0, PingableLeader.class); availableServer.stubFor(LEADER_UUID_MAPPING.willReturn(aResponse() .withStatus(200) .withBody(("\"" + localPingableLeader.getUUID().toString() + "\"").getBytes()))); return null; }).when(environment).register(isA(PingableLeader.class)); when(config.leader()).thenReturn(Optional.of(ImmutableLeaderConfig.builder() .localServer(getUriForPort(availablePort)) .addLeaders(getUriForPort(availablePort)) .acceptorLogDir(temporaryFolder.newFolder()) .learnerLogDir(temporaryFolder.newFolder()) .quorumSize(1) .build())); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = TransactionManagers.createLockAndTimestampServices( config, environment, LockServiceImpl::create, InMemoryTimestampService::new, invalidator, USER_AGENT); availableServer.verify(getRequestedFor(urlMatching(LEADER_UUID_PATH))); lockAndTimestampServices.timestamp().getFreshTimestamp(); lockAndTimestampServices.lock().currentTimeMillis(); availableServer.verify(0, postRequestedFor(urlMatching(TIMESTAMP_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); availableServer.verify(0, postRequestedFor(urlMatching(LOCK_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); }

Target:
public void remoteCallsElidedIfTalkingToLocalServer() throws IOException, InterruptedException { doAnswer(invocation -> { PingableLeader localPingableLeader = invocation.getArgumentAt(0, PingableLeader.class); availableServer.stubFor(LEADER_UUID_MAPPING.willReturn(aResponse() .withStatus(200) .withBody(("\"" + localPingableLeader.getUUID().toString() + "\"").getBytes()))); return null; }).when(environment).register(isA(PingableLeader.class)); when(config.leader()).thenReturn(Optional.of(ImmutableLeaderConfig.builder() .localServer(getUriForPort(availablePort)) .addLeaders(getUriForPort(availablePort)) .acceptorLogDir(temporaryFolder.newFolder()) .learnerLogDir(temporaryFolder.newFolder()) .quorumSize(1) .build())); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = TransactionManagers.createLockAndTimestampServices( config, environment, LockServiceImpl::create, InMemoryTimestampService::new, invalidator, USER_AGENT); availableServer.verify(getRequestedFor(urlMatching(LEADER_UUID_PATH))); lockAndTimestampServices.timelock().getFreshTimestamp(); lockAndTimestampServices.lock().currentTimeMillis(); availableServer.verify(0, postRequestedFor(urlMatching(TIMESTAMP_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); availableServer.verify(0, postRequestedFor(urlMatching(LOCK_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); }
Source:
public JsonElement serialize(JsonSerializationContext context) { JsonObject serialized = context.serialize(comment).getAsJsonObject(); serialized.remove("userProfileID"); Long userProfileID = comment.getUserProfileID(); serialized.add("userProfileID", context.serialize(userProfileID != null ? String.valueOf(userProfileID) : null)); serialized.remove("articleID"); normalizeField(serialized, "title"); normalizeField(serialized, "body"); normalizeField(serialized, "highlightedText"); serialized.remove("competingInterestBody"); serialized.add("competingInterestStatement", context.serialize(competingInterestStatement)); serialized.add("parentArticle", context.serialize(parentArticle)); serialized.add("replyTreeSize", context.serialize(replyTreeSize)); serialized.add("mostRecentActivity", context.serialize(mostRecentActivity)); serialized.add("replies", context.serialize(replies)); return serialized; }

Target:
public JsonElement serialize(JsonSerializationContext context) { JsonObject serialized = context.serialize(comment).getAsJsonObject(); serialized.remove("userProfileID"); Long userProfileID = comment.getUserProfileID(); if (userProfileID == null) { throw new NullPointerException(); } HashMap<String, Object> creator = new HashMap<>(); creator.put("userId", String.valueOf(userProfileID)); serialized.add("creator", context.serialize(creator)); serialized.remove("articleID"); normalizeField(serialized, "title"); normalizeField(serialized, "body"); normalizeField(serialized, "highlightedText"); serialized.remove("competingInterestBody"); serialized.add("competingInterestStatement", context.serialize(competingInterestStatement)); serialized.add("parentArticle", context.serialize(parentArticle)); serialized.add("replyTreeSize", context.serialize(replyTreeSize)); serialized.add("mostRecentActivity", context.serialize(mostRecentActivity)); serialized.add("replies", context.serialize(replies)); return serialized; }
Source:
public boolean doesCurrentUserHaveAccessToAllOfDevelopersListings(Long developerId, List<CertificationStatusType> listingStatuses) { List<CertifiedProductDetailsDTO> cpDtos = certifiedProductDAO.findByDeveloperId(developerId); for (CertifiedProductDetailsDTO cpDto : cpDtos) { if (isInStatuses(cpDto.getCertificationStatusName(), listingStatuses) && !isAcbValidForCurrentUser(cpDto.getCertificationBodyId())) { return false; } } return true; }

Target:
public boolean doesCurrentUserHaveAccessToAllOfDevelopersListings(Long developerId, List<CertificationStatusType> listingStatuses) { List<CertifiedProductDetailsDTO> cpDtos = certifiedProductDAO.findByDeveloperId(developerId); return !cpDtos.stream().filter(cpDto -> !isAcbValidForCurrentUser(cpDto.getCertificationBodyId()) && isInStatuses(cpDto.getCertificationStatusName(), listingStatuses)).findAny().isPresent(); }
Source:
protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); em.getTransaction().begin(); try { String findJobErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.jobId in (select req.id from RequestInfo req where status in (:status))"; errorsToAck = em.createQuery(findJobErrorsQuery) .setParameter("type", JobExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(STATUS.DONE, STATUS.CANCELLED, STATUS.QUEUED)) .getResultList(); em.getTransaction().commit(); } catch (Exception e) { logger.error("Execution error in command ProcessAutoAckErrorCommand", e); em.getTransaction().rollback(); } return errorsToAck; }

Target:
protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); TransactionManager txm = TransactionManagerFactory.get().newTransactionManager(); boolean txOwner = txm.begin(); try { String findJobErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.jobId in (select req.id from RequestInfo req where status in (:status))"; errorsToAck = em.createQuery(findJobErrorsQuery, ExecutionErrorInfo.class) .setParameter("type", JobExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(STATUS.DONE, STATUS.CANCELLED, STATUS.QUEUED)) .getResultList(); txm.commit(txOwner); } catch (Exception e) { logger.error("Execution error in command ProcessAutoAckErrorCommand", e); txm.rollback(txOwner); } return errorsToAck; }
Source:
public S checkOut(ServiceEndPoint endPoint) throws Exception { checkNotNull(endPoint); _requestCount.incrementAndGet(); long currentRevision = _revisionNumber.get(); try { S service = _pool.borrowObject(endPoint); ServiceEndPointInstancePair pair = new ServiceEndPointInstancePair(endPoint, service); _checkOutCounts.add(pair); _checkOutRevisions.putIfAbsent(pair, currentRevision); return service; } catch (NoSuchElementException e) { _missCount.incrementAndGet(); throw new NoCachedInstancesAvailableException(); } }

Target:
public ServiceHandle<S> checkOut(ServiceEndPoint endPoint) throws Exception { checkNotNull(endPoint); _requestCount.incrementAndGet(); try { long revision = _revisionNumber.incrementAndGet(); S service = _pool.borrowObject(endPoint); ServiceHandle<S> handle = new ServiceHandle<S>(service, endPoint); _checkedOutRevisions.put(handle, revision); return handle; } catch (NoSuchElementException e) { _missCount.incrementAndGet(); throw new NoCachedInstancesAvailableException(); } }
Source:
public void onResume() { BottomBar.hideBottomBar(getActivity()); super.onResume(); adapter.notifyDataSetChanged(); }

Target:
public void onResume() { super.onResume(); adapter.notifyDataSetChanged(); }
Source:
public IStatus run(IProgressMonitor mymonitor) { PullResult pullResult = null; try (Git git = new Git(repository)) { PullCommand pull = git.pull(); SubMonitor monitor = SubMonitor.convert(mymonitor, 4); pull.setProgressMonitor(new EclipseGitProgressTransformer( mymonitor)); pull.setTimeout(timeout); pull.setCredentialsProvider(credentialsProvider); if (config != null) { if (config.getRemote() != null) { pull.setRemote(config.getRemote()); } if (config.getReference() != null) { pull.setRemoteBranchName(config.getReference()); } pull.setRebase(config.getUpstreamConfig()); } MergeStrategy strategy = Activator.getDefault() .getPreferredMergeStrategy(); if (strategy != null) { pull.setStrategy(strategy); } pullResult = pull.call(); monitor.worked(3); synchronized (results) { results.put(repository, pullResult); } IProject[] projects = ProjectUtil .getValidOpenProjects(repository); ProjectUtil.refreshValidProjects(projects, mymonitor); monitor.worked(1); return Status.OK_STATUS; } catch (DetachedHeadException e) { return Activator.error( CoreText.PullOperation_DetachedHeadMessage, e); } catch (InvalidConfigurationException e) { return Activator .error(CoreText.PullOperation_PullNotConfiguredMessage, e); } catch (GitAPIException | CoreException e) { return Activator.error(e.getMessage(), e); } catch (JGitInternalException e) { Throwable cause = e.getCause(); if (cause == null || !(cause instanceof TransportException)) cause = e; return Activator.error(cause.getMessage(), cause); } }

Target:
public IStatus run(IProgressMonitor mymonitor) { PullResult pullResult = null; try (Git git = new Git(repository)) { PullCommand pull = git.pull(); SubMonitor monitor = SubMonitor.convert(mymonitor, 4); pull.setProgressMonitor(new EclipseGitProgressTransformer( monitor)); monitor.newChild(3); pull.setTimeout(timeout); pull.setCredentialsProvider(credentialsProvider); if (config != null) { if (config.getRemote() != null) { pull.setRemote(config.getRemote()); } if (config.getReference() != null) { pull.setRemoteBranchName(config.getReference()); } pull.setRebase(config.getUpstreamConfig()); } MergeStrategy strategy = Activator.getDefault() .getPreferredMergeStrategy(); if (strategy != null) { pull.setStrategy(strategy); } pullResult = pull.call(); synchronized (results) { results.put(repository, pullResult); } IProject[] projects = ProjectUtil .getValidOpenProjects(repository); if (refreshNeeded(pullResult)) { ProjectUtil.refreshValidProjects(projects, monitor); } monitor.newChild(1); return Status.OK_STATUS; } catch (DetachedHeadException e) { return Activator.error( CoreText.PullOperation_DetachedHeadMessage, e); } catch (InvalidConfigurationException e) { return Activator .error(CoreText.PullOperation_PullNotConfiguredMessage, e); } catch (GitAPIException | CoreException e) { return Activator.error(e.getMessage(), e); } catch (JGitInternalException e) { Throwable cause = e.getCause(); if (cause == null || !(cause instanceof TransportException)) cause = e; return Activator.error(cause.getMessage(), cause); } finally { mymonitor.done(); } }
Source:
protected void addSearchFilter(final ActiveFilterItem filter, final ColumnFilter columnFilter) { ((CoreFunctionFilter)columnFilter).setLabelValue(filter.getLabelValue()); basicFilterAddEvent.fire(new BasicFilterAddEvent(getDataSetId(), filter, columnFilter)); }

Target:
protected void addSearchFilter(final ActiveFilterItem filter, final ColumnFilter columnFilter) { if (columnFilter instanceof CoreFunctionFilter) { ((CoreFunctionFilter) columnFilter).setLabelValue(filter.getLabelValue()); } basicFilterAddEvent.fire(new BasicFilterAddEvent(getDataSetId(), filter, columnFilter)); }
Source:
public void addHeaderLineTo(@Nonnull VCFHeader header) { }

Target:
public void addHeaderLineTo(@Nonnull VCFHeader header) { throw new UnsupportedOperationException("github/gatk-protected issue #855"); }
Source:
public void priceMoneyness() { double expiry = OPTION_ERU2.getExpirationTime(); EuropeanVanillaOption option = new EuropeanVanillaOption(STRIKE, expiry, IS_CALL); double priceFuture = METHOD_FUTURES.price(ERU2, MULTICURVES); double volatility = NORMAL_PARAMETERS_MONEYNESS.getZValue(expiry, STRIKE); NormalFunctionData dataNormal = new NormalFunctionData(priceFuture, 1.0, volatility); double priceExpected = NORMAL_FUNCTION.getPriceFunction(option).evaluate(dataNormal); double priceComputed = METHOD_SECURITY_OPTION_NORMAL.price(OPTION_ERU2, NORMAL_MULTICURVES_MONEYNESS); assertEquals("Future option with volatilities: option security price", priceExpected, priceComputed, TOLERANCE_PRICE); }

Target:
public void priceMoneyness() { double expiry = OPTION_ERU2.getExpirationTime(); EuropeanVanillaOption option = new EuropeanVanillaOption(STRIKE, expiry, IS_CALL); double priceFuture = METHOD_FUTURES.price(ERU2, MULTICURVES); double volatility = NORMAL_PARAMETERS_MONEYNESS.getZValue(expiry, priceFuture - STRIKE); NormalFunctionData dataNormal = new NormalFunctionData(priceFuture, 1.0, volatility); double priceExpected = NORMAL_FUNCTION.getPriceFunction(option).evaluate(dataNormal); double priceComputed = METHOD_SECURITY_OPTION_NORMAL.price(OPTION_ERU2, NORMAL_MULTICURVES_MONEYNESS); assertEquals("Future option with volatilities: option security price", priceExpected, priceComputed, TOLERANCE_PRICE); }
Source:
public void shouldBeCaseInSensitiveOfColumnAndPropertyNames() throws Exception { when(resultSetMetaData.getColumnCount()).thenReturn(1); when(resultSetMetaData.getColumnLabel(1)).thenReturn("LoNgfielD"); Long aLongVal = 100L; when(resultSet.getLong(1)).thenReturn(aLongVal); when(resultSet.wasNull()).thenReturn(false); SampleBean sampleBean = mapper.map(resultSet, ctx); assertThat(sampleBean.getLongField()).isNotNull(); }

Target:
public void shouldBeCaseInSensitiveOfColumnAndPropertyNames() throws Exception { when(resultSetMetaData.getColumnCount()).thenReturn(1); when(resultSetMetaData.getColumnLabel(1)).thenReturn("LoNgfielD"); Long aLongVal = 100L; when(resultSet.getLong(1)).thenReturn(aLongVal); when(resultSet.wasNull()).thenReturn(false); SampleBean sampleBean = mapper.map(resultSet, ctx); assertThat(sampleBean.getLongField()).isEqualTo(aLongVal); }
Source:
private void commitDelete(AsyncFileEntry entry, boolean success) { LOGGER.debug("commitDelete({},{}): Starting...", entry.getName(), success); if (success) { entry.getParent().ifPresent(e -> e.removeChild(entry)); entry.destroy(); } removeFromProcessors(entry); }

Target:
private void commitDelete(AsyncFileEntry entry, boolean success) { LOGGER.debug("commitDelete({},{}): Starting...", entry.getName(), success); if (success) { entry.getParent().ifPresent(e -> e.removeChild(entry)); entry.destroy(); } onFinish(); }
Source:
public void httpHeadersAreSetProperly() { onRequest() .havingMethodEqualTo("GET") .havingHeader(HEADER_NAME, hasItem(HEADER_VALUE)) .havingPathEqualTo(Warehouses.URI) .respond() .withBody(readFromResource("/warehouse/warehouses.json")) .withStatus(200); final GoodDataSettings settings = new GoodDataSettings(); settings.setHttpHeader(HEADER_NAME, HEADER_VALUE); final GoodData goodData = new GoodData("localhost", LOGIN, PASS, port(), "http", settings){ @Override protected HttpClient createHttpClient(final String login, final String password, final String hostname, final int port, final String protocol, final HttpClientBuilder builder) { return builder.build(); } }; goodData.getWarehouseService().listWarehouses(); }

Target:
public void httpHeadersAreSetProperly() { onRequest() .havingMethodEqualTo("GET") .havingHeader(HEADER_NAME, hasItem(HEADER_VALUE)) .havingPathEqualTo(Warehouses.URI) .respond() .withBody(readFromResource("/warehouse/warehouses.json")) .withStatus(200); final GoodDataSettings settings = new GoodDataSettings(); settings.setHttpHeader(HEADER_NAME, HEADER_VALUE); final GoodData goodData = new GoodData("localhost", LOGIN, PASS, port(), "http", settings){ @Override protected HttpClient createHttpClient(final String login, final String password, final String hostname, final int port, final String protocol, final HttpClientBuilder builder) { return builder.build(); } }; final PageableList<Warehouse> warehouses = goodData.getWarehouseService().listWarehouses(); assertTrue(warehouses.size() > 0); }
Source:
private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException { TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( nonNullRepo().getDirectory(), 10 << 20); try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); try (InputStream in = buf.openInputStream()) { return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); } } finally { buf.destroy(); } }

Target:
private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException { File dir; if (db != null) { dir = nonNullRepo().getWorkTree(); } else { dir = null; } TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( dir, 10 << 20); try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); try (InputStream in = buf.openInputStream()) { return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); } } finally { buf.destroy(); } }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final VelocityEngine engine = new VelocityEngine(); engine.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute"); try { engine.init(); } catch (Exception e) { log.log(Level.SEVERE, "Could not initialize velocity", e); } Template t = null; try { t = engine.getTemplate("CurrentUser.vm"); } catch (Exception e) { log.log(Level.SEVERE, "Could not get the template `CurrentUser`", e); return; } final VelocityContext context = new VelocityContext(); final UserDao uDao = new UserDao(); final com.google.appengine.api.users.User currentGoogleUser = UserServiceFactory .getUserService().getCurrentUser(); if (currentGoogleUser == null) { return; } final String currentUserEmail = currentGoogleUser.getEmail().toLowerCase(); final User currentUser = uDao.findUserByEmail(currentUserEmail); context.put("user", currentUser); context.put("permissions", getPermissionsMap(currentUser)); final StringWriter writer = new StringWriter(); t.merge(context, writer); resp.setContentType("application/javascript;charset=UTF-8"); final PrintWriter pw = resp.getWriter(); pw.println(writer.toString()); pw.close(); }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final com.google.appengine.api.users.User currentGoogleUser = UserServiceFactory .getUserService().getCurrentUser(); if (currentGoogleUser == null) { return; } final VelocityEngine engine = new VelocityEngine(); engine.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute"); try { engine.init(); } catch (Exception e) { log.log(Level.SEVERE, "Could not initialize velocity", e); } Template t = null; try { t = engine.getTemplate("CurrentUser.vm"); } catch (Exception e) { log.log(Level.SEVERE, "Could not get the template `CurrentUser`", e); return; } final VelocityContext context = new VelocityContext(); final UserDao uDao = new UserDao(); final String currentUserEmail = currentGoogleUser.getEmail().toLowerCase(); final User currentUser = uDao.findUserByEmail(currentUserEmail); context.put("user", currentUser); context.put("permissions", getPermissionsMap(currentUser)); final StringWriter writer = new StringWriter(); t.merge(context, writer); resp.setContentType("application/javascript;charset=UTF-8"); final PrintWriter pw = resp.getWriter(); pw.println(writer.toString()); pw.close(); }
Source:
private OVirtNodeInfo() { final String delimiter = ":"; final String[] path = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); final String regexISO[] = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix).split(delimiter); final String regexNode[] = Config.<String> GetValue(ConfigValues.OvirtNodeOS).split(delimiter); info = new LinkedList<Entry>(); log.debugFormat("NodeInfo: regexISO length {0} minimum length {1} path length {2} regexNode {3}", regexISO.length, minimumVersion.length, path.length, regexNode.length); if (regexISO.length != minimumVersion.length || regexISO.length != path.length || regexISO.length != regexNode.length) { throw new IllegalArgumentException("Illegal NodeInfo - length"); } for (int i=0; i < regexISO.length; i++) { log.debugFormat("NodeInfo: regexISO {0} path {1}, minimumVersion {2} regexNode {3}", regexISO[i], path[i], minimumVersion[i], regexNode[i]); Entry entry = new Entry(); entry.isoPattern = Pattern.compile(regexISO[i]); entry.osPattern = Pattern.compile(regexNode[i], Pattern.CASE_INSENSITIVE); entry.path = new File(path[i]); entry.minimumVersion = minimumVersion[i]; info.add(entry); } }

Target:
private OVirtNodeInfo() { final String[] path = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String minimumVersion[] = Config.<String> getValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); final String regexISO[] = Config.<String> getValue(ConfigValues.OvirtIsoPrefix).split(delimiter); final String regexNode[] = Config.<String> getValue(ConfigValues.OvirtNodeOS).split(delimiter); info = new LinkedList<Entry>(); log.debugFormat("NodeInfo: regexISO length {0} minimum length {1} path length {2} regexNode {3}", regexISO.length, minimumVersion.length, path.length, regexNode.length); if (regexISO.length != minimumVersion.length || regexISO.length != path.length || regexISO.length != regexNode.length) { throw new IllegalArgumentException("Illegal NodeInfo - length"); } for (int i=0; i < regexISO.length; i++) { log.debugFormat("NodeInfo: regexISO {0} path {1}, minimumVersion {2} regexNode {3}", regexISO[i], path[i], minimumVersion[i], regexNode[i]); Entry entry = new Entry(); entry.isoPattern = Pattern.compile(regexISO[i]); entry.osPattern = Pattern.compile(regexNode[i], Pattern.CASE_INSENSITIVE); entry.path = new File(path[i]); entry.minimumVersion = minimumVersion[i]; info.add(entry); } }
Source:
private static void adjustChainingStrategy(StreamNode node) { StreamOperatorFactory<?> operatorFactory = node.getOperatorFactory(); ChainingStrategy currentChainingStrategy = operatorFactory.getChainingStrategy(); switch (currentChainingStrategy) { case ALWAYS: case HEAD_WITH_SOURCES: LOG.debug( "Setting chaining strategy for an operator {}, because of the BATCH execution mode.", node); operatorFactory.setChainingStrategy(ChainingStrategy.HEAD); break; case NEVER: case HEAD: break; } }

Target:
private static void adjustChainingStrategy(StreamNode node) { StreamOperatorFactory<?> operatorFactory = node.getOperatorFactory(); ChainingStrategy currentChainingStrategy = operatorFactory.getChainingStrategy(); switch (currentChainingStrategy) { case ALWAYS: case HEAD_WITH_SOURCES: LOG.debug( "Setting chaining strategy to HEAD for operator {}, because of the BATCH execution mode.", node); operatorFactory.setChainingStrategy(ChainingStrategy.HEAD); break; case NEVER: case HEAD: break; } }
Source:
public void addSlf4jLogMessageConsumer( BiConsumer<String, Slf4jLogMessageContext> slf4jLogMessageConsumer) { addLogMessageConsumer(logMessage -> { slf4jLogMessageConsumer.accept(logMessage, parseSlf4jContextFromLogMessage(logMessage)); }); }

Target:
public void addSlf4jLogMessageConsumer(BiConsumer<String, Slf4jLogMessageContext> slf4jLogMessageConsumer) { checkNotNull(slf4jLogMessageConsumer, "slf4jLogMessageConsumer parameter is NULL!"); addLogMessageConsumer(logMessage -> { slf4jLogMessageConsumer.accept(logMessage, parseSlf4jContextFromLogMessage(logMessage)); }); }
Source:
public void visitSpec(SpecInfo spec) { Unroll unroll = spec.getAnnotation(Unroll.class); boolean unrollSpec = unroll != null; boolean rollupSpec = spec.getAnnotation(Rollup.class) != null; if (unrollSpec && rollupSpec) { throw new InvalidSpecException("@Unroll and @Rollup must not be used on the same spec: " + spec.getName()); } boolean doUnrollSpec; String specUnrollPattern; if (unrollSpec) { doUnrollSpec = true; specUnrollPattern = unroll.value(); } else if (rollupSpec) { doUnrollSpec = false; specUnrollPattern = ""; } else { doUnrollSpec = unrollConfiguration.enabledByDefault; specUnrollPattern = ""; } spec .getFeatures() .stream() .filter(FeatureInfo::isParameterized) .forEach(feature -> visitFeature(feature, doUnrollSpec, specUnrollPattern)); }

Target:
public void visitSpec(SpecInfo spec) { Unroll unroll = spec.getAnnotation(Unroll.class); boolean unrollSpec = unroll != null; boolean rollupSpec = spec.getAnnotation(Rollup.class) != null; if (unrollSpec && rollupSpec) { throw new InvalidSpecException("@Unroll and @Rollup must not be used on the same spec: " + spec.getName()); } boolean doUnrollSpec; String specUnrollPattern; if (unrollSpec) { doUnrollSpec = true; specUnrollPattern = unroll.value(); } else if (rollupSpec) { doUnrollSpec = false; specUnrollPattern = ""; } else { doUnrollSpec = unrollConfiguration.unrollByDefault; specUnrollPattern = ""; } spec .getFeatures() .stream() .filter(FeatureInfo::isParameterized) .forEach(feature -> visitFeature(feature, doUnrollSpec, specUnrollPattern)); SpecInfo superSpec = spec.getSuperSpec(); if (superSpec != null) { visitSpec(superSpec); } }
Source:
public static long hashCode(@SqlType(GEOMETRY_TYPE_NAME) Slice slice) { if (slice == null) { return 0; } return deserialize(slice).hashCode(); }

Target:
public static long hashCode(@SqlType(GEOMETRY_TYPE_NAME) Slice slice) { return XxHash64.hash(deserialize(slice).hashCode()); }
Source:
private Set<Integer> getAvailableCameraLensFacing() { Set<Integer> available = new LinkedHashSet<>(Arrays.asList(LensFacingConverter.values())); if (mLifecycleOwner != null) { if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) { available.remove(CameraSelector.LENS_FACING_BACK); } if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT)) { available.remove(CameraSelector.LENS_FACING_FRONT); } } return available; }

Target:
private Set<Integer> getAvailableCameraLensFacing() { Set<Integer> available = new LinkedHashSet<>(Arrays.asList(LensFacingConverter.values())); if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) { available.remove(CameraSelector.LENS_FACING_BACK); } if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT)) { available.remove(CameraSelector.LENS_FACING_FRONT); } return available; }
Source:
public boolean affectsJavaCodeMining(PropertyChangeEvent event) { boolean result= isJavaCodeMiningPreference(event.getProperty()); if (result) { installCodeMinigProviders(); } return result; }

Target:
protected boolean affectsJavaCodeMining(PropertyChangeEvent event) { boolean result= isJavaCodeMiningPreference(event.getProperty()); if (result) { installCodeMinigProviders(); } return result; }
Source:
@Test public void testIsAlwaysTrueAndFalse() { final RelDataType booleanNullableType = typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BOOLEAN), true); RexNode node = rexBuilder.makeInputRef(booleanNullableType, 0); RexNode exp1 = rexBuilder.makeCall(SqlStdOperatorTable.IS_FALSE, isNotNull(isNull(node))); assertEquals(exp1.isAlwaysTrue(), false); assertEquals(exp1.isAlwaysFalse(), true); RexNode exp2 = rexBuilder.makeCall(SqlStdOperatorTable.IS_TRUE, isNotNull(isNull(node))); assertEquals(exp2.isAlwaysTrue(), true); assertEquals(exp2.isAlwaysFalse(), false); }

Target:
@Test public void testIsAlwaysTrueAndFalse() { final RelDataType type = typeFactory.createSqlType(SqlTypeName.BOOLEAN); RexNode inputRef = rexBuilder.makeInputRef(type, 0); RexNode isFalseExp = isFalse(isNotNull(isNull(inputRef))); assertEquals("expected false,but got true in isFalseExp.isAlwaysTrue()", isFalseExp.isAlwaysTrue(), false); assertEquals("expected true,but got false in isFalseExp.isAlwaysFalse()", isFalseExp.isAlwaysFalse(), true); RexNode isFalseExp2 = isFalse(not(isNotNull(isNull(inputRef)))); assertEquals("expected true,but got false in isFalseExp2.isAlwaysTrue()", isFalseExp2.isAlwaysTrue(), true); assertEquals("expected false,but got true in isFalseExp2.isAlwaysFalse()", isFalseExp2.isAlwaysFalse(), false); RexNode isTrueExp = isTrue(isNotNull(isNull(inputRef))); assertEquals("expected true,but got false in isTrueExp.isAlwaysTrue()", isTrueExp.isAlwaysTrue(), true); assertEquals("expected false,but got true in isTrueExp.isAlwaysFalse()", isTrueExp.isAlwaysFalse(), false); RexNode isTrueExp2 = isTrue(not(isNotNull(isNull(inputRef)))); assertEquals("expected false,but got true in isTrueExp2.isAlwaysTrue()", isTrueExp2.isAlwaysTrue(), false); assertEquals("expected true,but got false in isTrueExp2.isAlwaysFalse()", isTrueExp2.isAlwaysFalse(), true); RexNode isNotTrueExp = isNotTrue(isNotNull(isNull(inputRef))); assertEquals("expected false,but got true in isNotTrueExp.isAlwaysTrue()", isNotTrueExp.isAlwaysTrue(), false); assertEquals("expected true,but got false in isNotTrueExp.isAlwaysFalse()", isNotTrueExp.isAlwaysFalse(), true); RexNode isNotTrueExp2 = isNotTrue(not(isNotNull(isNull(inputRef)))); assertEquals("expected true,but got false in isNotTrueExp2.isAlwaysTrue()", isNotTrueExp2.isAlwaysTrue(), true); assertEquals("expected false,but got true in isNotTrueExp2.isAlwaysFalse()", isNotTrueExp2.isAlwaysFalse(), false); }
Source:
public void calls_a_callback_each_time_there_is_a_change() { AtomicInteger changeCallbackCalledTimes = new AtomicInteger(0); JTextField field = new JTextField(); JLabel label = new JLabel(); label.setForeground(BLACK); UiFieldValidator validator = UiFieldValidator.of(field, label, s -> s.equals("foo")).onChange(() -> changeCallbackCalledTimes.getAndIncrement()); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(0)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(1)); field.setText("foo"); simulateKeyStroke(field); assertThat(validator.isValid(), is(true)); assertThat(changeCallbackCalledTimes.get(), is(2)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(3)); }

Target:
public void calls_a_callback_each_time_there_is_a_change() { AtomicInteger changeCallbackCalledTimes = new AtomicInteger(0); JTextField field = new JTextField(); JLabel label = new JLabel(); label.setForeground(BLACK); UiFieldValidator validator = UiFieldValidator.of(field, label, s -> s.equals("foo")).onChange(changeCallbackCalledTimes::getAndIncrement); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(0)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(1)); field.setText("foo"); simulateKeyStroke(field); assertThat(validator.isValid(), is(true)); assertThat(changeCallbackCalledTimes.get(), is(2)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(3)); }
Source:
private void display(DiffInfo diffInfo) { cmA = displaySide(diffInfo.meta_a(), diffInfo.text_a(), diffTable.getCmA()); cmB = displaySide(diffInfo.meta_b(), diffInfo.text_b(), diffTable.getCmB()); render(diffInfo); initialBoxes = new ArrayList<CommentBox>(); publishedMap = new HashMap<String, PublishedBox>(published.length()); lineActiveBoxMap = new HashMap<LineHandle, CommentBox>(); lineLastPublishedBoxMap = new HashMap<LineHandle, PublishedBox>(); linePaddingManagerMap = new HashMap<LineHandle, PaddingManager>(); if (published != null) { renderPublished(); } if (drafts != null) { renderDrafts(); } published = null; drafts = null; cmA.on("cursorActivity", updateActiveLine(cmA)); cmB.on("cursorActivity", updateActiveLine(cmB)); if (Gerrit.isSignedIn()) { cmA.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmA))); cmB.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmB))); } resizeHandler = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { if (cmA != null) { cmA.setHeight(event.getHeight() - HEADER_FOOTER); cmA.refresh(); } if (cmB != null) { cmB.setHeight(event.getHeight() - HEADER_FOOTER); cmB.refresh(); } } }); cmA.on("scroll", doScroll(cmB)); cmB.on("scroll", doScroll(cmA)); }

Target:
private void display(DiffInfo diffInfo) { cmA = displaySide(diffInfo.meta_a(), diffInfo.text_a(), diffTable.getCmA()); cmB = displaySide(diffInfo.meta_b(), diffInfo.text_b(), diffTable.getCmB()); render(diffInfo); initialBoxes = new ArrayList<CommentBox>(); lineActiveBoxMap = new HashMap<LineHandle, CommentBox>(); lineLastPublishedBoxMap = new HashMap<LineHandle, PublishedBox>(); linePaddingManagerMap = new HashMap<LineHandle, PaddingManager>(); if (published != null) { publishedMap = new HashMap<String, PublishedBox>(published.length()); renderPublished(); } if (drafts != null) { renderDrafts(); } published = null; drafts = null; cmA.on("cursorActivity", updateActiveLine(cmA)); cmB.on("cursorActivity", updateActiveLine(cmB)); if (Gerrit.isSignedIn()) { cmA.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmA))); cmB.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmB))); } resizeHandler = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { if (cmA != null) { cmA.setHeight(event.getHeight() - HEADER_FOOTER); cmA.refresh(); } if (cmB != null) { cmB.setHeight(event.getHeight() - HEADER_FOOTER); cmB.refresh(); } } }); cmA.on("scroll", doScroll(cmB)); cmB.on("scroll", doScroll(cmA)); }
Source:
@Test public void stringConverterReturningNullResultsInDefault() { class MyConverterFactory extends Converter.Factory { @Override public Converter<?, String> toString(Type type, Annotation[] annotations) { return null; } } Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new MyConverterFactory()) .build(); CallMethod service = retrofit.create(CallMethod.class); service.queryObject(null); }

Target:
@Test public void stringConverterReturningNullResultsInDefault() { final AtomicBoolean factoryCalled = new AtomicBoolean(); class MyConverterFactory extends Converter.Factory { @Override public Converter<?, String> stringConverter(Type type, Annotation[] annotations) { factoryCalled.set(true); return null; } } Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new MyConverterFactory()) .build(); CallMethod service = retrofit.create(CallMethod.class); Call<ResponseBody> call = service.queryObject(null); assertThat(call).isNotNull(); assertThat(factoryCalled.get()).isTrue(); }
Source:
public VariantType getType() { if (this.alternate.equals(".")) { return VariantType.NO_ALTERNATE; } else if (this.reference.startsWith("(") && this.reference.endsWith(")") || this.alternate.startsWith("(") && this.alternate.endsWith(")")) { return VariantType.SEQUENCE_ALTERATION; } else if (!reference.equals(".") && reference.length() == alternate.length()) { if (getLength() > 1) { return VariantType.MNV; } else { return VariantType.SNV; } } else if (getLength() <= SV_THRESHOLD) { return VariantType.INDEL; } else { return VariantType.SV; } }

Target:
public VariantType getType() { if (this.alternate.equals(".")) { return VariantType.NO_ALTERNATE; } else if (this.reference.startsWith("<") && this.reference.endsWith(">") || this.alternate.startsWith("<") && this.alternate.endsWith(">")) { return VariantType.SEQUENCE_ALTERATION; } else if (!reference.equals(".") && reference.length() == alternate.length()) { if (getLength() > 1) { return VariantType.MNV; } else { return VariantType.SNV; } } else if (getLength() <= SV_THRESHOLD) { if (reference.isEmpty()) { return VariantType.INS; } else if (alternate.isEmpty()) { return VariantType.DEL; } else { return VariantType.INDEL; } } else { return VariantType.SV; } }
Source:
public boolean hasNext() { try { return !in.isEnd(); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public boolean hasNext() { try { return !in.isEnd(); } catch (IOException e) { throw new RuntimeException("Failed to check for more records", e); } }
Source:
public static Optional<InsightCard> scoreCardBedLightDuration(final int avgLightOn, final Long accountId) { Text text; if (avgLightOn <= 60) { return Optional.absent(); } else if (avgLightOn <= 120) { text = BedLightDurationMsgEN.getMediumLight(); } else { text = BedLightDurationMsgEN.getHighLight(); } return Optional.of(new InsightCard(accountId, text.title, text.message, InsightCard.Category.BED_LIGHT_DURATION, InsightCard.TimePeriod.MONTHLY, DateTime.now(DateTimeZone.UTC))); }

Target:
public static Optional<InsightCard> scoreCardBedLightDuration(final int avgLightOn, final Long accountId) { final Text text; if (avgLightOn <= 60) { return Optional.absent(); } if (avgLightOn <= 120) { text = BedLightDurationMsgEN.getMediumLight(); } else { text = BedLightDurationMsgEN.getHighLight(); } return Optional.of(new InsightCard(accountId, text.title, text.message, InsightCard.Category.BED_LIGHT_DURATION, InsightCard.TimePeriod.MONTHLY, DateTime.now(DateTimeZone.UTC))); }
Source:
public void checkClientCompDenpendency() throws IOException { String p = new File(".").getCanonicalPath(); File src = new File(p + "/src/org/zkoss/zktest/test2/ZK3848_lang_addon.xml"); File dst = new File(p + "/debug/classes/metainfo/zk/lang-addon.xml"); String name = "metainfo/zk/lang-addon.xml"; String elName = "addon-name"; String elDepends = "depends"; Path zkPath = dst.toPath().getParent(); if (!Files.exists(zkPath)) Files.createDirectories(zkPath); Files.copy(src.toPath(), dst.toPath(), StandardCopyOption.REPLACE_EXISTING); try { clToTest.getDependentXMLResources(name, elName, elDepends); verify(logger, times(2)).warn(anyString()); } catch (Exception ex) { } finally { Files.delete(dst.toPath()); Path metainfoPath = zkPath.getParent(); Files.delete(zkPath); Files.delete(metainfoPath); } System.out.println(results.size()); }

Target:
public void checkClientCompDenpendency() throws IOException { File p = new File("."); File src = new File(p, "/src/org/zkoss/zktest/test2/ZK3848_lang_addon.xml"); File dst = new File(p, "/debug/classes/metainfo/zk/lang-addon.xml"); String name = "metainfo/zk/lang-addon.xml"; String elName = "addon-name"; String elDepends = "depends"; Path zkPath = dst.toPath().getParent(); if (!Files.exists(zkPath)) Files.createDirectories(zkPath); Files.copy(src.toPath(), dst.toPath(), StandardCopyOption.REPLACE_EXISTING); try { clToTest.getDependentXMLResources(name, elName, elDepends); verify(logger, times(2)).warn(anyString()); } catch (Exception ex) { Assert.fail(); } finally { Files.delete(dst.toPath()); Path metainfoPath = zkPath.getParent(); Files.delete(zkPath); Files.delete(metainfoPath); } System.out.println(results.size()); }