auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void saveEventType(EventType eventType) throws InternalNakadiException, DuplicatedEventTypeNameException; EventType findByName(String name) throws InternalNakadiException, NoSuchEventTypeException; void update(EventType eventType) throws InternalNakadiException, NoSuchEventTypeException; List<EventType> list(); void removeEventType(String name) throws InternalNakadiException, NoSuchEventTypeException; default Optional<EventType> findByNameO(String eventTypeName) throws InternalNakadiException { try { return Optional.of(findByName(eventTypeName)); } catch (NoSuchEventTypeException e) { return Optional.empty(); } catch (InternalNakadiException e) { throw e; } }

Target:
void saveEventType(EventType eventType) throws InternalNakadiException, DuplicatedEventTypeNameException; EventType findByName(String name) throws InternalNakadiException, NoSuchEventTypeException; void update(EventType eventType) throws InternalNakadiException, NoSuchEventTypeException; List<EventType> list(); void removeEventType(String name) throws InternalNakadiException, NoSuchEventTypeException; default Optional<EventType> findByNameO(final String eventTypeName) throws InternalNakadiException { try { return Optional.of(findByName(eventTypeName)); } catch (final NoSuchEventTypeException e) { return Optional.empty(); } catch (final InternalNakadiException e) { throw e; } }
Source:
private void checkWorkspaceStatusAndDelete(String workspaceName) throws Exception { if (!testWorkspaceServiceClient.exists(workspaceName, defaultTestUser.getName())) { return; } testWorkspaceServiceClient.delete(workspaceName, defaultTestUser.getName()); }

Target:
private void checkWorkspaceStatusAndDelete(String workspaceName) throws Exception { if (testWorkspaceServiceClient.exists(workspaceName, defaultTestUser.getName())) { testWorkspaceServiceClient.delete(workspaceName, defaultTestUser.getName()); } }
Source:
public void clickOnOkBtn() { webDriverHelper.waitAndClick((saveBtn)); loader.waitOnClosed(); }

Target:
public void clickOnOkBtn() { webDriverHelper.waitAndClick(saveBtn); loader.waitOnClosed(); }
Source:
JobRecoveryException(final String message) { super(message); }

Target:
public JobRecoveryException(final String message) { super(message); }
Source:
public String getPattern() { return rule.toString(); }

Target:
public String getPattern() { String pattern = rule.toString(); if (pattern.startsWith("!")) { pattern = pattern.substring(1); } return rule.toString(); }
Source:
public Object decode(Response response, Type type) throws IOException, FeignException { if (HeaderAccessUtils.shortcircuitingCaseInsensitiveContainsEntry( response.headers(), HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN)) { return stringDecoder.decode(response, type); } return delegate.decode(response, type); }

Target:
public Object decode(Response response, Type type) throws IOException, FeignException { if (HeaderAccessUtils.shortcircuitingCaseInsensitiveContainsEntry( response.headers(), CONTENT_TYPE, MediaType.TEXT_PLAIN)) { return stringDecoder.decode(response, type); } return delegate.decode(response, type); }
Source:
public static String formatCourseDate(String date) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, MMM dd, yyyy"); Date startDate = DateUtil.convertToDate(date); String formattedDate = dateFormat.format(startDate); return formattedDate; } catch (Exception e) { logger.error(e); return ""; } }

Target:
public static String formatCourseDate(String date) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, MMM dd, yyyy"); Date startDate = DateUtil.convertToDate(date); return dateFormat.format(startDate); } catch (Exception e) { logger.error(e); } return ""; }
Source:
public void setup(StreamContext context) { StreamCodec<?> codec = context.get(StreamContext.CODEC); if (codec == null) { statefulSerde = ((StatefulStreamCodec<Object>)StreamContext.CODEC.defaultValue).newInstance(); } else if (codec instanceof StatefulStreamCodec) { statefulSerde = ((StatefulStreamCodec<Object>)codec).newInstance(); if (!codec.getClass().isAssignableFrom(statefulSerde.getClass())) { throw new RuntimeException(String.format("%s newInstance returned incompatible object of class %s", codec.getClass().getName(), statefulSerde.getClass().getName())); } } else { serde = (StreamCodec<Object>)codec; } }

Target:
public void setup(StreamContext context) { StreamCodec<?> codec = context.get(StreamContext.CODEC); if (codec == null) { statefulSerde = ((StatefulStreamCodec<Object>)StreamContext.CODEC.defaultValue).newInstance(); } else if (codec instanceof StatefulStreamCodec) { statefulSerde = ((StatefulStreamCodec<Object>)codec).newInstance(); } else { serde = (StreamCodec<Object>)codec; } }
Source:
public void shouldFailWhenMakeGeoBoundingBoxESHintQueryWithIllegalArguments() { Optional<ESHintQueryBuilder> geoBoundingBoxESHintQueryBuilder = elasticSearchAdmin.getHintByOperator( GeoBoundingBoxQueryBuilder.NAME); assertTrue(geoBoundingBoxESHintQueryBuilder.isPresent()); try { geoBoundingBoxESHintQueryBuilder.get().make(null, ANY_FIELD_NAME, new String[5]); fail("Should raise an IllegalArgumentException"); } catch (IllegalArgumentException ia) { assertEquals( "Hint: org.nuxeo.elasticsearch.hint.GeoBoundingBoxESHintQueryBuilder requires 2 parameters: bottomLeft and topRight point", ia.getMessage()); } }

