auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Type resolveVar(Type resolved, String varName, Type declaringType, EntityType context) { int index = -1; for (int i = 0; i < declaringType.getParameters().size(); i++) { Type param = unwrap(declaringType.getParameters().get(i)); if (param instanceof TypeExtends && Objects.equal(((TypeExtends)param).getVarName(), varName)) { index = i; } else if (param instanceof TypeSuper && Objects.equal(((TypeSuper) param).getVarName(), varName)) { index = i; } } if (index == -1) { throw new IllegalStateException("Did not find type " + varName + " in " + declaringType + " for " + context); } Supertype type = context.getSuperType(); while (!type.getEntityType().equals(declaringType)) { type = type.getEntityType().getSuperType(); } if (!type.getType().getParameters().isEmpty()) { return type.getType().getParameters().get(index); } else { return resolved; } }

Target:
private static Type resolveVar(Type resolved, String varName, Type declaringType, EntityType context) { int index = -1; for (int i = 0; i < declaringType.getParameters().size(); i++) { Type param = unwrap(declaringType.getParameters().get(i)); if (Objects.equal(getVarName(param), varName)) { index = i; } } if (index == -1) { throw new IllegalStateException("Did not find type " + varName + " in " + declaringType + " for " + context); } Supertype type = context.getSuperType(); while (!type.getEntityType().equals(declaringType)) { type = type.getEntityType().getSuperType(); } if (!type.getType().getParameters().isEmpty()) { return type.getType().getParameters().get(index); } else { return resolved; } }
Source:
public Object getElementAt(int index) { if (index == getSize() - 1) { return CREATE_NEW_THEME; } if (index == getSize() - 2) { return SEPARATOR; } if (index == getSize() - 3) { return SHOW_ALL_THEMES; } if (myNumberProjectThemes > 0) { if (index == myNumberProjectThemes) { return SEPARATOR; } else if (index > myNumberProjectThemes) { return myThemeList.get(index - 1); } } return myThemeList.get(index); }

Target:
public Object getElementAt(int index) { if (index >= mySizeBeforeExtraOptions) { return EXTRA_OPTIONS[index - mySizeBeforeExtraOptions]; } if (myNumberProjectThemes > 0) { if (index == myNumberProjectThemes) { return SEPARATOR; } else if (index > myNumberProjectThemes) { return myThemeList.get(index - 1); } } return myThemeList.get(index); }
Source:
IndexValue getIndexValueOfLastPut() throws StoreException { IndexValue indexValueOfLastPut = null; if (sealed.get()) { ByteBuffer readBuf = serEntries.duplicate(); int numOfIndexEntries = numberOfEntries(readBuf); NavigableSet<IndexValue> values = new TreeSet<>(); for (int i = 0; i < numOfIndexEntries; i++) { StoreKey key = getKeyAt(readBuf, i); values.clear(); getAllValuesFromMmap(readBuf, key, i, numOfIndexEntries, values); for (IndexValue indexValue : values) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { indexValueOfLastPut = indexValue; } } } } else { for (Map.Entry<StoreKey, ConcurrentSkipListSet<IndexValue>> entry : index.entrySet()) { for (IndexValue indexValue : entry.getValue()) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { indexValueOfLastPut = indexValue; } } } } return indexValueOfLastPut; }

Target:
IndexValue getIndexValueOfLastPut() throws StoreException { IndexValue indexValueOfLastPut = null; if (sealed.get()) { ByteBuffer readBuf = serEntries.duplicate(); int numOfIndexEntries = numberOfEntries(readBuf); NavigableSet<IndexValue> values = new TreeSet<>(); for (int i = 0; i < numOfIndexEntries; i++) { StoreKey key = getKeyAt(readBuf, i); values.clear(); getAllValuesFromMmap(readBuf, key, i, numOfIndexEntries, values); for (IndexValue indexValue : values) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { indexValueOfLastPut = indexValue; break; } } } } else { for (Map.Entry<StoreKey, ConcurrentSkipListSet<IndexValue>> entry : index.entrySet()) { for (IndexValue indexValue : entry.getValue()) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { indexValueOfLastPut = indexValue; break; } } } } return indexValueOfLastPut; }
Source:
protected boolean canDoAction() { initializeObjectState(); getVmDAO().get(getVmId()); getReturnValue().setCanDoAction(validate(validateVmNotDuringSnapshot())); if (!validateSnapshotExists()) { getReturnValue().setCanDoAction(false); } if (!validateImages()) { getReturnValue().setCanDoAction(false); } if (!validateImageNotInTemplate()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE); getReturnValue().setCanDoAction(false); } if (!validateImageNotActive()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE); getReturnValue().setCanDoAction(false); } if (!getReturnValue().getCanDoAction()) { addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); } return getReturnValue().getCanDoAction(); }

Target:
protected boolean canDoAction() { initializeObjectState(); getVmDAO().get(getVmId()); if (!validateVmNotDuringSnapshot()) { handleCanDoActionFailure(); return false; } if (!validateSnapshotExists()) { handleCanDoActionFailure(); return false; } if (!validateImages()) { handleCanDoActionFailure(); return false; } if (!validateImageNotInTemplate()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE); handleCanDoActionFailure(); return false; } if (!validateImageNotActive()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE); handleCanDoActionFailure(); return false; } return getReturnValue().getCanDoAction(); }
Source:
public Secret setProperties(SecretProperties properties) { properties.name = this.properties.name; this.properties = properties; return this; }

