auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private CompletionStage<RestResponse> getXSiteTakeOffline(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String cacheName = request.variables().get("cacheName"); String site = request.variables().get("site"); Cache<?, ?> cache = invocationHelper.getRestCacheManager().getCache(cacheName, request); XSiteAdminOperations xsiteAdmin = cache.getAdvancedCache().getComponentRegistry().getComponent(XSiteAdminOperations.class); if (!xsiteAdmin.checkSite(site)) { return CompletableFuture.completedFuture(responseBuilder.status(NOT_FOUND.code()).build()); } OfflineStatus offlineStatus = xsiteAdmin.getOfflineStatus(site); try { byte[] payload = invocationHelper.getMapper().writeValueAsBytes(new TakeOffline(offlineStatus.getTakeOffline())); responseBuilder.entity(payload); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }

Target:
private CompletionStage<RestResponse> getXSiteTakeOffline(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String site = request.variables().get("site"); XSiteAdminOperations xsiteAdmin = getxsiteAdmin(request); if (!xsiteAdmin.checkSite(site)) { return CompletableFuture.completedFuture(responseBuilder.status(NOT_FOUND.code()).build()); } OfflineStatus offlineStatus = xsiteAdmin.getOfflineStatus(site); try { byte[] payload = invocationHelper.getMapper().writeValueAsBytes(new TakeOffline(offlineStatus.getTakeOffline())); responseBuilder.entity(payload).contentType(APPLICATION_JSON_TYPE); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }
Source:
protected SenderInfo getSenderInfoExtensionPoint(Message messageEntity) { BuddyMessage responseMmessageEntity = (BuddyMessage) messageEntity; return createSenderInfoForDetachedBuddy(responseMmessageEntity.getSenderUser(), responseMmessageEntity.getSenderNickname()); }

Target:
protected SenderInfo getSenderInfoExtensionPoint(Message messageEntity) { BuddyMessage buddyMessageEntity = (BuddyMessage) messageEntity; return createSenderInfoForDetachedBuddy(buddyMessageEntity.getSenderUser(), buddyMessageEntity.getSenderNickname()); }
Source:
public TransitionEditor(Composite parent, int style) { super("Advanced transition textual editor", parent, style); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 150).applyTo(xtextEditor.getTextControl()); }

Target:
public TransitionEditor(Composite parent, int style) { super(TransitionEditorConfigurationContribution.LANGUAGE, parent, style); Label editorLabel = new Label(parent, SWT.NONE); editorLabel.setText("Edit transition:"); editorLabel.moveAbove(null); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 150).applyTo(xtextEditor.getTextControl()); }
Source:
public boolean lockForWriting( List<String> locks ) { TransactionsHolder.requireActiveTransaction(); if (locks.isEmpty()) { return false; } return runWithConnection(connection -> statements.lockForWriting(connection, locks), true); }

Target:
public boolean lockForWriting( List<String> locks ) { if (locks.isEmpty()) { return false; } TransactionsHolder.requireActiveTransaction(); return runWithConnection(connection -> statements.lockForWriting(connection, locks), true); }
Source:
private Boolean segmentFree(final int ind, final SequenceSegment segment) { for (int height = 0; height < segment.getSources().size(); height++) { if ((ind + height < lanes.size()) && (lanes.get(ind + height) > segment.getStart())) { return false; } } return true; }

Target:
private boolean segmentFree(final int ind, final SequenceSegment segment) { for (int height = 0; height < segment.getSources().size(); height++) { if ((ind + height < lanes.size()) && (lanes.get(ind + height) > segment.getStart())) { return false; } } return true; }
Source:
public String get(InjectionPoint ip) { Annotated annotated = ip.getAnnotated(); Property property = annotated.getAnnotation(Property.class); String key = property.value(); if (isNullOrEmpty(key)) key = ip.getMember().getName(); return environment.get(key); }

Target:
public String get(InjectionPoint ip) { Annotated annotated = ip.getAnnotated(); Property property = annotated.getAnnotation(Property.class); String key = property.value(); if (isNullOrEmpty(key)) { key = ip.getMember().getName(); } return environment.get(key); }
Source:
public CommentDefaultAccessModifierRule() { definePropertyDescriptor(REGEX_DESCRIPTOR); defaultSuppressionAnnotations(); }

Target:
public CommentDefaultAccessModifierRule() { definePropertyDescriptor(REGEX_DESCRIPTOR); }
Source:
static SSLContext getSslContext() { final Boolean check = AccessController.doPrivileged( (PrivilegedAction<Boolean>) () -> (System.getProperty(KEY_STORE) == null || System.getProperty(KEY_STORE_PASS) == null || System.getProperty(TRUST_STORE) == null || System.getProperty(TRUST_STORE_PASS) == null)); if (check) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } final KeyStore[] trustStore = new KeyStore[1]; final KeyStore[] keyStore = new KeyStore[1]; AccessController.doPrivileged( (PrivilegedAction<Object>) () -> { trustStore[0] = getKeyStore( System.getProperty(TRUST_STORE), System.getProperty(TRUST_STORE_PASS)); keyStore[0] = getKeyStore(System.getProperty(KEY_STORE), System.getProperty(KEY_STORE_PASS)); return null; }); SSLContext sslContext = null; try { sslContext = SSLContexts.custom() .loadKeyMaterial( keyStore[0], AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(KEY_STORE_PASS)) .toCharArray()) .loadTrustMaterial(trustStore[0]) .useTLS() .build(); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } sslContext.getDefaultSSLParameters().setNeedClientAuth(true); sslContext.getDefaultSSLParameters().setWantClientAuth(true); return sslContext; }