Target:
public void shouldFailWhenMakeGeoBoundingBoxESHintQueryWithIllegalArguments() { Optional<ESHintQueryBuilder> geoBoundingBoxESHintQueryBuilder = elasticSearchAdmin.getHintByOperator( GeoBoundingBoxQueryBuilder.NAME); assertTrue(geoBoundingBoxESHintQueryBuilder.isPresent()); try { geoBoundingBoxESHintQueryBuilder.get().make(null, ANY_FIELD_NAME, new String[5]); fail("Should raise a NuxeoException"); } catch (NuxeoException ne) { assertEquals("Hints: GeoBoundingBoxESHintQueryBuilder requires 2 parameters: bottomLeft and topRight point", ne.getMessage()); assertEquals(SC_BAD_REQUEST, ne.getStatusCode()); } }
Source:
public RelationSupportInternal<CatalogItem<T,SpecT>> relations() { throw new UnsupportedOperationException(); }

Target:
public RelationSupportInternal<CatalogItem<T,SpecT>> relations() { return new EmptyRelationSupport<CatalogItem<T,SpecT>>(this); }
Source:
public void should_prevent_simultaneous_reconnection_attempts() throws InterruptedException { CCMBridge ccm = null; Cluster cluster = null; QueryPlanCountingPolicy loadBalancingPolicy = new QueryPlanCountingPolicy(Policies.defaultLoadBalancingPolicy()); AtomicInteger reconnectionAttempts = loadBalancingPolicy.counter; ReconnectionPolicy reconnectionPolicy = new ReconnectionPolicy() { @Override public ReconnectionSchedule newSchedule() { return new ReconnectionSchedule() { @Override public long nextDelayMs() { return 60 * 1000; } }; } }; try { ccm = CCMBridge.builder().withNodes(2).build(); cluster = Cluster.builder() .addContactPoint(CCMBridge.ipOfNode(1)) .withReconnectionPolicy(reconnectionPolicy) .withLoadBalancingPolicy(loadBalancingPolicy) .build(); cluster.init(); ccm.stop(1); TimeUnit.SECONDS.sleep(1); assertThat(reconnectionAttempts.get()).isEqualTo(1); ccm.stop(2); TimeUnit.SECONDS.sleep(1); assertThat(reconnectionAttempts.get()).isEqualTo(2); } finally { if (cluster != null) cluster.close(); if (ccm != null) ccm.remove(); } }

Target:
public void should_prevent_simultaneous_reconnection_attempts() throws InterruptedException { Cluster cluster = null; QueryPlanCountingPolicy loadBalancingPolicy = new QueryPlanCountingPolicy(Policies.defaultLoadBalancingPolicy()); AtomicInteger reconnectionAttempts = loadBalancingPolicy.counter; ReconnectionPolicy reconnectionPolicy = new ReconnectionPolicy() { @Override public ReconnectionSchedule newSchedule() { return new ReconnectionSchedule() { @Override public long nextDelayMs() { return 60 * 1000; } }; } }; try { cluster = Cluster.builder() .addContactPointsWithPorts(singleton(ccmSupport.getContactPoints().get(0))) .withAddressTranslater(ccmSupport.getAddressTranslator()) .withReconnectionPolicy(reconnectionPolicy) .withLoadBalancingPolicy(loadBalancingPolicy) .build(); cluster.init(); ccmSupport.ccmBridge().stop(1); TimeUnit.SECONDS.sleep(1); assertThat(reconnectionAttempts.get()).isEqualTo(1); ccmSupport.ccmBridge().stop(2); TimeUnit.SECONDS.sleep(1); assertThat(reconnectionAttempts.get()).isEqualTo(2); } finally { if (cluster != null) cluster.close(); } }
Source:
public String translate(Enum<?> key) { if(key == null) { logger.log(Level.INFO, "trying to localize null, probable error. " + "Exception is not thrown, returning '"+ constants.notAvailableLabel()+"'", new RuntimeException()); return constants.notAvailableLabel(); } try { final String translatedString = enums.getString(keyToTranslate(key)); return translatedString != null? translatedString : notLocalizedKey(key); } catch (MissingResourceException e) { return notLocalizedKey(key, e); } }

Target:
public String translate(Enum<?> key) { if (key == null) { final String result = constants.notAvailableLabel(); logger.warning("trying to localize null, probable error. " + "Exception is not thrown, returning '" + result + "'"); return result; } try { final String translatedString = enums.getString(keyToTranslate(key)); return translatedString != null ? translatedString : notLocalizedKey(key); } catch (MissingResourceException e) { return notLocalizedKey(key, e); } }
Source:
public Archive<?> createAuxiliaryArchive() { JavaArchive archive = ShrinkWrap.create(JavaArchive.class); archive .addPackages(true, org.eclipse.microprofile.lra.annotation.Compensate.class.getPackage()); archive.addPackages(true, io.narayana.lra.client.NarayanaLRAClient.class.getPackage()) .addPackages(true, io.narayana.lra.Current.class.getPackage()) .addPackage(LRACDIExtension.class.getPackage()) .addAsResource("META-INF/services/javax.enterprise.inject.spi.Extension") .addClass(org.jboss.weld.exceptions.DefinitionException.class) .addAsManifestResource(new StringAsset("<beans version=\"1.1\" bean-discovery-mode=\"annotated\"></beans>"), "beans.xml"); String filtersAsset = String.format("%s%n%s", io.narayana.lra.filter.ClientLRAResponseFilter.class.getName(), io.narayana.lra.filter.ClientLRARequestFilter.class.getName()); archive.addPackages(true, io.narayana.lra.filter.ClientLRARequestFilter.class.getPackage()) .addAsResource(new StringAsset(filtersAsset), "META-INF/services/javax.ws.rs.ext.Providers") .addAsResource(new StringAsset("org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder"), "META-INF/services/javax.ws.rs.client.ClientBuilder"); return archive; }