Target:
public Secret setProperties(SecretProperties properties) { Objects.requireNonNull(properties); properties.name = this.properties.name; this.properties = properties; return this; }
Source:
public PaginationOptions limit(int limit) { checkState(limit >= MIN_LIMIT, "limit must be >= " + MIN_LIMIT); checkState(limit <= MAX_LIMIT, "limit must be <= " + MAX_LIMIT); queryParameters.put("limit", Integer.toString(limit)); return this; }

Target:
public PaginationOptions limit(int limit) { checkArgument(limit >= MIN_LIMIT, "limit must be >= " + MIN_LIMIT); checkArgument(limit <= MAX_LIMIT, "limit must be <= " + MAX_LIMIT); queryParameters.put("limit", Integer.toString(limit)); return this; }
Source:
public void bind(Moshi moshi, JsonAdapter.Factory factory) { if (jsonAdapters.length > 0) { Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = adaptersOffset, size = parameterTypes.length; i < size; i++) { Type type = ((ParameterizedType) parameterTypes[i]).getActualTypeArguments()[0]; Set<? extends Annotation> jsonAnnotations = jsonAnnotations(parameterAnnotations[i]); jsonAdapters[i - adaptersOffset] = Types.equals(Types.getRawType(this.type), Types.getRawType(type)) && annotations.equals(jsonAnnotations) ? moshi.nextAdapter(factory, type, jsonAnnotations) : moshi.adapter(type, jsonAnnotations); } } }