Target:
private SSLContext getSslContext() { if (!isSslConfigured()) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } KeyStore trustStore = getKeyStore(getProperty(TRUST_STORE), getProperty(TRUST_STORE_PASS)); KeyStore keyStore = getKeyStore(getProperty(KEY_STORE), getProperty(KEY_STORE_PASS)); SSLContext sslContext; try { sslContext = SSLContexts.custom() .loadKeyMaterial(keyStore, getProperty(KEY_STORE_PASS).toCharArray()) .loadTrustMaterial(trustStore) .useTLS() .build(); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } sslContext.getDefaultSSLParameters().setWantClientAuth(true); return sslContext; }
Source:
private Object invokeReactiveToSuspend(Method methodToCall, Object instance, Object[] args) throws ReflectiveOperationException { Object[] invocationArguments = new Object[args.length - 1]; System.arraycopy(args, 0, invocationArguments, 0, invocationArguments.length); Object result = methodToCall.invoke(instance, invocationArguments); Publisher<?> publisher; if (result instanceof Publisher) { publisher = (Publisher<?>) result; } else { publisher = ReactiveWrapperConverters.toWrapper(result, Publisher.class); } return AwaitKt.awaitFirstOrNull(publisher, (Continuation) args[args.length - 1]); }

Target:
private Object invokeReactiveToSuspend(Method methodToCall, Object instance, Object[] args) throws ReflectiveOperationException { Object[] invocationArguments = new Object[args.length - 1]; System.arraycopy(args, 0, invocationArguments, 0, invocationArguments.length); Object result = methodToCall.invoke(instance, invocationArguments); Publisher<?> publisher = result instanceof Publisher ? (Publisher<?>) result : ReactiveWrapperConverters.toWrapper(result, Publisher.class); return AwaitKt.awaitFirstOrNull(publisher, (Continuation) args[args.length - 1]); }
Source:
public void filePage001_tabs() { FilePagePageObject filePage = new FilePagePageObject(driver); filePage.openFilePage(URLsContent.fileName); filePage.verifySelectedTab("about"); filePage.selectTab(1); filePage.verifySelectedTab("history"); filePage.selectTab(0); filePage.verifySelectedTab("about"); filePage.selectTab(2); filePage.verifySelectedTab("metadata"); }

Target:
public void filePage001_tabs() { FilePagePageObject filePage = new FilePagePageObject(driver); filePage.openFilePage(URLsContent.fileName001); filePage.verifySelectedTab("about"); filePage.selectTab(1); filePage.verifySelectedTab("history"); filePage.selectTab(0); filePage.verifySelectedTab("about"); filePage.selectTab(2); filePage.verifySelectedTab("metadata"); }
Source:
private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { String[] itemStrings = new String[columns.size()]; TableColumn[] tableColumns = fTable.getColumns(); for (int i = 0; i < columns.size(); i++) { TmfEventTableColumn column = columns.get(i); ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } TableColumn tableColumn = tableColumns[fColumns.indexOf(column)]; if (passedEvent == null || (!tableColumn.getResizable() && tableColumn.getWidth() == 0)) { itemStrings[i] = EMPTY_STRING; } else { String s = column.getItemString(passedEvent); s = s.replaceAll("\\n", " "); s = s.replaceAll("\\r", " "); if (s == EMPTY_STRING) { String ColumnName = column.getHeaderName(); for (int j = 0; j < fColumnsDuplicate.size(); j++) { TmfEventTableColumn duplicateColumn = fColumnsDuplicate.get(j); if (duplicateColumn.getHeaderName() == ColumnName) { itemStrings[i] = duplicateColumn.getItemString(passedEvent); } } } else { itemStrings[i] = s; } } } return itemStrings; } }

Target:
private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { String[] itemStrings = new String[columns.size()]; TableColumn[] tableColumns = fTable.getColumns(); for (int i = 0; i < columns.size(); i++) { TmfEventTableColumn column = columns.get(i); ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } TableColumn tableColumn = tableColumns[fColumns.indexOf(column)]; if (passedEvent == null || (!tableColumn.getResizable() && tableColumn.getWidth() == 0)) { itemStrings[i] = EMPTY_STRING; } else { String s = column.getItemString(passedEvent); s = s.replaceAll("\\n", " "); s = s.replaceAll("\\r", " "); itemStrings[i] = s; } } return itemStrings; } }
Source:
public void mockAlternativeIsVetoed() { Assert.assertEquals(getUniqueBean(PaymentProcessor.class).getName(), "paymentProcessorImpl"); }

Target:
public void mockAlternativeIsVetoed() { Assert.assertEquals("paymentProcessorImpl", getUniqueBean(PaymentProcessor.class).getName()); }
Source:
public void start() { if (mRunning) return; mRunning = true; new Thread() { @Override public void run() { while (mRunning) { listen(); } } }.start(); }

Target:
public void start() { if (mRunning) return; mRunning = true; new Thread(() -> { while (mRunning) { listen(); } }).start(); }
Source:
private Composite createFixedComp(Composite parent) { Composite comp = createComposite(parent); GridLayoutFactory.fillDefaults().applyTo(comp); Control l = ControlFactory.create(comp, SHORT_CONTROL_WIDTH, 15); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(l); return comp; }

Target:
private Composite createFixedComp(Composite parent) { Composite comp = createComposite(parent); GridLayoutFactory.fillDefaults().applyTo(comp); Control control = ControlFactory.create(comp, SHORT_CONTROL_WIDTH, 15); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(control); return comp; }
Source:
public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { String msg = "input stream is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } if (fileDetail == null) { String msg = "form data content disposition is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); String downloadHostNameOverride = config.getStringValue(DOWNLOAD_HOSTNAME_OVERRIDE); if (StringUtil.isNotBlank(downloadHostNameOverride)) { hostname = downloadHostNameOverride; } final String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); final String uploadedFileLocation = uploadDir + "/" + fileName; try { FileHelper.writeToFile(uploadedInputStream, uploadedFileLocation); } catch (IOException e) { LOG.error("error uploading file {}", fileDetail.getFileName(), e); return Response.serverError() .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(e.getMessage())) .build(); } String uri = String.format("http://%s:%s/api/v1/file/download/%s", (hostname != null) ? hostname : ip, getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }

Target:
public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { String msg = "input stream is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } if (fileDetail == null) { String msg = "form data content disposition is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); final String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); final String uploadedFileLocation = uploadDir + "/" + fileName; try { FileHelper.writeToFile(uploadedInputStream, uploadedFileLocation); } catch (IOException e) { LOG.error("error uploading file {}", fileDetail.getFileName(), e); return Response.serverError() .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(e.getMessage())) .build(); } String uri = String.format("http://%s:%s/api/v1/file/download/%s", getHostNameOrIP(), getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }
Source:
public static <A, B, C, D, E> Equal<P5<A, B, C, D, E>> p5Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed, final Equal<E> ee) { return new Equal<P5<A, B, C, D, E>>(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && ed.eq(p1._4(), p2._4()) && ee.eq(p1._5(), p2._5())); }

Target:
public static <A, B, C, D, E> Equal<P5<A, B, C, D, E>> p5Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed, final Equal<E> ee) { return equal(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && ed.eq(p1._4(), p2._4()) && ee.eq(p1._5(), p2._5())); }
Source:
public OutputDataStream[] getOutputDataStreams() { final OutputDataStreamBuilder streamBuilder = OutputDataStreams.pushDataStream("character sets"); streamBuilder.withColumn("Character set", ColumnType.STRING); for(InputColumn<String> column : _columns) { streamBuilder.withColumn(column.getName(), ColumnType.STRING); } return new OutputDataStream[]{streamBuilder.toOutputDataStream()}; }

Target:
public OutputDataStream[] getOutputDataStreams() { final OutputDataStreamBuilder streamBuilder = OutputDataStreams.pushDataStream(CHARACTER_SETS); streamBuilder.withColumn(CHARACTER_SET_COLUMN, ColumnType.STRING); for(InputColumn<String> column : _columns) { streamBuilder.withColumn(column.getName(), ColumnType.STRING); } return new OutputDataStream[]{streamBuilder.toOutputDataStream()}; }
Source:
public SystemConfigurationProvider(Map<String, String> variableValues) { this(variableValues, new ObjectMapper()); }

Target:
public SystemConfigurationProvider(Map<String, String> variableValues) { this(variableValues, null); }
Source:
public void updateEntity() { if (worldObj.isRemote) return; if (lightList.isEmpty()) { worldObj.setBlockToAir(new BlockPos(this.pos.getX(), this.pos.getY(), this.pos.getZ())); Utils.println("Destroy light at " + this.pos.getX() + " " + this.pos.getY() + " " + this.pos.getZ() + " "); return; } int light = 0; Iterator<LightHandle> iterator = lightList.iterator(); while (iterator.hasNext()) { LightHandle l = iterator.next(); if (light < l.value) light = l.value; l.timeout--; if (l.timeout <= 0) { iterator.remove(); } } if (light != worldObj.getBlockState(this.pos).getBlock().getMetaFromState(worldObj.getBlockState(this.pos))) { worldObj.getBlockState(this.pos).getBlock().setLightLevel(2); worldObj.updateLightByType(EnumSkyBlock.BLOCK, xCoord, yCoord, zCoord); } }

Target:
public void updateEntity() { if (worldObj.isRemote) return; if (lightList.isEmpty()) { worldObj.setBlockToAir(new BlockPos(this.pos.getX(), this.pos.getY(), this.pos.getZ())); Utils.println("Destroy light at " + this.pos.getX() + " " + this.pos.getY() + " " + this.pos.getZ() + " "); return; } int light = 0; Iterator<LightHandle> iterator = lightList.iterator(); while (iterator.hasNext()) { LightHandle l = iterator.next(); if (light < l.value) light = l.value; l.timeout--; if (l.timeout <= 0) { iterator.remove(); } } IBlockState state = worldObj.getBlockState(pos); Block block = state.getBlock(); if (light != block.getMetaFromState(state)) { block.setLightLevel(2); worldObj.notifyLightSet(pos); } }
Source:
public boolean getBuildResult(String id) throws RestServiceException { ClientResponse response = null; try { LOGGER.info("Calling getById VCPENetworkManager service"); String url = getURL("vcpenetwork/getBuildResult/" + id); Client client = Client.create(); WebResource webResource = client.resource(url); response = webResource.accept(MediaType.APPLICATION_XML).get(ClientResponse.class); LOGGER.info("VCPENetwork recovered"); } catch (ClientHandlerException e) { LOGGER.error(e.getMessage()); throw e; } String result; result = (checkResponse(response) ? response.getEntity(String.class) : null); return Boolean.parseBoolean(result); }

Target:
public boolean getBuildResult(String id) throws RestServiceException { String result; ClientResponse response = null; try { LOGGER.info("Calling getById VCPENetworkManager service"); String url = getURL("vcpenetwork/getBuildResult/" + id); Client client = Client.create(); WebResource webResource = client.resource(url); response = webResource.accept(MediaType.APPLICATION_XML).get(ClientResponse.class); LOGGER.info("VCPENetwork recovered"); } catch (ClientHandlerException e) { LOGGER.error(e.getMessage()); throw e; } result = (checkResponse(response) ? response.getEntity(String.class) : null); return Boolean.parseBoolean(result); }
Source:
public static WifiInfo createWithRedisResult(final String wifiInfoString) { final String[] wifiInfoList = wifiInfoString.split(":"); if (wifiInfoList.length < 2) { return new WifiInfo("", 0); } return new WifiInfo(wifiInfoList[0].trim(), Integer.valueOf(wifiInfoList[1].trim())); }