Target:
public Archive<?> createAuxiliaryArchive() { JavaArchive archive = ShrinkWrap.create(JavaArchive.class) .addPackages(true, org.eclipse.microprofile.lra.annotation.Compensate.class.getPackage()); archive.addPackages(true, io.narayana.lra.client.NarayanaLRAClient.class.getPackage()) .addPackages(true, io.narayana.lra.Current.class.getPackage()) .addPackage(LRACDIExtension.class.getPackage()) .addAsResource("META-INF/services/javax.enterprise.inject.spi.Extension") .addClass(org.jboss.weld.exceptions.DefinitionException.class) .addAsManifestResource(new StringAsset("<beans version=\"1.1\" bean-discovery-mode=\"annotated\"></beans>"), "beans.xml"); String filtersAsset = String.format("%s%n%s", io.narayana.lra.filter.ClientLRAResponseFilter.class.getName(), io.narayana.lra.filter.ClientLRARequestFilter.class.getName()); archive.addPackages(true, io.narayana.lra.filter.ClientLRARequestFilter.class.getPackage()) .addAsResource(new StringAsset(filtersAsset), "META-INF/services/javax.ws.rs.ext.Providers") .addAsResource(new StringAsset("org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder"), "META-INF/services/javax.ws.rs.client.ClientBuilder"); return archive; }
Source:
public void canRecalculateCommandWhenFileOrOptionsChanged() throws IOException { File firstFile = File.createTempFile("first", ".txt"); String firstOptions = "-f options"; File secondFile = File.createTempFile("second", ".txt"); String secondOptions = "-f newoptions"; OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer(); adapter.setFile(firstFile); adapter.setOptions(firstOptions); adapter.setOutputChannel(new QueueChannel()); adapter.setTailAttemptsDelay(500); adapter.setBeanFactory(mock(BeanFactory.class)); adapter.afterPropertiesSet(); assertEquals("tail " + firstOptions + " " + firstFile.getAbsolutePath(), adapter.getCommand()); adapter.setFile(secondFile); assertEquals("tail " + firstOptions + " " + secondFile.getAbsolutePath(), adapter.getCommand()); adapter.setOptions(secondOptions); assertEquals("tail " + secondOptions + " " + secondFile.getAbsolutePath(), adapter.getCommand()); }

Target:
public void canRecalculateCommandWhenFileOrOptionsChanged() throws IOException { File firstFile = File.createTempFile("first", ".txt"); String firstOptions = "-f options"; File secondFile = File.createTempFile("second", ".txt"); String secondOptions = "-f newoptions"; OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer(); adapter.setFile(firstFile); adapter.setOptions(firstOptions); adapter.setOutputChannel(new QueueChannel()); adapter.setTailAttemptsDelay(500); adapter.setBeanFactory(mock(BeanFactory.class)); adapter.afterPropertiesSet(); adapter.start(); assertEquals("tail " + firstOptions + " " + firstFile.getAbsolutePath(), adapter.getCommand()); adapter.stop(); adapter.setFile(secondFile); adapter.start(); assertEquals("tail " + firstOptions + " " + secondFile.getAbsolutePath(), adapter.getCommand()); adapter.stop(); adapter.setOptions(secondOptions); adapter.start(); assertEquals("tail " + secondOptions + " " + secondFile.getAbsolutePath(), adapter.getCommand()); adapter.stop(); }
Source:
public ImmutableValue<Boolean> persists() { return cachedValue; }

Target:
public ImmutableValue<Boolean> persists() { return getValueGetter(); }
Source:
private void storeCookiesIntoCookieJar(Map<String, Object> requestHeadersParam) { try { if (requestHeadersParam.containsKey("Cookie") && requestHeadersParam.get("Cookie") instanceof String) { String cookieString = (String) requestHeadersParam.get("Cookie"); if (remote != null) { Cookie cookie = Cookie.parse(HttpUrl.get(remote), cookieString); if (cookie != null && replicationInternal != null) { replicationInternal.setCookie(cookie); } } } } catch (Exception e) { Log.e(Log.TAG_SYNC, "Failed to store SyncGatewaySession into the CookieJar.", e); } }

Target:
private void storeCookiesIntoCookieJar(Map<String, Object> requestHeadersParam) { try { if (requestHeadersParam != null && requestHeadersParam.containsKey("Cookie") && requestHeadersParam.get("Cookie") instanceof String) { String cookieString = (String) requestHeadersParam.get("Cookie"); if (remote != null) { Cookie cookie = Cookie.parse(HttpUrl.get(remote), cookieString); if (cookie != null) { replicationInternal.setCookie(cookie); requestHeadersParam.remove("Cookie"); } } } } catch (Exception e) { Log.e(Log.TAG_SYNC, "Failed to store SyncGatewaySession into the CookieJar.", e); } }
Source:
public static Field lookupWriterField(final Schema writerSchema, final Field readerField) { assert (writerSchema.getType() == Type.RECORD); final List<Field> writerFields = new ArrayList<>(); final Field direct = writerSchema.getField(readerField.name()); if (direct != null) { writerFields.add(direct); } for (final String readerFieldAliasName : readerField.aliases()) { final Field writerField = writerSchema.getField(readerFieldAliasName); if (writerField != null) { writerFields.add(writerField); } } switch (writerFields.size()) { case 0: return null; case 1: return writerFields.get(0); default: { throw new AvroRuntimeException(String.format( "Reader record field %s matches multiple fields in writer record schema %s", readerField, writerSchema)); } } }

Target:
public static Field lookupWriterField(final Schema writerSchema, final Field readerField) { assert (writerSchema.getType() == Type.RECORD); final List<Field> writerFields = new ArrayList<Field>(); final Field direct = writerSchema.getField(readerField.name()); if (direct != null) { writerFields.add(direct); } for (final String readerFieldAliasName : readerField.aliases()) { final Field writerField = writerSchema.getField(readerFieldAliasName); if (writerField != null) { writerFields.add(writerField); } } switch (writerFields.size()) { case 0: return null; case 1: return writerFields.get(0); default: { throw new AvroRuntimeException(String.format( "Reader record field %s matches multiple fields in writer record schema %s", readerField, writerSchema)); } } }
Source:
public URL getURL() { try { return new URL(url.toString()); } catch (MalformedURLException e) { return null; } }