Target:
public void bind(Moshi moshi, JsonAdapter.Factory factory) { if (jsonAdapters.length > 0) { Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = adaptersOffset, size = parameterTypes.length; i < size; i++) { Type type = ((ParameterizedType) parameterTypes[i]).getActualTypeArguments()[0]; Set<? extends Annotation> jsonAnnotations = jsonAnnotations(parameterAnnotations[i]); jsonAdapters[i - adaptersOffset] = Types.equals(Types.canonicalize(this.type), Types.canonicalize(type)) && annotations.equals(jsonAnnotations) ? moshi.nextAdapter(factory, type, jsonAnnotations) : moshi.adapter(type, jsonAnnotations); } } }
Source:
public void getUserCardTransactionsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCardTransactions("foo", "bar", new RetrofitPromise<List<Transaction>>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s/transactions", MOCK_URL, "bar")); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertTrue(bodyRef.get().getHeaders().contains(new Header("Range", "foo"))); }

Target:
public void getUserCardTransactionsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCardTransactions("foo", "bar", new RetrofitPromise<List<Transaction>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s/transactions", MOCK_URL, "bar")); Assert.assertTrue(bodyRef.get().getHeaders().contains(new Header("Range", "foo"))); }
Source:
private void initRenderingSupport() { buffersManager = new FrameBuffersManager(); context.put(FrameBuffersManager.class, buffersManager); graphicState = new GraphicState(buffersManager); postProcessor = new PostProcessor(buffersManager, graphicState); context.put(PostProcessor.class, postProcessor); buffersManager.setGraphicState(graphicState); buffersManager.setPostProcessor(postProcessor); buffersManager.initialize(); shaderManager.initShaders(); postProcessor.initializeMaterials(); initMaterials(); shadowMap = new ShadowMapNode(getMaterial("engine:prog.shadowMap"), playerCamera, this, backdropProvider, renderingConfig, graphicState); dag.add(shadowMap); }

Target:
private void initRenderingSupport() { buffersManager = new FrameBuffersManager(); context.put(FrameBuffersManager.class, buffersManager); graphicState = new GraphicState(buffersManager); postProcessor = new PostProcessor(buffersManager, graphicState); context.put(PostProcessor.class, postProcessor); buffersManager.setGraphicState(graphicState); buffersManager.setPostProcessor(postProcessor); buffersManager.initialize(); shaderManager.initShaders(); postProcessor.initializeMaterials(); initMaterials(); context.put(WorldRenderer.class, this); context.put(RenderQueuesHelper.class, renderQueues); context.put(RenderableWorld.class, renderableWorld); initPipeline(); }
Source:
private void cleanNetworks() { try { for (Network network : dockerConnector.getNetworks(GET_NETWORKS_PARAMS)) { Matcher cheNetworkMatcher = CHE_NETWORK_PATTERN.matcher(network.getName()); if (cheNetworkMatcher.matches() && network.getContainers().isEmpty() && !additionalNetworks.contains(network.getName()) && !runtimes.hasRuntime(cheNetworkMatcher.group(WORKSPACE_ID_REGEX_GROUP))) { try { dockerConnector.removeNetwork(network.getId()); } catch (IOException e) { LOG.warn("Failed to remove abandoned network: %s", network.getName()); } } } } catch (IOException e) { LOG.error("Failed to get list of docker networks", e); } }

Target:
void cleanNetworks() { try { for (Network network : dockerConnector.getNetworks(GET_NETWORKS_PARAMS)) { Matcher cheNetworkMatcher = CHE_NETWORK_PATTERN.matcher(network.getName()); if (cheNetworkMatcher.matches() && network.getContainers().isEmpty() && !additionalNetworks.contains(network.getName()) && !runtimes.hasRuntime(cheNetworkMatcher.group(WORKSPACE_ID_REGEX_GROUP))) { try { dockerConnector.removeNetwork(network.getId()); } catch (IOException e) { LOG.warn("Failed to remove abandoned network: " + network.getName(), e); } } } } catch (IOException e) { LOG.error("Failed to get list of docker networks", e); } }
Source:
private void removeSkippedRegion(Locus stopBeforeLocus) { int i = 0; while (i < accumulator.size() && accumulator.get(i).isEmpty() && locusComparator.compare(accumulator.get(i), stopBeforeLocus) < 0) { i++; } if (i > 0){ List<K> temporaryList = new ArrayList<>(accumulator.subList(i, accumulator.size())); accumulator.clear(); accumulator.addAll(temporaryList); } }

Target:
private void removeSkippedRegion(Locus stopBeforeLocus) { int i = 0; while (i < accumulator.size() && accumulator.get(i).isEmpty() && locusComparator.compare(accumulator.get(i), stopBeforeLocus) < 0) { i++; } if (i > 0){ accumulator.subList(0, i).clear(); } }
Source:
public void testMongoTopology() throws Exception { try { String templateUrl = "classpath://templates/mongo-topology.tosca.yaml"; EntitySpec<?> spec = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(spec, "spec"); assertEquals(spec.getType(), BasicApplication.class); assertEquals(spec.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> compute = Iterators.getOnlyElement(spec.getChildren().iterator()); assertEquals(compute.getType(), SameServerEntity.class); assertEquals(compute.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> mongo = Iterators.getOnlyElement(compute.getChildren().iterator()); assertEquals(mongo.getType(), VanillaSoftwareProcess.class); String customize = mongo.getFlags().get(VanillaSoftwareProcess.CUSTOMIZE_COMMAND.getName()).toString(); assertConfigValueContains(customize, "DB_IP"); assertConfigValueContains(customize, "$brooklyn:entity(\"Compute\").attributeWhenReady(\"ip_address\")"); } finally { if (platform!=null) { platform.close(); } } }

Target:
public void testMongoTopology() throws Exception { try { String templateUrl = "classpath://templates/mongo-topology.tosca.yaml"; EntitySpec<?> spec = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(spec, "spec"); assertEquals(spec.getType(), BasicApplication.class); assertEquals(spec.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> compute = Iterators.getOnlyElement(spec.getChildren().iterator()); assertEquals(compute.getType(), SameServerEntity.class); assertEquals(compute.getChildren().size(), 1, "Expected exactly one child of compute entity"); EntitySpec<?> mongo = Iterators.getOnlyElement(compute.getChildren().iterator()); assertEquals(mongo.getType(), VanillaSoftwareProcess.class); String customize = mongo.getFlags().get(VanillaSoftwareProcess.CUSTOMIZE_COMMAND.getName()).toString(); assertConfigValueContains(customize, "DB_IP"); assertConfigValueContains(customize, "$brooklyn:entity(\"Compute\").attributeWhenReady(\"ip_address\")"); } finally { if (platform!=null) { platform.close(); } } }
Source:
private List<IJavaElement> addLibraryEntries(IFile[] resources, IJavaProject project, IProgressMonitor monitor) throws CoreException { List<CPListElement> addedEntries= new ArrayList<>(); try { monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_AddToBuildpath, 4); for (IFile resource : resources) { IResource res= resource; CPListElement cpListElement= new CPListElement(project, IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res); if(fForTestOnly) { cpListElement.setAttribute(IClasspathAttribute.TEST, "true"); } else { if(project.getModuleDescription() != null) { cpListElement.setAttribute(IClasspathAttribute.MODULE, new ModuleEncapsulationDetail[0]); } } addedEntries.add(cpListElement); } monitor.worked(1); List<CPListElement> existingEntries= ClasspathModifier.getExistingEntries(project); ClasspathModifier.setNewEntry(existingEntries, addedEntries, project, new SubProgressMonitor(monitor, 1)); ClasspathModifier.commitClassPath(existingEntries, project, new SubProgressMonitor(monitor, 1)); BuildpathDelta delta= new BuildpathDelta(getToolTipText()); delta.setNewEntries(existingEntries.toArray(new CPListElement[existingEntries.size()])); informListeners(delta); List<IJavaElement> result= new ArrayList<>(addedEntries.size()); for (IResource res : resources) { IJavaElement elem= project.getPackageFragmentRoot(res); if (elem != null) { result.add(elem); } } monitor.worked(1); return result; } finally { monitor.done(); } }

Target:
private List<IJavaElement> addLibraryEntries(IFile[] resources, IJavaProject project, IProgressMonitor monitor) throws CoreException { List<CPListElement> addedEntries= new ArrayList<>(); try { monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_AddToBuildpath, 4); for (IFile res : resources) { CPListElement cpListElement= new CPListElement(project, IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res); if(fForTestOnly) { cpListElement.setAttribute(IClasspathAttribute.TEST, "true"); } else { if(project.getModuleDescription() != null) { cpListElement.setAttribute(IClasspathAttribute.MODULE, new ModuleEncapsulationDetail[0]); } } addedEntries.add(cpListElement); } monitor.worked(1); List<CPListElement> existingEntries= ClasspathModifier.getExistingEntries(project); ClasspathModifier.setNewEntry(existingEntries, addedEntries, project, new SubProgressMonitor(monitor, 1)); ClasspathModifier.commitClassPath(existingEntries, project, new SubProgressMonitor(monitor, 1)); BuildpathDelta delta= new BuildpathDelta(getToolTipText()); delta.setNewEntries(existingEntries.toArray(new CPListElement[existingEntries.size()])); informListeners(delta); List<IJavaElement> result= new ArrayList<>(addedEntries.size()); for (IResource res : resources) { IJavaElement elem= project.getPackageFragmentRoot(res); if (elem != null) { result.add(elem); } } monitor.worked(1); return result; } finally { monitor.done(); } }
Source:
public String getPermissionDescription(String role) { return NLS.getIfExists("Permission." + role + ".description", null).orElse(""); }

Target:
public String getPermissionDescription(String role) { return Permissions.getPermissionDescription(role); }
Source:
public void set(long oid, long rows) { this.oid = oid; this.rows = rows; }

Target:
void set(long oid, long rows) { this.oid = oid; this.rows = rows; }
Source:
public List<org.atlasapi.media.entity.Clip> clipsFor(PidReference ref) throws NitroException { try { Iterable<com.metabroadcast.atlas.glycerin.model.Clip> nitroClips = Iterables.transform(Iterables.filter(getNitroClip(ref), isClip), toClip); if (Iterables.isEmpty(nitroClips)) { log.warn("No programmes found for clipRefs {}", ref, new Function<PidReference, String>() { @Override public String apply(@Nullable PidReference pidRef) { return pidRef.getPid(); } }); } Iterable<List<Clip>> clipParts = Iterables.partition(nitroClips, BATCH_SIZE); ImmutableList.Builder<org.atlasapi.media.entity.Clip> clips = ImmutableList.builder(); for (List<Clip> clipPart : clipParts) { clips.addAll(extractClips(clipPart).values()); } return clips.build(); } catch (GlycerinException e) { throw new NitroException(ref.toString(), e); } }

Target:
public List<org.atlasapi.media.entity.Clip> clipsFor(PidReference ref) throws NitroException { try { Iterable<com.metabroadcast.atlas.glycerin.model.Clip> nitroClips = Iterables .transform(Iterables.filter(getNitroClips(ref), isClip), toClip); if (Iterables.isEmpty(nitroClips)) { log.warn("No programmes found for clipRefs {}", ref, new Function<PidReference, String>() { @Override public String apply(@Nullable PidReference pidRef) { return pidRef.getPid(); } }); } ImmutableList.Builder<org.atlasapi.media.entity.Clip> extractedClips = ImmutableList.builder(); for (Clip clip : nitroClips) { extractedClips.add(extractClip(clip)); } return extractedClips.build(); } catch (GlycerinException e) { throw new NitroException(ref.toString(), e); } }
Source:
public void testBasicPathArgumentRecognitionAndParsing2() throws Exception { ModelNode request = ctx.buildRequest("deployment-info --headers=false"); Assert.assertFalse(request.hasDefined(Util.OPERATION_HEADERS)); }

Target:
public void testBasicPathArgumentRecognitionAndParsing2() throws Exception { try { ctx.buildRequest("deployment-info --headers=false"); Assert.fail(); } catch (CommandFormatException cfe) { } }
Source:
void should_fail_when_period_is_null() { Period period = null; ThrowableAssert.ThrowingCallable code = () -> assertThat(period).hasDays(5); assertThatAssertionErrorIsThrownBy(code).withMessage(actualIsNull()); }

Target:
void should_fail_when_period_is_null() { Period period = null; final AssertionError code = expectAssertionError(() -> assertThat(period).hasDays(5)); then(code).hasMessage(actualIsNull()); }
Source:
public void test() { XmlRulesDefinition rulesDefinition = new XmlRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository repository = context.repository("xml"); assertThat(repository.name()).isEqualTo("SonarAnalyzer"); assertThat(repository.language()).isEqualTo("xml"); assertThat(repository.rules()).hasSize(CheckRepository.getChecks().size()); RulesDefinition.Rule alertUseRule = repository.rule("IndentCheck"); assertThat(alertUseRule).isNotNull(); assertThat(alertUseRule.name()).isEqualTo("Source code should be indented consistently"); assertThat(Stream.of(repository.rule("XPathCheck"), repository.rule("XmlSchemaCheck"))) .isNotEmpty() .allMatch(rule -> rule != null) .allMatch(rule -> rule.template()); for (Rule rule : repository.rules()) { for (RulesDefinition.Param param : rule.params()) { assertThat(param.description()).as("description for " + param.key()).isNotEmpty(); } } }

Target:
public void test() { XmlRulesDefinition rulesDefinition = new XmlRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository repository = context.repository("xml"); assertThat(repository.name()).isEqualTo("SonarAnalyzer"); assertThat(repository.language()).isEqualTo("xml"); assertThat(repository.rules()).hasSize(CheckRepository.getChecks().size()); RulesDefinition.Rule alertUseRule = repository.rule("IndentCheck"); assertThat(alertUseRule).isNotNull(); assertThat(alertUseRule.name()).isEqualTo("Source code should be indented consistently"); assertThat(repository.rules().stream().filter(Rule::template).map(Rule::key)) .isNotEmpty() .containsOnly("XPathCheck", "XmlSchemaCheck"); for (Rule rule : repository.rules()) { for (RulesDefinition.Param param : rule.params()) { assertThat(param.description()).as("description for " + param.key()).isNotEmpty(); } } }
Source:
@Test public void multipleTopLevelValuesInOneDocument() throws IOException { if (factory == Factory.JSON_OBJECT) return; JsonReader reader = factory.newReader("[][]"); reader.setLenient(true); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); }

Target:
@Test public void multipleTopLevelValuesInOneDocument() throws IOException { assumeTrue(factory != Factory.JSON_OBJECT); JsonReader reader = factory.newReader("[][]"); reader.setLenient(true); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); }
Source:
private long getDiskUsage(Project.NameKey project) throws IOException { Repository git = gitManager.openRepository(project); try { File gitDir = git.getDirectory(); return getDiskUsage(gitDir); } finally { git.close(); } }

Target:
private long getDiskUsage(Project.NameKey project) throws IOException { Repository git = gitManager.openRepository(project); try { return getDiskUsage(git.getDirectory()); } finally { git.close(); } }
Source:
public static XMLEventReader createXMLEventReader(StringReader source) { try { return XML_INPUT_FACTORY.createXMLEventReader(source); } catch (Exception e) { throw new XmlBeanDefinitionException("Error occurred creating a new XMLEventReader from a StringReader.", e); } }

Target:
public static XMLEventReader createXMLEventReader(StringReader source) { try { return XML_INPUT_FACTORY.createXMLEventReader(source); } catch (Exception e) { throw new XmlBeanDefinitionException("Error occurred while creating a new XMLEventReader from StringReader.", e); } }
Source:
@Override @Before public void setUp(){ init(); }

Target:
@Before public void setUp() { init(); }
Source:
private void drain() { synchronized (this) { if (busy) { missed = true; return; } else { missed = false; } } while (!child.isUnsubscribed()) { Notification<T> tn; synchronized (this) { tn = terminalNotification; } if (tn != null) { if (requested > 0) { terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }

Target:
private void drain() { synchronized (this) { if (busy) { missed = true; return; } } while (!child.isUnsubscribed()) { Notification<T> tn; tn = terminalNotification; if (tn != null) { if (requested > 0) { terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }
Source:
@Override public Connection createConnection() throws JMSException { if (null == connectionFactory) { logger.error("Connection cannot be establish to the broker. Please check the broker libs provided."); return null; } Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)).createQueueConnection(); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)).createTopicConnection(); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(); } else if (null != tConFac) { connection = tConFac.createTopicConnection(); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (Exception e) { logger.error("JMS Exception while creating connection through factory " + this.connectionFactoryString, e); if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection"); } } throw e; } }

Target:
public Connection createConnection() throws JMSException { if (null == connectionFactory) { throw new JMSException("Connection cannot be establish to the broker. Connection Factory is null. Please " + "check the Please check the broker libs provided."); } Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)).createQueueConnection(); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)).createTopicConnection(); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(); } else if (null != tConFac) { connection = tConFac.createTopicConnection(); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection. ", ex); } } throw e; } }
Source:
public void filter_groups_where_the_user_is_not_included_in() throws Exception { Group expectedGroup = getGroupByName(NAME_GROUP_TWO); assertNotContainsUser(expectedGroup, TEST_USER_ID); SCIMSearchResult<Group> result = searchGroup(String.format("not(members eq \"%s\")", TEST_USER_ID)); assertThat(String.format("Can not find expected group %s!", NAME_GROUP_TWO), result.getResources(), hasItem(new Group.Builder(NAME_GROUP_TWO).build())); }

Target:
public void filter_groups_where_the_user_is_not_included_in() throws Exception { final SCIMSearchResult<Group> result = searchGroup("not(members eq \"cef9452e-00a9-4cec-a086-d171374ffbef\")"); final Group expectedGroup = new Group.Builder(GROUP_TWO_NAME).build(); assertThat("Can not find expected group test_group02!", result.getResources(), hasItem(expectedGroup)); }
Source:
public static List<II> getPatientIds(PRPAIN201306UV02 response) { LOG.info("getPatientIds()"); List<II> oIIs = null; if (response != null && response.getControlActProcess() != null && response.getControlActProcess().getSubject() != null) { for (PRPAIN201306UV02MFMIMT700711UV01Subject1 subject : response.getControlActProcess().getSubject()) { if (subject.getRegistrationEvent() != null && subject.getRegistrationEvent().getSubject1() != null && subject.getRegistrationEvent().getSubject1().getPatient() != null && subject.getRegistrationEvent().getSubject1().getPatient().getId() != null) { oIIs = subject.getRegistrationEvent().getSubject1().getPatient().getId(); } else { LOG.error("PatientId doesn't exist in the received PRPAIN201306UV02 message"); } } } return oIIs; }

Target:
public static List<II> getPatientIds(PRPAIN201306UV02 response) { List<II> oIIs = null; if (response != null && response.getControlActProcess() != null && response.getControlActProcess().getSubject() != null) { oIIs = new ArrayList<>(); for (PRPAIN201306UV02MFMIMT700711UV01Subject1 subject : response.getControlActProcess().getSubject()) { if (subject.getRegistrationEvent() != null && subject.getRegistrationEvent().getSubject1() != null && subject.getRegistrationEvent().getSubject1().getPatient() != null && subject.getRegistrationEvent().getSubject1().getPatient().getId() != null) { oIIs.addAll(subject.getRegistrationEvent().getSubject1().getPatient().getId()); } } } else { LOG.error("PatientId doesn't exist in the received PRPAIN201306UV02 message"); } return oIIs; }
Source:
public GenericSubscriptionQueryMessage(Q payload, ResponseType<I> responseType, ResponseType<U> updateResponseType) { super(payload, responseType); this.updateResponseType = updateResponseType; }

Target:
public GenericSubscriptionQueryMessage(Q payload, ResponseType<I> responseType, ResponseType<U> updateResponseType) { this(payload, payload.getClass().getName(), responseType, updateResponseType); }
Source:
public Void visitAggregation(AggregationNode node, ImmutableList.Builder<Expression> context) { node.getAggregations().values() .forEach(aggregation -> context.add(aggregation.getCall())); node.getGroupingSets().forEach(groupingSet -> groupingSet .forEach(symbol -> context.add(symbol.toSymbolReference()))); return super.visitAggregation(node, context); }

Target:
public Void visitAggregation(AggregationNode node, ImmutableList.Builder<Expression> context) { node.getAggregations().values() .forEach(aggregation -> context.add(aggregation.getCall())); return super.visitAggregation(node, context); }
Source:
private void addWorldRenderingNodes(RenderGraph renderGraph) { Node opaqueObjectsNode = new OpaqueObjectsNode(context); renderGraph.addNode(opaqueObjectsNode, "opaqueObjectsNode"); Node opaqueBlocksNode = new OpaqueBlocksNode(context); renderGraph.addNode(opaqueBlocksNode, "opaqueBlocksNode"); Node alphaRejectBlocksNode = new AlphaRejectBlocksNode(context); renderGraph.addNode(alphaRejectBlocksNode, "alphaRejectBlocksNode"); Node overlaysNode = new OverlaysNode(context); renderGraph.addNode(overlaysNode, "overlaysNode"); Node lastUpdatedGBufferClearingNode = renderGraph.findNode(new SimpleUri("engine:lastUpdatedGBufferClearingNode")); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueObjectsNode); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueBlocksNode); renderGraph.connect(lastUpdatedGBufferClearingNode, alphaRejectBlocksNode); renderGraph.connect(lastUpdatedGBufferClearingNode, overlaysNode); }