Target:
public static WifiInfo createWithRedisResult(final String wifiInfoString) { final String[] wifiInfoList = wifiInfoString.split(":"); if (wifiInfoList.length < 2) { return new WifiInfo(DEFAULT_SSID, DEFAULT_RSSI, getCondition(DEFAULT_RSSI)); } return new WifiInfo(wifiInfoList[0].trim(), Integer.valueOf(wifiInfoList[1].trim()), getCondition(Integer.valueOf(wifiInfoList[1].trim()))); }
Source:
public void setup() { try { Connection espConn = new Connection("http://" + testClusterIp + ":8010?test"); espConn.setUserName(""); espConn.setPassword(""); this.file = new HPCCFile(testIntegerKVDataset, espConn); this.file.setProjectList("key"); this.file2 = new HPCCFile(testAllTypesDataset, espConn); this.file2.setProjectList("str,bool,int8,uns4,flt4"); } catch (Exception e) { System.out.println("Setup failed with error: " + e.getMessage()); } }

Target:
public void setup() { try { Connection espConn = new Connection("http://" + testClusterIp + ":8010"); espConn.setUserName(""); espConn.setPassword(""); this.file = new HPCCFile(testIntegerKVDataset, espConn); this.file.setProjectList("key"); this.file2 = new HPCCFile(testAllTypesDataset, espConn); this.file2.setProjectList("str,qstr,uni10,bool,childdataset.childindex,childdataset.childstr"); } catch (Exception e) { System.out.println("Setup failed with error: " + e.getMessage()); } }
Source:
public Response uploadEvents(EventUploadRequest eventUploadRequest, OkHttpClient client) throws IOException, IllegalArgumentException { String apiVersionString = "" + eventUploadRequest.getApiVersion(); String timestampString = "" + eventUploadRequest.getUploadTime(); FormBody body = new FormBody.Builder() .add("v", apiVersionString) .add("client", eventUploadRequest.getApiKey()) .add("e", eventUploadRequest.getEvents()) .add("upload_time", timestampString) .add("checksum", eventUploadRequest.getChecksum()) .build(); Request request = new Request.Builder() .url(eventUploadRequest.getUrl()) .post(body) .build(); return client.newCall(request).execute(); }

Target:
public Response uploadEvents(EventUploadRequest eventUploadRequest, OkHttpClient client) throws IOException, IllegalArgumentException { String apiVersionString = "" + eventUploadRequest.getApiVersion(); String timestampString = "" + eventUploadRequest.getUploadTime(); FormBody body = new FormBody.Builder() .add("v", apiVersionString) .add("client", eventUploadRequest.getApiKey()) .add("e", eventUploadRequest.getEvents()) .add("upload_time", timestampString) .add("checksum", eventUploadRequest.getChecksum()) .build(); Request request = new Request.Builder() .url(eventUploadRequest.getUrl()) .post(body) .build(); okhttp3.Response response = client.newCall(request).execute(); return new Response(response.code(), response.body() == null ? "" : response.body().string()); }
Source:
public void doRender(EntityTropicraftWaterBase entityliving, double d, double d1, double d2, float f, float f1) { if(refreshModel && entityliving.ticksExisted % 20 == 0) { this.mainModel = new ModelDolphin(); this.dolphin = new ModelDolphin(); refreshModel = false; } this.renderWaterMob((EntityTropicraftWaterBase) entityliving, d, d1, d2, f1); }

Target:
public void doRender(EntityTropicraftWaterBase entityliving, double d, double d1, double d2, float f, float f1) { this.renderWaterMob((EntityTropicraftWaterBase) entityliving, d, d1, d2, f1); }
Source:
public void identity(String identity) { setDimension("identity", identity); }