Target:
public URL getURL() { return url; }
Source:
public void close() { if (client == null) { return; } try { client.close(); } catch (Exception e) { log.warn("Error closing client", e); } }

Target:
public void close() { if (client == null) { return; } try { client.close(); } catch (Exception e) { log.warn(e, "Error closing client"); } client = null; }
Source:
protected void updateServer() { updateServer(false); if (logDiagnosticEvents) { Diagnostics.getLogger().flushEvents(); } }

Target:
protected void updateServer() { updateServer(false); Diagnostics.getLogger().flushEvents(); }
Source:
public void setMethod(final ZonemasterRequest.Method method) { this.method = method.getMethod(); this.id = method.getId(); }

Target:
protected void setMethod(final ZonemasterRequest.Method method) { this.method = method.getMethod(); this.id = method.getId(); }
Source:
protected boolean canDoAction() { init(); if (isImagesAlreadyOnTarget()) { if (ovfEntityData == null && !getParameters().isImportAsNewEntity()) { return false; } setStorageDomainId(ovfEntityData.getStorageDomainId()); if (!validate(new StorageDomainValidator(getStorageDomain()).isDomainExistAndActive())) { return false; } if (!getStorageDomain().getStorageDomainType().isDataDomain()) { addCanDoActionMessage("$domainId " + getParameters().getStorageDomainId()); addCanDoActionMessage("$domainType " + getStorageDomain().getStorageDomainType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED); return false; } } getParameters().setImages(getVmTemplate().getImages()); return super.canDoAction(); }

Target:
protected boolean canDoAction() { init(); if (isImagesAlreadyOnTarget()) { if (ovfEntityData == null && !getParameters().isImportAsNewEntity()) { return false; } setStorageDomainId(ovfEntityData.getStorageDomainId()); if (!validate(new StorageDomainValidator(getStorageDomain()).isDomainExistAndActive())) { return false; } if (!getStorageDomain().getStorageDomainType().isDataDomain()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED, String.format("$domainId %1$s", getParameters().getStorageDomainId()), String.format("$domainType %1$s", getStorageDomain().getStorageDomainType())); } } getParameters().setImages(getVmTemplate().getImages()); return super.canDoAction(); }
Source:
protected void selectionUpdatedHandler(SelectionUpdatedEvent event) { ListGridRecord[] selectedRecords = this.getSelectedRecords(); ArrayList<Integer> selectedJobsIds = new ArrayList<>(); for (ListGridRecord selectedRecord : selectedRecords) { selectedJobsIds.add(JobRecord.getJob(selectedRecord).getId()); } controller.getModel().setSelectedJobsIds(selectedJobsIds); }

Target:
protected void selectionUpdatedHandler(SelectionUpdatedEvent event) { ListGridRecord[] selectedRecords = this.getSelectedRecords(); List<Integer> selectedJobsIds = new ArrayList<>(selectedRecords.length); for (ListGridRecord selectedRecord : selectedRecords) { selectedJobsIds.add(JobRecord.getJob(selectedRecord).getId()); } controller.getModel().setSelectedJobsIds(selectedJobsIds); }
Source:
public String filterAll() { try { List<TaskDTO> tasks; if (!showAutomaticTasks) { if (hideCorrectionTasks) { tasks = serviceManager.getTaskService() .findOpenNotAutomaticTasksWithoutCorrectionForCurrentUser(sortList()); } else { tasks = serviceManager.getTaskService().findOpenNotAutomaticTasksForCurrentUser(sortList()); } } else { if (hideCorrectionTasks) { tasks = serviceManager.getTaskService().findOpenTasksWithoutCorrectionForCurrentUser(sortList()); } else { tasks = serviceManager.getTaskService().findOpenTasksForCurrentUser(sortList()); } } this.page = new Page<>(0, tasks); } catch (DataException e) { Helper.setFehlerMeldung("Error on reading ElasticSearch: ", e.getMessage()); return null; } return redirectToList("?faces-redirect=true"); }

Target:
public String filterAll() { try { List<TaskDTO> tasks; if (!showAutomaticTasks) { if (hideCorrectionTasks) { tasks = serviceManager.getTaskService() .findOpenNotAutomaticTasksWithoutCorrectionForCurrentUser(sortList()); } else { tasks = serviceManager.getTaskService().findOpenNotAutomaticTasksForCurrentUser(sortList()); } } else { if (hideCorrectionTasks) { tasks = serviceManager.getTaskService().findOpenTasksWithoutCorrectionForCurrentUser(sortList()); } else { tasks = serviceManager.getTaskService().findOpenTasksForCurrentUser(sortList()); } } this.page = new Page<>(0, tasks); } catch (DataException e) { Helper.setFehlerMeldung("Error on reading ElasticSearch: ", e.getMessage()); return null; } return redirectToList(); }
Source:
public Material getType() { Material mat = Material.getMaterial(getTypeId()); return (mat == null ? Material.AIR : mat); }

Target:
public Material getType() { return Material.getMaterial(getTypeId()); }
Source:
public void onErrorThrows() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { final List<Object> received = new ArrayList<Object>(); BoundedSubscriber<Object> o = new BoundedSubscriber<Object>(new Consumer<Object>() { @Override public void accept(Object o) throws Exception { received.add(o); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throw new TestException("Inner"); } }, new Action() { @Override public void run() throws Exception { received.add(1); } }, new Functions.BoundedConsumer(128) { @Override public void accept(Subscription subscription) throws Exception { subscription.request(bufferSize); } }); assertFalse(o.isDisposed()); Flowable.<Integer>error(new TestException("Outer")).subscribe(o); assertTrue(received.toString(), received.isEmpty()); assertTrue(o.isDisposed()); TestHelper.assertError(errors, 0, CompositeException.class); List<Throwable> ce = TestHelper.compositeList(errors.get(0)); TestHelper.assertError(ce, 0, TestException.class, "Outer"); TestHelper.assertError(ce, 1, TestException.class, "Inner"); } finally { RxJavaPlugins.reset(); } }