Target:
private void addWorldRenderingNodes(RenderGraph renderGraph) { Node lastUpdatedGBufferClearingNode = renderGraph.findNode("engine:lastUpdatedGBufferClearingNode"); Node opaqueObjectsNode = new OpaqueObjectsNode(context); renderGraph.addNode(opaqueObjectsNode, "opaqueObjectsNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueObjectsNode); Node opaqueBlocksNode = new OpaqueBlocksNode(context); renderGraph.addNode(opaqueBlocksNode, "opaqueBlocksNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueBlocksNode); Node alphaRejectBlocksNode = new AlphaRejectBlocksNode(context); renderGraph.addNode(alphaRejectBlocksNode, "alphaRejectBlocksNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, alphaRejectBlocksNode); Node overlaysNode = new OverlaysNode(context); renderGraph.addNode(overlaysNode, "overlaysNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, overlaysNode); }
Source:
public void animateChange() { if( mItemMap.isEmpty() ) return; final ViewTreeObserver observer = this.getViewTreeObserver(); if( !observer.isAlive() ) return; observer.addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { if( !observer.isAlive() ) return true; observer.removeOnPreDrawListener( this ); AnimatedListView listView = AnimatedListView.this; boolean animationRunning = false; int firstVisiblePosition = listView.getFirstVisiblePosition(); int nCount = Math.min( listView.getChildCount(), getAdapter().getCount() - firstVisiblePosition ); for( int i = 0; i < nCount; i += 1 ) { int position = firstVisiblePosition + i; long itemId = getAdapter().getItemId( position ); View child = listView.getChildAt( i ); int topAfterLayout = child.getTop(); int delta; if( mItemMap.containsKey( itemId ) ) { int topBeforeLayout = mItemMap.get( itemId ).top; delta = topBeforeLayout - topAfterLayout; } else { if( i == 0 ) { delta = -child.getHeight() - listView.getDividerHeight(); } else { delta = 0; child.setScaleY( 0.f ); child.animate() .setDuration( MOVE_DURATION ) .scaleY( 1.f ); animationRunning = true; } } if( delta != 0 ) { child.setTranslationY( delta ); child.animate() .setDuration( MOVE_DURATION ) .translationY( 0 ); animationRunning = true; } } if( animationRunning ) { } else { } return false; } } ); }