Target:
public void identity(String identity) { }
Source:
private static Token decode(String value) { try { String mac = value.substring(0, 64); String rest = new String(Util.fromHexString(value.substring(64)), StandardCharsets.UTF_8); if (!KEY.checkMac(rest, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split(":", 3); String authenticationName = Util.fixEmpty(splits[0]); String epoch = splits[1]; String browserUrl = splits[2]; return new Token(browserUrl, authenticationName, Long.parseLong(epoch)); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }

Target:
private static Token decode(String value) { byte[] byteValue = Base64.getUrlDecoder().decode(value); try { byte[] mac = Arrays.copyOf(byteValue, 32); byte[] restBytes = Arrays.copyOfRange(byteValue, 32, byteValue.length); String rest = new String(restBytes, StandardCharsets.UTF_8); if (!KEY.checkMac(restBytes, mac)) { throw new IllegalArgumentException("Failed mac check for " + rest); } String[] splits = rest.split(":", 3); String authenticationName = Util.fixEmpty(splits[0]); String epoch = splits[1]; String browserUrl = splits[2]; return new Token(browserUrl, authenticationName, ofEpochMilli(Long.parseLong(epoch))); } catch (Exception ex) { LOGGER.log(Level.FINE, "Failure decoding", ex); return null; } }
Source:
public Object call() throws Exception { ObjectReader or = block.templateReader.newReader(); try { for (;;) { Slice s; synchronized (this) { if (slices.isEmpty()) break; s = slices.removeFirst(); } runWorker(or, s); } for (Slice s = block.stealWork(); s != null; s = block.stealWork()) runWorker(or, s); } finally { or.release(); block.pm.endWorker(); } return null; }

Target:
public Object call() throws Exception { or = block.templateReader.newReader(); try { DeltaWindow w; for (;;) { synchronized (this) { if (slices.isEmpty()) break; w = initWindow(slices.removeFirst()); } runWindow(w); } while ((w = block.stealWork(this)) != null) runWindow(w); } finally { block.pm.endWorker(); or.release(); or = null; } return null; }
Source:
private void saveZeroValueForResource(org.sonar.api.resources.File resource, SensorContext context) { Measure<Integer> nclocMeasure = context.getMeasure(resource, CoreMetrics.NCLOC); if (nclocMeasure != null) { double ncloc = context.getMeasure(resource, CoreMetrics.NCLOC).getValue(); context.saveMeasure(resource, getZeroCoverageLineHitsDataMetric(resource, context)); context.saveMeasure(resource, linesToCoverMetric, ncloc); context.saveMeasure(resource, uncoveredLinesMetric, ncloc); } }

Target:
private void saveZeroValueForResource(org.sonar.api.resources.File resource, SensorContext context) { Measure<Integer> nclocMeasure = context.getMeasure(resource, CoreMetrics.NCLOC); if (nclocMeasure != null) { double ncloc = nclocMeasure.getValue(); context.saveMeasure(resource, getZeroCoverageLineHitsDataMetric(resource, context)); context.saveMeasure(resource, linesToCoverMetric, ncloc); context.saveMeasure(resource, uncoveredLinesMetric, ncloc); } }
Source:
public void testListenDomainSocketAddress() throws Exception { Vertx vx = Vertx.vertx(new VertxOptions().setPreferNativeTransport(true)); Assume.assumeTrue("Native transport must be enabled", vx.isNativeTransportEnabled()); NetClient netClient = vx.createNetClient(); HttpServer httpserver = vx.createHttpServer().requestHandler(req -> req.response().end()); File sockFile = TestUtils.tmpFile("vertx", ".sock"); SocketAddress sockAddress = SocketAddress.domainSocketAddress(sockFile.getAbsolutePath()); httpserver.listen(sockAddress, onSuccess(server -> { netClient.connect(sockAddress, onSuccess(sock -> { sock.handler(buf -> testComplete()); sock.write("GET / HTTP/1.1\r\n"); })); })); await(); }

Target:
public void testListenDomainSocketAddress() throws Exception { Vertx vx = Vertx.vertx(new VertxOptions().setPreferNativeTransport(true)); Assume.assumeTrue("Native transport must be enabled", vx.isNativeTransportEnabled()); NetClient netClient = vx.createNetClient(); HttpServer httpserver = vx.createHttpServer().requestHandler(req -> req.response().end()); File sockFile = TestUtils.tmpFile("vertx", ".sock"); SocketAddress sockAddress = SocketAddress.domainSocketAddress(sockFile.getAbsolutePath()); httpserver.listen(sockAddress, onSuccess(server -> { netClient.connect(sockAddress, onSuccess(sock -> { sock.handler(buf -> { assertTrue("Response is not an http 200", buf.toString("UTF-8").startsWith("HTTP/1.1 200 OK")); testComplete(); }); sock.write("GET / HTTP/1.1\r\n\r\n"); })); })); try { await(); } finally { vx.close(); } }
Source:
public Tuple2<Integer, Integer> nodeCounts() { int nodeCount = 0; int seedCount = 0; for (CassandraFrameworkProtos.CassandraNode n : nodes()) { nodeCount++; if (n.getSeed()) seedCount++; } return Tuple2.tuple2(nodeCount, seedCount); }

Target:
public NodeCounts nodeCounts() { int nodeCount = 0; int seedCount = 0; for (CassandraFrameworkProtos.CassandraNode n : nodes()) { nodeCount++; if (n.getSeed()) seedCount++; } return new NodeCounts(nodeCount, seedCount); }
Source:
Row getMainSearchReq(String wiki, Row[] requests) { if (requests.length == 0) { return null; } String prefix = wiki + "_"; for (Row request : requests) { if (!FULL_TEXT.equals(request.getString(queryTypeIdx))) { continue; } List<String> indices = request.getList(indicesIdx); for (String index : indices) { if (index != null && (index.equals(wiki) || index.startsWith(prefix))) { return request; } } } return null; }

Target:
Row getMainSearchReq(String wiki, Row[] requests) { if (requests == null || requests.length == 0) { return null; } String prefix = wiki + "_"; for (Row request : requests) { if (!FULL_TEXT.equals(request.getString(queryTypeIdx))) { continue; } List<String> indices = request.getList(indicesIdx); for (String index : indices) { if (index != null && (index.equals(wiki) || index.startsWith(prefix))) { return request; } } } return null; }
Source:
public void grobidPerformSearchCorrectlySplitsStringTest() throws FetcherException { List<BibEntry> entries = grobidCitationFetcher.performSearch(example3 + ";;" + example4); assertTrue(entries.size() == 2); assertTrue(entries.get(0) != null); assertTrue(entries.get(1) != null); }

Target:
public void grobidPerformSearchCorrectlySplitsStringTest() { List<BibEntry> entries = grobidCitationFetcher.performSearch(example1 + "\n\n" + example2 + "\r\n\r\n" + example3 + "\r\r" + example4); assertEquals(List.of(example1AsBibEntry, example2AsBibEntry, example3AsBibEntry, example4AsBibEntry), entries); }
Source:
protected void eventHandle(ITmfEvent event) { ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); int quark; final long ts = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); final String eventName = event.getName(); try { if (event instanceof ITmfLostEvent) { ITmfLostEvent le = (ITmfLostEvent) event; quark = ss.getQuarkAbsoluteAndAdd(Attributes.EVENT_TYPES, eventName); int curVal = ss.queryOngoingState(quark).unboxInt(); if (curVal == -1) { curVal = 0; } ITmfStateValue value = TmfStateValue.newValueInt((int) (curVal + le.getNbLostEvents())); ss.modifyAttribute(ts, value, quark); long startTime = le.getTimeRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); long endTime = le.getTimeRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); int lostEventsQuark = ss.getQuarkAbsoluteAndAdd(Attributes.LOST_EVENTS); value = ss.queryOngoingState(lostEventsQuark); if (value.isNull() || value.unboxLong() < startTime) { ss.modifyAttribute(startTime, TmfStateValue.newValueLong(endTime), lostEventsQuark); } else if (value.unboxLong() < endTime) { ss.updateOngoingState(TmfStateValue.newValueLong(endTime), lostEventsQuark); } return; } quark = ss.getQuarkAbsoluteAndAdd(Attributes.EVENT_TYPES, eventName); ss.incrementAttribute(ts, quark); } catch (StateValueTypeException | TimeRangeException | AttributeNotFoundException e) { e.printStackTrace(); } }