Target:
public void onErrorThrows() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { final List<Object> received = new ArrayList<Object>(); BoundedSubscriber<Object> o = new BoundedSubscriber<Object>(new Consumer<Object>() { @Override public void accept(Object o) throws Exception { received.add(o); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throw new TestException("Inner"); } }, new Action() { @Override public void run() throws Exception { received.add(1); } }, new Consumer<Subscription>() { @Override public void accept(Subscription subscription) throws Exception { subscription.request(128); } }, 128); assertFalse(o.isDisposed()); Flowable.<Integer>error(new TestException("Outer")).subscribe(o); assertTrue(received.toString(), received.isEmpty()); assertTrue(o.isDisposed()); TestHelper.assertError(errors, 0, CompositeException.class); List<Throwable> ce = TestHelper.compositeList(errors.get(0)); TestHelper.assertError(ce, 0, TestException.class, "Outer"); TestHelper.assertError(ce, 1, TestException.class, "Inner"); } finally { RxJavaPlugins.reset(); } }
Source:
public void visitIdentifier(IdentifierTree tree) { Type type = tree.symbolType(); if (!classType.is(type.fullyQualifiedName()) && type.isSubtypeOf(classType)) { reportIssue(tree, String.format("Remove this reference to \"%s\".", type.symbol().name())); } }

Target:
public void visitIdentifier(IdentifierTree tree) { Type type = tree.symbolType(); if (type instanceof MethodJavaType) { type = ((MethodJavaType) type).resultType(); } if (!classType.equals(type) && type.isSubtypeOf(classType)) { reportIssue(tree, String.format("Remove this reference to \"%s\".", type.symbol().name())); } }
Source:
private void init() { inflate(getContext(), R.layout.filtered_list_component, this); int spacingHorizontal = 0; int spacingVertical = DisplayUtils.dpToPx(getContext(), 1); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.addItemDecoration(new RecyclerItemDecoration(spacingHorizontal, spacingVertical)); mToolbar = (Toolbar) findViewById(R.id.toolbar_with_spinner); mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout); mEmptyView = (TextView) findViewById(R.id.empty_view); mProgressLoadMore = (ProgressBar) findViewById(R.id.progress_loading); mProgressLoadMore.setVisibility(View.GONE); mSwipeToRefreshHelper = new SwipeToRefreshHelper( (CustomSwipeRefreshLayout) findViewById(R.id.ptr_layout), new SwipeToRefreshHelper.RefreshListener() { @Override public void onRefreshStarted() { post(new Runnable() { @Override public void run() { if (!NetworkUtils.checkConnection(getContext())) { mSwipeToRefreshHelper.setRefreshing(false); updateEmptyView(EmptyViewMessageType.NETWORK_ERROR); return; } if (mFilterListener != null){ mFilterListener.onLoadData(); } } }); } }, R.color.color_primary, R.color.color_accent ); if (mSpinner == null) { mSpinner = (Spinner) findViewById(R.id.filter_spinner); } }

Target:
private void init() { inflate(getContext(), R.layout.filtered_list_component, this); int spacingHorizontal = 0; int spacingVertical = DisplayUtils.dpToPx(getContext(), 1); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.addItemDecoration(new RecyclerItemDecoration(spacingHorizontal, spacingVertical)); mToolbar = (Toolbar) findViewById(R.id.toolbar_with_spinner); mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout); mEmptyView = (TextView) findViewById(R.id.empty_view); mProgressLoadMore = (ProgressBar) findViewById(R.id.progress_loading); mProgressLoadMore.setVisibility(View.GONE); mSwipeToRefreshHelper = buildSwipeToRefreshHelper( (CustomSwipeRefreshLayout) findViewById(R.id.ptr_layout), new SwipeToRefreshHelper.RefreshListener() { @Override public void onRefreshStarted() { post(new Runnable() { @Override public void run() { if (!NetworkUtils.checkConnection(getContext())) { mSwipeToRefreshHelper.setRefreshing(false); updateEmptyView(EmptyViewMessageType.NETWORK_ERROR); return; } if (mFilterListener != null){ mFilterListener.onLoadData(); } } }); } } ); if (mSpinner == null) { mSpinner = (Spinner) findViewById(R.id.filter_spinner); } }
Source:
public static String toCanonicalFilePath(URL fileURL) throws URISyntaxException, IOException { if (fileURL == null) { return null; } if (!fileURL.getProtocol().equals("jar") && !fileURL.getProtocol().equals("file")) { return null; } if (fileURL.getProtocol().equals("jar")) { JarURLConnection jarURLConnection = (JarURLConnection) fileURL.openConnection(); fileURL = jarURLConnection.getJarFileURL(); } URI fileURI = fileURL.toURI(); File file = new File(fileURI); File canonicalFile = file.getCanonicalFile(); return canonicalFile.toURI().toString(); }