Target:
public void animateChange() { if( mItemMap.isEmpty() ) return; final ViewTreeObserver observer = this.getViewTreeObserver(); if( !observer.isAlive() ) return; observer.addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { if( !observer.isAlive() ) return true; observer.removeOnPreDrawListener( this ); AnimatedListView listView = AnimatedListView.this; int firstVisiblePosition = listView.getFirstVisiblePosition(); int nCount = Math.min( listView.getChildCount(), getAdapter().getCount() - firstVisiblePosition ); for( int i = 0; i < nCount; i += 1 ) { int position = firstVisiblePosition + i; long itemId = getAdapter().getItemId( position ); View child = listView.getChildAt( i ); int topAfterLayout = child.getTop(); int delta; if( mItemMap.containsKey( itemId ) ) { int topBeforeLayout = mItemMap.get( itemId ).top; delta = topBeforeLayout - topAfterLayout; } else { if( i == 0 ) { delta = -child.getHeight() - listView.getDividerHeight(); } else { delta = 0; child.setScaleY( 0.f ); child.animate() .setDuration( MOVE_DURATION ) .scaleY( 1.f ); } } if( delta != 0 ) { child.setTranslationY( delta ); child.animate() .setDuration( MOVE_DURATION ) .translationY( 0 ); } } return false; } } ); }
Source:
public void updateCachedIssue(TurboIssue issue){ TurboIssue tIssue = getIssueWithId(issue.getId()); if(tIssue != null){ tIssue.copyValues(issue); logger.info("Updated issue: " + issue.getId()); }else{ issues.add(0, issue); logger.info("Added issue: " + issue.getId()); } }