Target:
protected void eventHandle(ITmfEvent event) { ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); int quark; final long ts = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); final String eventName = event.getName(); try { if (event instanceof ITmfLostEvent) { ITmfLostEvent le = (ITmfLostEvent) event; quark = ss.getQuarkAbsoluteAndAdd(Attributes.EVENT_TYPES, eventName); int curVal = ss.queryOngoingState(quark).unboxInt(); if (curVal == -1) { curVal = 0; } ITmfStateValue value1 = TmfStateValue.newValueInt((int) (curVal + le.getNbLostEvents())); ss.modifyAttribute(ts, value1, quark); long lostEventsStartTime = le.getTimeRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); long lostEventsEndTime = le.getTimeRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); int lostEventsQuark = ss.getQuarkAbsoluteAndAdd(Attributes.LOST_EVENTS); ITmfStateValue currentLostEventsEndTime = ss.queryOngoingState(lostEventsQuark); if (currentLostEventsEndTime.isNull() || currentLostEventsEndTime.unboxLong() < lostEventsStartTime) { ss.modifyAttribute(lostEventsStartTime, TmfStateValue.newValueLong(lostEventsEndTime), lostEventsQuark); } else if (currentLostEventsEndTime.unboxLong() < lostEventsEndTime) { ss.updateOngoingState(TmfStateValue.newValueLong(lostEventsEndTime), lostEventsQuark); } return; } quark = ss.getQuarkAbsoluteAndAdd(Attributes.EVENT_TYPES, eventName); ss.incrementAttribute(ts, quark); } catch (StateValueTypeException | TimeRangeException | AttributeNotFoundException e) { e.printStackTrace(); } }
Source:
public static URL getUrl(String value, Bundle definingBundle) { try { if (value != null) { return new URL(value); } } catch (MalformedURLException e) { if (definingBundle != null) { return FileLocator.find(definingBundle, new Path(value)); } } return null; }

Target:
public static Optional<URL> getUrl(String value, Bundle definingBundle) { try { if (value != null) { return Optional.of(new URL(value)); } } catch (MalformedURLException e) { if (definingBundle != null) { URL bundlePath = FileLocator.find(definingBundle, new Path(value)); return Optional.of(bundlePath); } } return Optional.empty(); }
Source:
private void build(URL modelsFile) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(modelsFile.openStream()); Element root = doc.getDocumentElement(); NodeList models = root.getElementsByTagName("model"); for (int i=0; i<models.getLength(); i++) { Element modelElem = (Element) models.item(i); ModelImpl model = new ModelImpl(modelElem); modelsMap.put(model.getName(), model); } } catch (ParserConfigurationException | SAXException | IOException e) { throw new IllegalStateException("Cannot parse sherpa xml models file", e); } }

Target:
private void build(URL modelsFile) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(modelsFile.openStream()); Element root = doc.getDocumentElement(); NodeList models = root.getElementsByTagName("model"); for (int i=0; i<models.getLength(); i++) { Element modelElem = (Element) models.item(i); Model model = new DefaultModel(modelElem); modelsMap.put(model.getName(), model); } } catch (ParserConfigurationException | SAXException | IOException e) { throw new IllegalStateException("Cannot parse sherpa xml models file", e); } }
Source:
public void clickWikiVideoCard() { wikiVideoCard.click(); }

Target:
public ArticlePageObject clickWikiVideoCard() { wait.forElementClickable(wikiVideoCard); wikiVideoCard.click(); return new ArticlePageObject(); }
Source:
public void testReducingBuilderWithNamedNonExistentFunction() { try { entity.enrichers().add(Enrichers.builder() .reducing(Reducer.class, ImmutableList.<AttributeSensor<?>>of(STR1, STR2)) .from(entity) .computing("unknown function name", ImmutableMap.<String, Object>of("separator", "-")) .publishing(STR3) .build() ); Asserts.fail("Expected exception when adding reducing enricher with unknown named function"); } catch (Exception e) { Throwable t = Exceptions.getFirstThrowableOfType(e, IllegalStateException.class); Assert.assertNotNull(t); } }