Target:
public static String toCanonicalFilePath(URL fileURL) throws URISyntaxException, IOException { if (fileURL == null) { return null; } if (!"jar".equals(fileURL.getProtocol()) && !"file".equals(fileURL.getProtocol())) { return null; } if ("jar".equals(fileURL.getProtocol())) { JarURLConnection jarURLConnection = (JarURLConnection) fileURL.openConnection(); fileURL = jarURLConnection.getJarFileURL(); } URI fileURI = fileURL.toURI(); File file = new File(fileURI); File canonicalFile = file.getCanonicalFile(); return canonicalFile.toURI().toString(); }
Source:
protected void updateDatastreamProperties(ObjectReference obj, DatastreamVersion v, FedoraDatastream ds) { QuadDataAcc triplesToInsert = new QuadDataAcc(); QuadAcc triplesToRemove = new QuadAcc(); String createdDate = v.getCreated(); if (v.isFirstVersionIn(obj)) { String dsid = v.getDatastreamInfo().getDatastreamId(); if (dsid != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_1>", dsid); } if (createdDate != null) { updateDateTriple(triplesToRemove, triplesToInsert, "<LINK_6>", createdDate); } } if (createdDate != null) { updateModifiedDate(triplesToRemove, triplesToInsert, createdDate); } String label = v.getLabel(); if (label != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_2>", label); } String state = v.getDatastreamInfo().getState(); if (state != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_0>", state); } String formatUri = v.getFormatUri(); if (formatUri != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_5>", formatUri); } if (!triplesToInsert.getQuads().isEmpty() && !triplesToRemove.getQuads().isEmpty()) { updateResourceProperties(ds, triplesToRemove, triplesToInsert); } }

Target:
protected void updateDatastreamProperties(ObjectReference obj, DatastreamVersion v, FedoraDatastream ds) { QuadDataAcc triplesToInsert = new QuadDataAcc(); QuadAcc triplesToRemove = new QuadAcc(); String createdDate = v.getCreated(); if (v.isFirstVersionIn(obj)) { String now = getCurrentTimeInXSDDateTime(); if (now != null) { addDateEvent(triplesToInsert, "<LINK_3>", getCurrentTimeInXSDDateTime()); } if (createdDate != null) { updateDateTriple(triplesToRemove, triplesToInsert, "<LINK_6>", createdDate); } } if (v.isLastVersionIn(obj)) { String dsid = v.getDatastreamInfo().getDatastreamId(); if (dsid != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_1>", dsid); } if (createdDate != null) { addDateEvent(triplesToInsert, "<LINK_4>", createdDate); } String label = v.getLabel(); if (label != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_2>", label); } String state = v.getDatastreamInfo().getState(); if (state != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_0>", state); } String formatUri = v.getFormatUri(); if (formatUri != null) { updateTriple(triplesToRemove, triplesToInsert, "<LINK_5>", formatUri); } } if (!triplesToInsert.getQuads().isEmpty() && !triplesToRemove.getQuads().isEmpty()) { updateResourceProperties(ds, triplesToRemove, triplesToInsert); } }
Source:
static Template parsedTemplateForResource(String resourceName) { String jar = getJARFromURL(AutoValueTemplateVars.class); InputStream in = null; if (jar != null) { File file = new File(jar); try { JarFile jarFile = new JarFile(file); ZipEntry entry = jarFile.getEntry("com/google/auto/value/processor/".replace('/', File.separatorChar) + resourceName); in = jarFile.getInputStream(entry); } catch (IOException e) { } } if (in == null) { in = AutoValueTemplateVars.class.getResourceAsStream(resourceName); } if (in == null) { throw new IllegalArgumentException("Could not find resource: " + resourceName); } try { Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); return Template.parseFrom(reader); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } catch (IOException e) { throw new AssertionError(e); } }

Target:
static Template parsedTemplateForResource(String resourceName) { String jar = getJARFromURL(AutoValueTemplateVars.class); InputStream in = null; if (jar != null) { File file = new File(jar); try { JarFile jarFile = new JarFile(file); ZipEntry entry = jarFile.getEntry("com/google/auto/value/processor/".replace('/', File.separatorChar) + resourceName); in = jarFile.getInputStream(entry); } catch (Exception ignored) { } } if (in == null) { in = AutoValueTemplateVars.class.getResourceAsStream(resourceName); } if (in == null) { throw new IllegalArgumentException("Could not find resource: " + resourceName); } try { Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); return Template.parseFrom(reader); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } catch (IOException e) { throw new AssertionError(e); } }
Source:
public static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) { Set methods = new HashSet(); for (int i = 0; i < properties.length; i++) { PropertyDescriptor pd = properties[i]; if (read) { methods.add(pd.getReadMethod()); } if (write) { methods.add(pd.getWriteMethod()); } } methods.remove(null); return (Method[]) methods.toArray(new Method[0]); }

Target:
public static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) { Set methods = new HashSet(); for (int i = 0; i < properties.length; i++) { PropertyDescriptor pd = properties[i]; if (read) { methods.add(pd.getReadMethod()); } if (write) { methods.add(pd.getWriteMethod()); } } methods.remove(null); return (Method[]) methods.toArray(new Method[methods.size()]); }
Source:
public int execute(File runFile, String task, File workingDir, Operation operation) throws Exception { try (Bndrun run = init(runFile, task, workingDir)) { run.getInfo(run.getWorkspace()); int errors = report(run); if (!run.isOk()) { return errors; } return operation.apply(runFile, getNamePart(runFile), run); } }

Target:
public int execute(File runFile, String task, File workingDir, Operation operation) throws Exception { try (Bndrun run = init(runFile, task, workingDir)) { if (run == null) { return 1; } int errors = report(run); if (!run.isOk()) { return errors; } injectImplicitRepository(run); return operation.apply(runFile, getNamePart(runFile), run); } }
Source:
private void initGUI() { ArrayList<Part> spareParts = campaign.getSpareParts(); for(Part spare : spareParts) { if(spare instanceof AmmoStorage && ((EquipmentPart)spare).getType() instanceof BombType && spare.isPresent()) { int bombType = (BombType.getBombTypeFromInternalName(((AmmoStorage)spare).getType().getInternalName())); bombCatalog[bombType] = spare.getId(); availBombs[bombType] = ((AmmoStorage)spare).getShots(); } } for (int type = 0; type < BombType.B_NUM; type++) { typeMax[type] = availBombs[type] + bombChoices[type]; } bombPanel = new BombChoicePanel(bomber, campaign.getGameOptions().booleanOption("at2_nukes"), campaign.getGameOptions().booleanOption("allow_advanced_ammo"), typeMax); JScrollPane scroller = new JScrollPane(bombPanel); scroller.setPreferredSize(new Dimension(300, 200)); setLayout(new BorderLayout()); add(scroller, BorderLayout.CENTER); add(buildButtonPanel(), BorderLayout.SOUTH); }