Target:
public void updateCachedIssue(TurboIssue issue){ TurboIssue tIssue = getIssueWithId(issue.getId()); if(tIssue != null){ tIssue.copyValues(issue); logger.debug("Updated issue: " + issue.getId()); }else{ issues.add(0, issue); logger.info("Added issue: " + issue.getId()); } }
Source:
public void put(Datum values) { this.clear(); System.arraycopy(values, 0, this.values, 0, values.length); }

Target:
public void put(Datum values) { clearOffset(); System.arraycopy(values, 0, this.values, 0, values.length); }
Source:
private Object fetchRelationship(Environment context) { EntityDictionary dictionary = context.requestScope.getDictionary(); Class parentClass = context.parentResource.getResourceClass(); String fieldName = context.field.getName(); if(dictionary.getRelationshipType(parentClass, fieldName).isToOne()) { DataStoreTransaction tx = context.requestScope.getTransaction(); Object obj = tx.getRelation(tx, context.parentResource.getObject(), context.field.getName(), null, null, null, context.requestScope); return new PersistentResource(obj, context.parentResource, context.requestScope.getUUIDFor(obj), context.requestScope); } else { return fetchEntity(context); } }

Target:
private Object fetchRelationship(Environment context) { String fieldName = context.field.getName(); Set<PersistentResource> relations = context.parentResource.getRelationCheckedFiltered(fieldName); Boolean isToOne = context.parentResource.getRelationshipType(fieldName).isToOne(); if(isToOne) { return relations.iterator().next(); } else { return relations; } }
Source:
protected void ExecuteVdsBrokerCommand() { glusterTaskReturn = getBroker().glusterVolumeRemoveBricksStart(getParameters().getVolumeName(), getParameters().getBrickDirectories().toArray(new String[0]), getParameters().getReplicaCount(), getParameters().isForceRemove()); task = glusterTaskReturn.getGlusterTask(); setReturnValue(task); proceedProxyReturnValue(); }