Target:
public void testReducingBuilderWithNamedNonExistentFunction() { try { entity.enrichers().add(Enrichers.builder() .reducing(Reducer.class, ImmutableList.<AttributeSensor<?>>of(STR1, STR2)) .from(entity) .computing("unknown function name", ImmutableMap.<String, Object>of("separator", "-")) .publishing(STR3) .build() ); Asserts.fail("Expected exception when adding reducing enricher with unknown named function"); } catch (Exception e) { if (Exceptions.getFirstThrowableOfType(e, IllegalStateException.class) == null) { throw e; } } }
Source:
protected void computeLayer(final int currentLayer, Set<Integer> dropoutNodes) { if (!isDropoutEnable(currentLayer - 1)) { computeLayer(currentLayer); return; } final int inputIndex = super.getLayerIndex()[currentLayer]; final int outputIndex = super.getLayerIndex()[currentLayer - 1]; final int inputSize = super.getLayerCounts()[currentLayer]; final int outputSize = super.getLayerFeedCounts()[currentLayer - 1]; int index = super.getWeightIndex()[currentLayer - 1]; final int limitX = outputIndex + outputSize; final int limitY = inputIndex + inputSize; for (int x = outputIndex; x < limitX; x++) { double sum = 0; for (int y = inputIndex; y < limitY; y++) { sum += super.getWeights()[index++] * super.getLayerOutput()[y]; } super.getLayerSums()[x] = sum; super.getLayerOutput()[x] = sum; } super.getActivationFunctions()[currentLayer - 1].activationFunction(super.getLayerOutput(), outputIndex, outputSize); final double nonDropoutRate = 1d - this.getLayerDropoutRates()[currentLayer - 1]; for (int x = outputIndex; x < limitX; x++) { if (dropoutNodes.contains(x)) { super.getLayerOutput()[x] = 0d; } else { super.getLayerOutput()[x] /= nonDropoutRate; } } final int offset = super.getContextTargetOffset()[currentLayer]; for(int x = 0; x < super.getContextTargetSize()[currentLayer]; x++) { super.getLayerOutput()[offset + x] = super.getLayerOutput()[outputIndex + x]; } }

Target:
protected void computeLayer(final int currentLayer, Set<Integer> dropoutNodes) { final int inputIndex = super.getLayerIndex()[currentLayer]; final int outputIndex = super.getLayerIndex()[currentLayer - 1]; final int inputSize = super.getLayerCounts()[currentLayer]; final int outputSize = super.getLayerFeedCounts()[currentLayer - 1]; int index = super.getWeightIndex()[currentLayer - 1]; final int limitX = outputIndex + outputSize; final int limitY = inputIndex + inputSize; for (int x = outputIndex; x < limitX; x++) { double sum = 0; for (int y = inputIndex; y < limitY; y++) { sum += super.getWeights()[index++] * super.getLayerOutput()[y]; } super.getLayerSums()[x] = sum; super.getLayerOutput()[x] = sum; } super.getActivationFunctions()[currentLayer - 1].activationFunction(super.getLayerOutput(), outputIndex, outputSize); if (isDropoutEnable(currentLayer - 1, dropoutNodes)) { final double nonDropoutRate = 1d - this.getLayerDropoutRates()[currentLayer - 1]; for (int x = outputIndex; x < limitX; x++) { if (dropoutNodes.contains(x)) { super.getLayerOutput()[x] = 0d; } else { super.getLayerOutput()[x] /= nonDropoutRate; } } } final int offset = super.getContextTargetOffset()[currentLayer]; for(int x = 0; x < super.getContextTargetSize()[currentLayer]; x++) { super.getLayerOutput()[offset + x] = super.getLayerOutput()[outputIndex + x]; } }
Source:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> contentStreamActivationOperation( Flux<ByteBuffer> data, long length, FormContentType formContentType) { Objects.requireNonNull(data, "'data' is required and cannot be null."); final long[] bufferedDataSize = {0}; final List<ByteBuffer> cachedBuffers = new LinkedList<>(); final AtomicBoolean[] isGuessed = {new AtomicBoolean(true)}; final ContentType[] contentType = new ContentType[1]; return pollingContext -> data.filter(ByteBuffer::hasRemaining) .windowUntil(buffer -> { if (bufferedDataSize[0] >= length) { return false; } bufferedDataSize[0] += buffer.remaining(); if (formContentType == null && isGuessed[0].get() && bufferedDataSize[0] >= 4) { byte[] bytes = buffer.array(); contentType[0] = getContentType(ByteBuffer.wrap(bytes)); isGuessed[0].compareAndSet(true, false); } ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); cachedBuffer.flip(); cachedBuffers.add(cachedBuffer); if (bufferedDataSize[0] >= length) { return true; } return false; }, true, Integer.MAX_VALUE) .next() .flatMap(newData -> { final ContentType contentTypeFinal = formContentType == null ? contentType[0] : ContentType.fromString(formContentType.toString()); return service.analyzeLayoutAsyncWithResponseAsync(contentTypeFinal, Flux.fromIterable(cachedBuffers), length).map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation()))); }); }

Target:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> contentStreamActivationOperation( Flux<ByteBuffer> data, long length, FormContentType formContentType) { Objects.requireNonNull(data, "'data' is required and cannot be null."); return pollingContext -> { if (formContentType != null) { try { return service.analyzeLayoutAsyncWithResponseAsync( ContentType.fromString(formContentType.toString()), data, length) .map(response -> new OperationResult(parseModelId( response.getDeserializedHeaders().getOperationLocation()))); } catch (RuntimeException ex) { return monoError(logger, ex); } } else { return detectContentType(data) .flatMap(contentType -> service.analyzeLayoutAsyncWithResponseAsync(contentType, data, length) .map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation())))); } }; }
Source:
static <S, T> Map<S, T> mergeDisjunctMaps(Map<? extends S, ? extends T> map1, Map<? extends S, ? extends T> map2) { Sets.SetView<? extends S> commonKeys = Sets.intersection(map1.keySet(), map2.keySet()); checkArgument(commonKeys.isEmpty(), "Maps must be disjunct. Common keys: %s", commonKeys); HashMap<S, T> merged = new HashMap(map1); merged.putAll(map2); return merged; }