Target:
private void initGUI() { List<Part> spareParts = campaign.getSpareParts(); for(Part spare : spareParts) { if(spare instanceof AmmoStorage && ((EquipmentPart)spare).getType() instanceof BombType && spare.isPresent()) { int bombType = (BombType.getBombTypeFromInternalName(((AmmoStorage)spare).getType().getInternalName())); bombCatalog[bombType] = spare.getId(); availBombs[bombType] = ((AmmoStorage)spare).getShots(); } } for (int type = 0; type < BombType.B_NUM; type++) { typeMax[type] = availBombs[type] + bombChoices[type]; } bombPanel = new BombChoicePanel(bomber, campaign.getGameOptions().booleanOption("at2_nukes"), campaign.getGameOptions().booleanOption("allow_advanced_ammo"), typeMax); JScrollPane scroller = new JScrollPane(bombPanel); scroller.setPreferredSize(new Dimension(300, 200)); setLayout(new BorderLayout()); add(scroller, BorderLayout.CENTER); add(buildButtonPanel(), BorderLayout.SOUTH); }
Source:
public void testFindLiveVersionHTMLPage() throws Exception{ String ext="."+Config.getStringProperty("VELOCITY_PAGE_EXTENSION"); Template template=new Template(); template.setTitle("TEST TEMPLATE VERSIONABLE"); template.setBody("<html><body> I'm mostly empty </body></html>"); template=APILocator.getTemplateAPI().saveTemplate(template, host, user, false); Folder folder = APILocator.getFolderAPI().createFolders("/testingVersionable", host, user, false); HTMLPage page=new HTMLPage(); page.setPageUrl("testpage"+ext); page.setFriendlyName("testpage"+ext); page.setTitle("testpage"+ext); page=APILocator.getHTMLPageAPI().saveHTMLPage(page, template, folder, user, false); APILocator.getVersionableAPI().setLive(page); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(page.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),page.getTitle()); assertEquals(verAPI.getInode(),page.getInode()); APILocator.getHTMLPageAPI().delete(page, user, false); APILocator.getFolderAPI().delete(folder, user, false); APILocator.getTemplateAPI().delete(template, user, false); }

Target:
public void testFindLiveVersionHTMLPage() throws Exception{ HTMLPage page = createHTMLPage(); APILocator.getVersionableAPI().setLive(page); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(page.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),page.getTitle()); assertEquals(verAPI.getInode(),page.getInode()); Folder folder = APILocator.getHTMLPageAPI().getParentFolder(page); Template template = APILocator.getHTMLPageAPI().getTemplateForWorkingHTMLPage(page); APILocator.getHTMLPageAPI().delete(page, user, false); APILocator.getFolderAPI().delete(folder, user, false); APILocator.getTemplateAPI().delete(template, user, false); }
Source:
void openRedirect(Attributes attributes) { page.Redirect = new Title(attributes.getValue("title"), siteinfo.Namespaces); }

Target:
void openRedirect(Attributes attributes) { String title = attributes.getValue("title"); if (title != null) { page.Redirect = new Title(title, siteinfo.Namespaces); } page.isRedirect = true; }
Source:
public String generateStorePath( String physicalPath ) { if ( StringUtils.isBlank( baseDir ) || !physicalPath.contains( baseDir ) ) { return physicalPath; } final int storePathStart = physicalPath.indexOf( baseDir ) + baseDir.length(); final String storePath = physicalPath.substring( storePathStart ); return storePath.startsWith( "/" ) ? storePath : "/" + storePath; }

Target:
public String generateStorePath( String physicalPath ) { if ( StringUtils.isBlank( baseDir ) || !physicalPath.contains( baseDir ) ) { return physicalPath; } final int storePathStart = physicalPath.indexOf( baseDir ) + baseDir.length(); final String storePath = physicalPath.substring( storePathStart ); return storePath.startsWith( "/" ) ? storePath.substring( 1 ) : storePath; }
Source:
public void decreaseMultiplier() { SweepBatchConfig lastBatchConfig = getAdjustedSweepConfig(); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); log.warn("The background sweep job failed unexpectedly with candidate batch size {}," + " delete batch size {}," + " and cell+timestamp pairs to examine." + " Attempting to continue with new batchSizeMultiplier {}", SafeArg.of("candidateBatchSize", lastBatchConfig.candidateBatchSize()), SafeArg.of("deleteBatchSize", lastBatchConfig.deleteBatchSize()), SafeArg.of("maxCellTsPairsToExamine", lastBatchConfig.maxCellTsPairsToExamine()), SafeArg.of("batchSizeMultiplier", batchSizeMultiplier)); }

Target:
public void decreaseMultiplier() { SweepBatchConfig lastBatchConfig = getAdjustedSweepConfig(); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); log.warn("Sweep failed unexpectedly with candidate batch size {}," + " delete batch size {}," + " and cell+timestamp pairs to examine." + " Attempting to continue with new batchSizeMultiplier {}", SafeArg.of("candidateBatchSize", lastBatchConfig.candidateBatchSize()), SafeArg.of("deleteBatchSize", lastBatchConfig.deleteBatchSize()), SafeArg.of("maxCellTsPairsToExamine", lastBatchConfig.maxCellTsPairsToExamine()), SafeArg.of("batchSizeMultiplier", batchSizeMultiplier)); }
Source:
public void directBufferCheck() throws Exception { ByteBuffer heapBuf = ByteBuffer.allocate(64); ByteBuffer directBuf = ByteBuffer.allocateDirect(64); try { BitShuffle.bitShuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); System.err.println("XXX:" + e.getMessage()); Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.bitShuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } try { BitShuffle.bitUnShuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.bitUnShuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } }

Target:
public void directBufferCheck() throws Exception { ByteBuffer heapBuf = ByteBuffer.allocate(64); ByteBuffer directBuf = ByteBuffer.allocateDirect(64); try { BitShuffle.shuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.shuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } try { BitShuffle.unshuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.unshuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } }
Source:
private void addNetworkBroadcastReceiver() { IntentFilter intentFilter = new IntentFilter(NETWORK_INTENT_ACTION); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (NetworkUtils.isInternetConnectionEstablished(NearbyActivity.this)) { refreshView(LOCATION_SIGNIFICANTLY_CHANGED); } else { Snackbar.make(transparentView , R.string.no_internet, Snackbar.LENGTH_INDEFINITE).show(); } } }; this.registerReceiver(broadcastReceiver, intentFilter); }

Target:
private void addNetworkBroadcastReceiver() { IntentFilter intentFilter = new IntentFilter(NETWORK_INTENT_ACTION); Snackbar snackbar = Snackbar.make(transparentView , R.string.no_internet, Snackbar.LENGTH_INDEFINITE); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (NetworkUtils.isInternetConnectionEstablished(NearbyActivity.this)) { refreshView(LOCATION_SIGNIFICANTLY_CHANGED); snackbar.dismiss(); } else { snackbar.show(); } } }; this.registerReceiver(broadcastReceiver, intentFilter); }
Source:
public void store(A aggregateRoot) { final Collection<EventRecord> uncommittedEvents = aggregateRoot.getApplicableUncommittedEvents(); final int snapshotTrigger = getSnapshotTrigger(); for (EventRecord event : uncommittedEvents) { storeEvent(event); if (countSinceLastSnapshot > snapshotTrigger) { createAndStoreSnapshot(aggregateRoot); countSinceLastSnapshot = 0; } } aggregateRoot.commitEvents(); }

Target:
public void store(A aggregateRoot) { final Iterable<EventRecord> uncommittedEvents = aggregateRoot.getStateChangingUncommittedEvents(); final int snapshotTrigger = getSnapshotTrigger(); for (EventRecord event : uncommittedEvents) { storeEvent(event); if (countSinceLastSnapshot > snapshotTrigger) { createAndStoreSnapshot(aggregateRoot); countSinceLastSnapshot = 0; } } aggregateRoot.commitEvents(); }
Source:
public void testProperties() throws XmppStringprepException, NotConnectedException, Exception { Chat newChat = chatManagerOne.createChat(conTwo.getUser()); PacketCollector collector = conTwo.createPacketCollector(new ThreadFilter(newChat.getThreadID())); JivePropertiesManager.setJavaObjectEnabled(true); Message msg = new Message(); msg.setSubject("Subject of the chat"); msg.setBody("Body of the chat"); addProperty(msg, "favoriteColor", "red"); addProperty(msg, "age", 30); addProperty(msg, "distance", 30f); addProperty(msg, "weight", 30d); addProperty(msg, "male", true); addProperty(msg, "birthdate", new Date()); newChat.sendMessage(msg); Message msg2 = (Message) collector.nextResult(2000); assertNotNull("No message was received", msg2); assertEquals("Subjects are different", msg.getSubject(), msg2.getSubject()); assertEquals("Bodies are different", msg.getBody(), msg2.getBody()); assertEquals( "favoriteColors are different", getProperty(msg, "favoriteColor"), getProperty(msg2, "favoriteColor")); assertEquals( "ages are different", getProperty(msg, "age"), getProperty(msg2, "age")); assertEquals( "distances are different", getProperty(msg, "distance"), getProperty(msg2, "distance")); assertEquals( "weights are different", getProperty(msg, "weight"), getProperty(msg2, "weight")); assertEquals( "males are different", getProperty(msg, "male"), getProperty(msg2, "male")); assertEquals( "birthdates are different", getProperty(msg, "birthdate"), getProperty(msg2, "birthdate")); }

Target:
public void testProperties() throws XmppStringprepException, NotConnectedException, Exception { Chat newChat = chatManagerOne.createChat(conTwo.getUser()); PacketCollector collector = conTwo.createPacketCollector(new ThreadFilter(newChat.getThreadID())); Message msg = new Message(); msg.setSubject("Subject of the chat"); msg.setBody("Body of the chat"); addProperty(msg, "favoriteColor", "red"); addProperty(msg, "age", 30); addProperty(msg, "distance", 30f); addProperty(msg, "weight", 30d); addProperty(msg, "male", true); addProperty(msg, "birthdate", new Date()); newChat.sendMessage(msg); Message msg2 = (Message) collector.nextResult(2000); assertNotNull("No message was received", msg2); assertEquals("Subjects are different", msg.getSubject(), msg2.getSubject()); assertEquals("Bodies are different", msg.getBody(), msg2.getBody()); assertEquals( "favoriteColors are different", getProperty(msg, "favoriteColor"), getProperty(msg2, "favoriteColor")); assertEquals( "ages are different", getProperty(msg, "age"), getProperty(msg2, "age")); assertEquals( "distances are different", getProperty(msg, "distance"), getProperty(msg2, "distance")); assertEquals( "weights are different", getProperty(msg, "weight"), getProperty(msg2, "weight")); assertEquals( "males are different", getProperty(msg, "male"), getProperty(msg2, "male")); assertEquals( "birthdates are different", getProperty(msg, "birthdate"), getProperty(msg2, "birthdate")); }