Target:
protected void ExecuteVdsBrokerCommand() { glusterTaskReturn = getBroker().glusterVolumeRemoveBricksStart(getParameters().getVolumeName(), getParameters().getBrickDirectories().toArray(new String[0]), getParameters().getReplicaCount(), getParameters().isForceRemove()); task = glusterTaskReturn.getGlusterTask(); proceedProxyReturnValue(); setReturnValue(task); }
Source:
public static void writeOrCreate(Path path, List<Abbreviation> abbreviations, Charset encoding) throws IOException { try (OutputStreamWriter writer = new OutputStreamWriter(Files.newOutputStream(path), encoding); CSVPrinter csvPrinter = new CSVPrinter(writer, AbbreviationFormat.getCSVFormat())) { for (Abbreviation entry : abbreviations) { if (entry.shortestUniqueAbbreviationProperty().get().trim().isEmpty()) { csvPrinter.printRecord(entry.getName(), entry.getAbbreviation()); } else { csvPrinter.printRecord(entry.getName(), entry.getAbbreviation(), entry.getShortestUniqueAbbreviation()); } } } }

Target:
public static void writeOrCreate(Path path, List<Abbreviation> abbreviations, Charset encoding) throws IOException { try (OutputStreamWriter writer = new OutputStreamWriter(Files.newOutputStream(path), encoding); CSVPrinter csvPrinter = new CSVPrinter(writer, AbbreviationFormat.getCSVFormat())) { for (Abbreviation entry : abbreviations) { if (entry.shortestUniqueAbbreviationProperty().get().isEmpty()) { csvPrinter.printRecord(entry.getName(), entry.getAbbreviation()); } else { csvPrinter.printRecord(entry.getName(), entry.getAbbreviation(), entry.getShortestUniqueAbbreviation()); } } } }
Source:
private URL getInlineRules() throws CoreException, CheckstylePluginException { PlexusConfiguration config = getParameterValue("checkstyleRules", XmlPlexusConfiguration.class); if (config == null || ((config = config.getChild(0)) == null)) { return null; } Bundle bundle = FrameworkUtil.getBundle(getClass()); IPath stateLocation = Platform.getStateLocation(bundle); File dir = stateLocation.toFile(); File checkstyleFile = new File(dir, projectName + "_inline_checkstyle.xml"); try (Writer writer = new FileWriter(checkstyleFile)){ writer.write(CHECKSTYLE_CONFIG_FILE_HEADER); writer.write(config.toString()); return checkstyleFile.toURI().toURL(); } catch (IOException e) { CheckstylePluginException.rethrow(e, "Error while extracting inline rules."); return null; } }

Target:
private URL getInlineRules() throws CoreException, CheckstylePluginException { PlexusConfiguration config = getParameterValue("checkstyleRules", XmlPlexusConfiguration.class); if (config == null) { return null; } if (config.getChildCount() > 1) { throw new CheckstylePluginException("Currently only one root module is supported"); } if ((config = config.getChild(0)) == null) { return null; } IPath stateLocation = Activator.getDefault().getStateLocation(); File dir = stateLocation.toFile(); File checkstyleFile = new File(dir, projectName + "_inline_checkstyle.xml"); try (Writer writer = new FileWriter(checkstyleFile)){ writer.write(CHECKSTYLE_CONFIG_FILE_HEADER); writer.write(config.toString()); return checkstyleFile.toURI().toURL(); } catch (IOException e) { CheckstylePluginException.rethrow(e, "Error while extracting inline rules."); return null; } }
Source:
private String findNuageVspCmsIdForDevice(long deviceId, ConfigurationVO cmsIdConfig) { String configValue = cmsIdConfig.getValue(); if (StringUtils.isNotBlank(configValue)) { String[] configuredNuageVspDevices = configValue.split(";"); for (String configuredNuageVspDevice : configuredNuageVspDevices) { if (configuredNuageVspDevice.startsWith(deviceId + ":")) { return configuredNuageVspDevice.split(":")[1]; } } } return null; }