Target:
static <S, T> Map<S, T> mergeDisjunctMaps(Map<? extends S, ? extends T> map1, Map<? extends S, ? extends T> map2) { Sets.SetView<? extends S> commonKeys = Sets.intersection(map1.keySet(), map2.keySet()); checkArgument(commonKeys.isEmpty(), "Maps must be disjunct. Common keys: %s", commonKeys); Map<S, T> merged = new HashMap<>(map1); merged.putAll(map2); return merged; }
Source:
public Action<?, ?> databaseRestoreFinished() { return new AbstractDatabaseRestoreAction<>(DatabaseRestoreSuccess.class) { @Override protected BackupRestoreContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, DatabaseRestoreSuccess payload) { return BackupRestoreContext.from(flowParameters, payload, null, null); } @Override protected void doExecute(BackupRestoreContext context, DatabaseRestoreSuccess payload, Map<Object, Object> variables) { backupRestoreStatusService.restoreDatabaseFinished(context.getStackId()); sendEvent(context); } @Override protected Selectable createRequest(BackupRestoreContext context) { return new StackEvent(DatabaseRestoreEvent.DATABASE_RESTORE_FINALIZED_EVENT.event(), context.getStackId()); } @Override protected Object getFailurePayload(DatabaseRestoreSuccess payload, Optional<BackupRestoreContext> flowContext, Exception ex) { return null; } }; }

Target:
public Action<?, ?> databaseRestoreFinished() { return new AbstractBackupRestoreActions<>(DatabaseRestoreSuccess.class) { @Override protected void doExecute(BackupRestoreContext context, DatabaseRestoreSuccess payload, Map<Object, Object> variables) { backupRestoreStatusService.restoreDatabaseFinished(context.getStackId()); sendEvent(context); } @Override protected Selectable createRequest(BackupRestoreContext context) { return new StackEvent(DatabaseRestoreEvent.DATABASE_RESTORE_FINALIZED_EVENT.event(), context.getStackId()); } }; }
Source:
public void testCacheConfigurationChangeFiresEvent () { Listener configurationListener = new Listener(); this.runtimeConfiguration.addCacheConfigurationListener(configurationListener); this.cache.getRuntimeConfiguration().updateResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10L, EntryUnit.ENTRIES).build()); assertThat(configurationListener.eventSet.size(), is(lessThan(2)) ); }

Target:
public void testCacheConfigurationChangeFiresEvent () { Listener configurationListener = new Listener(); List<CacheConfigurationChangeListener> cacheConfigurationChangeListeners = new ArrayList<CacheConfigurationChangeListener>(); cacheConfigurationChangeListeners.add(configurationListener); this.runtimeConfiguration.addCacheConfigurationListener(cacheConfigurationChangeListeners); this.cache.getRuntimeConfiguration().updateResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder() .heap(10L, EntryUnit.ENTRIES).build()); assertThat(configurationListener.eventSet.size(), is(1) ); }
Source:
public boolean attemptConnection() { boolean connected = false; try { for (int i = 0; i < 3; i++) { long timeout = Config.<Integer> getValue(ConfigValues.SetupNetworksPollingTimeout); FutureVDSCall<VDSReturnValue> task = Backend.getInstance().getResourceManager().runFutureVdsCommand(FutureVDSCommandType.TimeBoundPoll, new TimeBoundPollVDSCommandParameters(vds.getId(), timeout, TimeUnit.SECONDS)); VDSReturnValue returnValue = task.get(timeout, TimeUnit.SECONDS); connected = returnValue.getSucceeded(); if (connected) { break; } Thread.sleep(CONNECT_WAIT); } } catch (TimeoutException | InterruptedException ignored) { } return connected; }

Target:
public boolean attemptConnection() { boolean connected = false; try { for (int i = 0; i < NUMBER_OF_ATTEMPTS; i++) { long timeout = Config.<Integer> getValue(ConfigValues.SetupNetworksPollingTimeout); FutureVDSCall<VDSReturnValue> task = Backend.getInstance().getResourceManager().runFutureVdsCommand(FutureVDSCommandType.TimeBoundPoll, new TimeBoundPollVDSCommandParameters(vds.getId(), timeout, TimeUnit.SECONDS)); VDSReturnValue returnValue = task.get(timeout, TimeUnit.SECONDS); connected = returnValue.getSucceeded(); if (connected) { break; } Thread.sleep(CONNECT_WAIT); } } catch (TimeoutException | InterruptedException ignored) { } return connected; }
Source:
@Test public void testErrorMessage_ShouldReturnWrongSecondPassword() throws Exception { userManager.createUser("user1"); tester.startPage(UserListPage.class); tester.assertRenderedPage(UserListPage.class); tester.clickLink("lazy:userList:listContainer:form:list:0:item.update"); tester.executeAjaxEvent("lazy:userList:listContainer:form:list:0:item.update", "onclick"); FormTester formTester = tester.newFormTester("userDialogue:userEditorContainer:userForm"); formTester.setValue("username", "user1"); formTester.setValue("password", "password"); formTester.setValue("passwordVerification", "password2"); formTester.submit(); tester.assertErrorMessages(new String[]{ localization(UserListPage.class, "passwordError")}); }

Target:
public void testErrorMessage_ShouldReturnWrongSecondPassword() throws Exception { userManager.createUser("user1"); tester.startPage(UserListPage.class); tester.assertRenderedPage(UserListPage.class); tester.clickLink("lazy:userList:listContainer:form:list:0:item.update"); tester.executeAjaxEvent("lazy:userList:listContainer:form:list:0:item.update", "onclick"); FormTester formTester = tester.newFormTester("userDialogue:userEditorContainer:userForm"); formTester.setValue("username", "user1"); formTester.setValue("password", "password"); formTester.setValue("passwordVerification", "password2"); formTester.submit(); tester.assertErrorMessages(new String[]{ localization(UserListPage.class, "passwordError")}); }