Target:
private String findNuageVspCmsIdForDevice(long deviceId, ConfigurationVO cmsIdConfig) { String configValue = cmsIdConfig.getValue(); if (!Strings.isNullOrEmpty(configValue)) { String[] configuredNuageVspDevices = configValue.split(";"); for (String configuredNuageVspDevice : configuredNuageVspDevices) { if (configuredNuageVspDevice.startsWith(deviceId + ":")) { String[] split = configuredNuageVspDevice.split(":"); if (split.length != 2 || (split.length > 1 && Strings.isNullOrEmpty(split[1]))) { throw new IllegalArgumentException("The configured CMS ID for Nuage VSP device " + deviceId + " is in an incorrect format"); } return split[1]; } } } return null; }
Source:
public void handle() { final TaskDetails details = running.get(taskId); if (details == null) { log.warn("Got location notice for task [%s] that isn't running...", taskId); return; } details.location = location; try { log.info("Updating task [%s] announcement to with location [%s]", taskId, location); workerCuratorCoordinator.updateAnnouncement( TaskAnnouncement.create( details.task, details.status, details.location ) ); } catch (Exception e) { log.makeAlert(e, "Failed to update task announcement") .addData("task", taskId) .emit(); } }

Target:
public void handle() { final TaskDetails details = running.get(taskId); if (details == null) { log.warn("Got location notice for task [%s] that isn't running...", taskId); return; } if (!Objects.equals(details.location, location)) { details.location = location; try { log.info("Updating task [%s] announcement with location [%s]", taskId, location); workerCuratorCoordinator.updateTaskStatusAnnouncement( TaskAnnouncement.create( details.task, details.status, details.location ) ); } catch (Exception e) { log.makeAlert(e, "Failed to update task announcement") .addData("task", taskId) .emit(); } } }
Source:
public void testFallbackToJobOptions() throws Exception { final Namespace cmdlineOptions = mock(Namespace.class); when(cmdlineOptions.getString("deployment-group-name")).thenReturn(null); when(cmdlineOptions.getInt("parallelism")).thenReturn(null); when(cmdlineOptions.getLong("timeout")).thenReturn(null); when(cmdlineOptions.getLong("rollout_timeout")).thenReturn(10L); when(cmdlineOptions.getBoolean("async")).thenReturn(true); when(cmdlineOptions.getBoolean("migrate")).thenReturn(null); when(cmdlineOptions.getBoolean("overlap")).thenReturn(null); when(cmdlineOptions.getString("token")).thenReturn(null); when(cmdlineOptions.getBoolean("ignore_failures")).thenReturn(null); when(client.rollingUpdate(anyString(), any(JobId.class), any(RolloutOptions.class))) .thenReturn(immediateFuture(new RollingUpdateResponse(RollingUpdateResponse.Status.OK))); when(client.deploymentGroupStatus(GROUP_NAME)).then(new ResponseAnswer( statusResponse(DeploymentGroupStatusResponse.Status.ACTIVE, null, makeHostStatus("host1", JOB_ID, TaskStatus.State.RUNNING)) )); String optionString = "(parallelism=123, timeout=456, overlap=true, " + "token=my_token_from_job_options, ignoreFailures=true)"; command.runWithJob(cmdlineOptions, client, out, false, JOB, null); assertThat(baos.toString(), containsString(optionString)); }

Target:
public void testFallbackToJobOptions() throws Exception { final Namespace cmdlineOptions = mock(Namespace.class); when(cmdlineOptions.getString("deployment-group-name")).thenReturn(null); when(cmdlineOptions.getInt("parallelism")).thenReturn(null); when(cmdlineOptions.getLong("timeout")).thenReturn(null); when(cmdlineOptions.getLong("rollout_timeout")).thenReturn(10L); when(cmdlineOptions.getBoolean("async")).thenReturn(true); when(cmdlineOptions.getBoolean("migrate")).thenReturn(null); when(cmdlineOptions.getBoolean("overlap")).thenReturn(null); when(cmdlineOptions.getString("token")).thenReturn("cli_token"); when(cmdlineOptions.getBoolean("ignore_failures")).thenReturn(null); when(client.rollingUpdate(anyString(), any(JobId.class), any(RolloutOptions.class))) .thenReturn(immediateFuture(new RollingUpdateResponse(RollingUpdateResponse.Status.OK))); when(client.deploymentGroupStatus(GROUP_NAME)).then(new ResponseAnswer( statusResponse(DeploymentGroupStatusResponse.Status.ACTIVE, null, makeHostStatus("host1", JOB_ID, TaskStatus.State.RUNNING)) )); String optionString = "(parallelism=123, timeout=456, overlap=true, " + "token=cli_token, ignoreFailures=true)"; command.runWithJob(cmdlineOptions, client, out, false, JOB, null); assertThat(baos.toString(), containsString(optionString)); }
Source:
public void whenUpdateView_thenViewShouldReflectChanges() { TwoWayCurrentHourAttribute attribute = new TwoWayCurrentHourAttribute(); int newCurrentHourValue = RandomValues.anyInteger(); attribute.updateView(view, newCurrentHourValue); assertThat(view.getCurrentHour(), is(newCurrentHourValue)); }

Target:
public void whenUpdateView_thenViewShouldReflectChanges() { TwoWayCurrentHourAttribute attribute = new TwoWayCurrentHourAttribute(); int newCurrentHourValue = RandomValues.integerBetween(1,24); attribute.updateView(view, newCurrentHourValue); assertThat(view.getCurrentHour(), is(newCurrentHourValue)); }