auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isConnected() { boolean isConnected = false; if (initialized) { try { isConnected = restApi().isConnected(sid); <START> } catch (NotConnectedRestException e) { <END> } } return isConnected; }</code><technical_language>If want isConnected throws exception (as stated in commit message), Exception Throwable catched (i.e. IOException thrown)</technical_language>

Target:
public boolean isConnected() { boolean isConnected = false; if (initialized) { try { isConnected = restApi().isConnected(sid); } catch (Throwable e) { } } return isConnected; }
Source:
<code>private synchronized void initializeSpelFunctionRegistrarIfNecessary(ParserContext parserContext) { if (!this.initialized) { BeanDefinitionBuilder registrarBuilder = BeanDefinitionBuilder <START> .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".config.SpelFunctionRegistrar"); <END> registrarBuilder.addConstructorArgValue(this.functions); BeanDefinitionReaderUtils.registerWithGeneratedName(registrarBuilder.getBeanDefinition(), parserContext.getRegistry()); this.initialized = true; } }</code><technical_language>String literal SFR.class ?? (again, I fix)</technical_language>

Target:
private synchronized void initializeSpelFunctionRegistrarIfNecessary(ParserContext parserContext) { if (!this.initialized) { BeanDefinitionBuilder registrarBuilder = BeanDefinitionBuilder .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".config.SpelFunctionRegistrar") .setRole(BeanDefinition.ROLE_INFRASTRUCTURE) .addConstructorArgValue(this.functions); BeanDefinitionReaderUtils.registerWithGeneratedName(registrarBuilder.getBeanDefinition(), parserContext.getRegistry()); this.initialized = true; } }
Source:
<code>protected FixedDoubleHistogram(FixedDoubleHistogram other) { bucketCount = other.bucketCount; min = other.min; max = other.max; weights = new double[bucketCount]; for (int i = 0; i < bucketCount; ++i) { <START> weights[i] = other.weights[i]; <END> } }</code><technical_language>arraycopy</technical_language>

Target:
protected FixedDoubleHistogram(FixedDoubleHistogram other) { bucketCount = other.bucketCount; min = other.min; max = other.max; weights = new double[bucketCount]; System.arraycopy(other.weights, 0, weights, 0, bucketCount); }
Source:
<code>public HostCriteria(boolean paused, UUID configHash, UUID meshHash, boolean enterprise, StartAction startAction, boolean bare, int hostCount, NodeState nodeState, boolean addAllowed, boolean safeMode, String terminusNonce) { checkArgument(configHash != null, "config hash is null"); checkArgument(meshHash != null, "mesh hash is null"); checkArgument(startAction != null, "start action is null"); checkArgument(hostCount > 0, "host count %s is less then one", hostCount); <START> checkArgument(terminusNonce == null || !terminusNonce.trim().isEmpty(), <END> "terminus is blank"); m_paused = paused; m_configHash = configHash; m_meshHash = meshHash; m_enterprise = enterprise; m_startAction = startAction; m_bare = bare; m_hostCount = hostCount; m_nodeState = nodeState; m_addAllowed = addAllowed; m_safeMode = safeMode; m_terminusNonce = terminusNonce; }</code><technical_language>!isEmpty() thought checking for empty</technical_language>

Target:
public HostCriteria(boolean paused, UUID configHash, UUID meshHash, boolean enterprise, StartAction startAction, boolean bare, int hostCount, NodeState nodeState, boolean addAllowed, boolean safeMode, String terminusNonce) { checkArgument(configHash != null, "config hash is null"); checkArgument(meshHash != null, "mesh hash is null"); checkArgument(startAction != null, "start action is null"); checkArgument(hostCount > 0, "host count %s is less then one", hostCount); checkArgument(terminusNonce == null || !terminusNonce.trim().isEmpty(), "terminus should not be blank"); m_paused = paused; m_configHash = configHash; m_meshHash = meshHash; m_enterprise = enterprise; m_startAction = startAction; m_bare = bare; m_hostCount = hostCount; m_nodeState = nodeState; m_addAllowed = addAllowed; m_safeMode = safeMode; m_terminusNonce = terminusNonce; }
Source:
<code>public void testExecute() { InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor.googleId; loginAsInstructor(instructorId); ______TS("Invalid parameters"); verifyHttpParameterFailure(); String[] invalidParams = new String[] {}; <START> verifyHttpParameterFailure(invalidParams); <END> ______TS("Typical successful case"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, }; GetCourseEnrollStudentsAction action = getAction(submissionParams); JsonResult jsonResult = getJsonResult(action); assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); String expectedString = "Section 1|Team 1.1</td></div>'\"|student1 In Course1</td></div>'\"" + "|student1InCourse1@gmail.tmt|comment for student1InCourse1</td></div>'\"" + "Section 1|Team 1.1</td></div>'\"|student2 In Course1|student2InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student3 In Course1|student3InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student4 In Course1|student4InCourse1@gmail.tmt|" + "Section 2|Team 1.2|student5 In Course1|student5InCourse1@gmail.tmt|"; StudentList output = (StudentList) jsonResult.getOutput(); StringBuilder resultString = new StringBuilder(); for (StudentAttributes student : output.getEnrolledStudents()) { resultString.append(student.toEnrollmentString()); } assertEquals(expectedString, resultString.toString()); }</code><technical_language>This is // parameters</technical_language>

Target:
public void testExecute() { InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor.googleId; loginAsInstructor(instructorId); ______TS("Invalid parameters"); verifyHttpParameterFailure(); ______TS("Typical successful case"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, }; GetCourseEnrollStudentsAction action = getAction(submissionParams); JsonResult jsonResult = getJsonResult(action); assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); String expectedString = "Section 1|Team 1.1</td></div>'\"|student1 In Course1</td></div>'\"" + "|student1InCourse1@gmail.tmt|comment for student1InCourse1</td></div>'\"" + "Section 1|Team 1.1</td></div>'\"|student2 In Course1|student2InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student3 In Course1|student3InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student4 In Course1|student4InCourse1@gmail.tmt|" + "Section 2|Team 1.2|student5 In Course1|student5InCourse1@gmail.tmt|"; StudentList output = (StudentList) jsonResult.getOutput(); StringBuilder resultString = new StringBuilder(); for (StudentAttributes student : output.getEnrolledStudents()) { resultString.append(student.toEnrollmentString()); } assertEquals(expectedString, resultString.toString()); }
Source:
<code>protected void assertMegabyteAndETagMatches(String regionId, String containerName, String name, String etag1s) { SwiftObject object1s = getApi().getObjectApi(regionId, containerName).get(name); assertThat(object1s.getETag().equals(etag1s)); <START> assertThat(object1s.getPayload().getContentMetadata().getContentLength().equals(Long.valueOf(1024 * 1024))); <END> }</code><technical_language>Prefer 1024L * 1024L valueOf</technical_language>

Target:
protected void assertMegabyteAndETagMatches(String regionId, String containerName, String name, String etag1s) { SwiftObject object1s = getApi().getObjectApi(regionId, containerName).get(name); assertThat(object1s.getETag()).isEqualTo(etag1s); assertThat(object1s.getPayload().getContentMetadata().getContentLength()).isEqualTo(Long.valueOf(1024L * 1024L)); }
Source:
<code>public void visitNode(Tree tree) { if(!hasSemantic()) { return; } if (tree.is(Tree.Kind.METHOD, Tree.Kind.CONSTRUCTOR)) { checkIfUnused((MethodTree) tree); <START> } else { <END> checkIfUnknown(tree); } }</code><technical_language>I explicit tests for kind (or switch) overloaded method for those. classCast happen. is a lot of implicit on. explicit. checkIfUnknown(MethodInvocationTree ) checkIfUnknown(NewClasstree )</technical_language>

Target:
public void visitNode(Tree tree) { if(!hasSemantic()) { return; } switch (tree.kind()) { case METHOD: case CONSTRUCTOR: checkIfUnused((MethodTree) tree); break; case NEW_CLASS: checkIfUnknown((NewClassTree) tree); break; case METHOD_INVOCATION: checkIfUnknown((MethodInvocationTree) tree); break; case METHOD_REFERENCE: checkIfUnknown((MethodReferenceTree) tree); break; default: throw new IllegalStateException("Unexpected subscribed tree."); } }
Source:
<code>private String formatAccountAttribute(AccountAttribute who) { <START> if (who != null && who.name != null) { <END> return who.name; } return anonymousCowardName; }</code><technical_language>if who.name is empty string? Is OK? If need avoid empty names, this caught by: if (who != null && !Strings.isNullOrEmpty(who.name)) {</technical_language>

Target:
private String formatAccountAttribute(AccountAttribute who) { if (who != null && !Strings.isNullOrEmpty(who.name)) { return who.name; } return anonymousCowardName; }
Source:
<code>public <JavaTypeT> TypeCodec<JavaTypeT> codecFor(@NonNull JavaTypeT value) { Preconditions.checkNotNull(value); LOG.trace("[{}] Looking up codec for object {}", logPrefix, value); for (TypeCodec<?> primitiveCodec : primitiveCodecs) { if (primitiveCodec.accepts(value)) { LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec); return uncheckedCast(primitiveCodec); } } for (TypeCodec<?> userCodec : userCodecs) { if (userCodec.accepts(value)) { LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec); return uncheckedCast(userCodec); } } DataType cqlType = inferCqlTypeFromValue(value); GenericType<?> javaType = inspectType(value, cqlType); LOG.trace("[{}] Continuing based on inferred type {}", logPrefix, javaType); <START> return uncheckedCast(getCachedCodec(cqlType, javaType, true)); <END> }</code><technical_language>in this case true passed isJavaCovariant for cases</technical_language>

Target:
public <JavaTypeT> TypeCodec<JavaTypeT> codecFor(@NonNull JavaTypeT value) { Preconditions.checkNotNull(value); LOG.trace("[{}] Looking up codec for object {}", logPrefix, value); for (TypeCodec<?> primitiveCodec : primitiveCodecs) { if (primitiveCodec.accepts(value)) { LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec); return uncheckedCast(primitiveCodec); } } for (TypeCodec<?> userCodec : userCodecs) { if (userCodec.accepts(value)) { LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec); return uncheckedCast(userCodec); } } DataType cqlType = inferCqlTypeFromValue(value); GenericType<?> javaType = inspectType(value, cqlType); LOG.trace( "[{}] Continuing based on inferred CQL type and Java type {}", logPrefix, cqlType, javaType); return uncheckedCast(getCachedCodec(cqlType, javaType, true)); }
Source:
<code>private void initXPathRuleQuery() { <START> if (xPathRuleQueryNeedsInitialization()) { <END> final String xpath = getProperty(XPATH_DESCRIPTOR); final String version = getProperty(VERSION_DESCRIPTOR); initRuleQueryBasedOnVersion(version); xpathRuleQuery.setXPath(xpath); xpathRuleQuery.setVersion(version); xpathRuleQuery.setProperties(getPropertiesByPropertyDescriptor()); } }</code><technical_language>This check moved out call-sites (l. 100), is btw case l. 145</technical_language>

Target:
private void initXPathRuleQuery() { String xpath = getProperty(XPATH_DESCRIPTOR); String version = getProperty(VERSION_DESCRIPTOR); initRuleQueryBasedOnVersion(version); xpathRuleQuery.setXPath(xpath); xpathRuleQuery.setVersion(version); xpathRuleQuery.setProperties(getPropertiesByPropertyDescriptor()); }
Source:
<code>public void newFolderWithGivenFolderThrowsIOExceptionIfFolderNameConsistsOfMultiplePathComponents() throws IOException { thrown.expect(IOException.class); String errorMsg = "Folder name cannot consist of multiple path components separated by a file separator." + " Please use newFolder('MyParentFolder','MyFolder') to create hierarchies of folders"; <START> thrown.expectMessage(errorMsg); <END> tempFolder.create(); tempFolder.newFolder("temp1/temp2"); }</code><technical_language>note expectMessage a substring match, need put entire error message. I hard-code entire error message in test unnecessary brittle. check for a substring "name consist of multiple path components"? Thanks</technical_language>

Target:
public void newFolderWithGivenFolderThrowsIOExceptionIfFolderNameConsistsOfMultiplePathComponents() throws IOException { tempFolder.create(); thrown.expect(IOException.class); thrown.expectMessage("name cannot consist of multiple path components"); tempFolder.newFolder("temp1/temp2"); }
Source:
<code><START> public static <O extends JavaSource<O>> int getArrayDimension(String name) <END> { int count = 0; if (name != null) { if (isGeneric(name)) { name = stripGenerics(name); } for (char c : name.toCharArray()) { if (c == '[') { count++; } } } return count; }</code><technical_language>is this method parameterized</technical_language>

Target:
public static int getArrayDimension(String name) { int count = 0; if (name != null) { if (isGeneric(name)) { name = stripGenerics(name); } for (char c : name.toCharArray()) { if (c == '[') { count++; } } } return count; }
Source:
<code><START> public Type getType() { <END> return null; }</code><technical_language>Need implement</technical_language>

Target:
public Type getType() { return Type.SHARED; }
Source:
<code>public void open() throws InterpreterException { sparkInterpreter = getInterpreterInTheSameSessionByClassName(SparkInterpreter.class); jsc = sparkInterpreter.getJavaSparkContext(); sparkVersion = SparkVersion.fromVersionString(jsc.version()); <START> assertVersion(); <END> z = sparkInterpreter.getZeppelinContext(); SparkKotlinReceiver ctx = new SparkKotlinReceiver( sparkInterpreter.getSparkSession(), jsc, sparkInterpreter.getSQLContext(), z); List<String> classpath = sparkClasspath(); String outputDir = null; SparkConf conf = jsc.getConf(); if (conf != null) { outputDir = conf.getOption("spark.repl.class.outputDir").getOrElse(null); } interpreter.properties() .receiver(ctx) .classPath(classpath) .outputDir(outputDir) .codeOnLoad(KotlinZeppelinBindings.Z_SELECT_KOTLIN_SYNTAX) .codeOnLoad(KotlinZeppelinBindings.SPARK_UDF_IMPORTS) .codeOnLoad(KotlinZeppelinBindings.CAST_SPARK_SESSION); interpreter.open(); }</code><technical_language>this method throws exception - is this error shown notebook user</technical_language>

Target:
public void open() throws InterpreterException { sparkInterpreter = getInterpreterInTheSameSessionByClassName(SparkInterpreter.class); jsc = sparkInterpreter.getJavaSparkContext(); SparkVersion sparkVersion = SparkVersion.fromVersionString(jsc.version()); if (sparkVersion.olderThan(KOTLIN_SPARK_SUPPORTED_VERSION)) { unsupportedMessage = new InterpreterResult( InterpreterResult.Code.ERROR, "Spark version is " + sparkVersion + ", only " + KOTLIN_SPARK_SUPPORTED_VERSION + " and newer are supported"); } z = sparkInterpreter.getZeppelinContext(); SparkKotlinReceiver ctx = new SparkKotlinReceiver( sparkInterpreter.getSparkSession(), jsc, sparkInterpreter.getSQLContext(), z); List<String> classpath = sparkClasspath(); String outputDir = null; SparkConf conf = jsc.getConf(); if (conf != null) { outputDir = conf.getOption("spark.repl.class.outputDir").getOrElse(null); } interpreter.getKotlinReplProperties() .receiver(ctx) .classPath(classpath) .outputDir(outputDir) .codeOnLoad(KotlinZeppelinBindings.Z_SELECT_KOTLIN_SYNTAX) .codeOnLoad(KotlinZeppelinBindings.SPARK_UDF_IMPORTS) .codeOnLoad(KotlinZeppelinBindings.CAST_SPARK_SESSION); interpreter.open(); }
Source:
<code>protected Builder() { id("packet") .name("Packet Compute Services") .apiMetadata(new PacketApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .endpoint("<LINK_0>") <START> .defaultProperties(PacketProviderMetadata.defaultProperties()); <END> }</code><technical_language>Do regions put iso codes here</technical_language>

Target:
protected Builder() { id("packet") .name("Packet Compute Services") .apiMetadata(new PacketApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .endpoint("<LINK_0>") .iso3166Codes("US-CA", "US-NJ", "NL", "JP") .defaultProperties(PacketProviderMetadata.defaultProperties()); }
Source:
<code>public Optional<Object> value() { <START> return Optional.of(_value); <END> }</code><technical_language>ofNullable</technical_language>

Target:
public Optional<Object> value() { return Optional.ofNullable(_value); }
Source:
<code>public static void listJobs() throws IOException { String projectId = "your-project-id"; String filter = "state=DONE"; <START> String jobType = "INSPECT_JOB"; <END> listJobs(projectId, filter, jobType); }</code><technical_language>please move filter jobType sample</technical_language>

Target:
public static void listJobs() throws IOException { String projectId = "your-project-id"; listJobs(projectId); }
Source:
<code>protected URL retrieve(Channel channel, long sum1, long sum2) throws IOException, InterruptedException { File target = map(sum1, sum2); File parent = target.getParentFile(); if (target.exists()) { LOGGER.fine(String.format("Jar file already exists: %16X%16X", sum1, sum2)); return target.toURI().toURL(); } parent.mkdirs(); try { File tmp = File.createTempFile(target.getName(), "tmp", parent); try { RemoteOutputStream o = new RemoteOutputStream(new FileOutputStream(tmp)); try { LOGGER.log(Level.FINE, String.format("Retrieving jar file %16X%16X",sum1,sum2)); getJarLoader(channel).writeJarTo(sum1, sum2, o); } finally { o.close(); } Checksum expected = new Checksum(sum1, sum2); Checksum actual = Checksum.forFile(tmp); if (!expected.equals(actual)) { throw new IOException(String.format( <START> "Incorrect checksum of retrieved jar: %s%nExpected: %s\nActual: %s", <END> tmp.getAbsolutePath(), expected, actual)); } if (!tmp.renameTo(target)) { if (!target.exists()) { throw new IOException("Unable to create " + target + " from " + tmp); } actual = Checksum.forFile(target); if (!expected.equals(actual)) { throw new IOException(String.format( "Incorrect checksum of previous jar: %s%nExpected: %s\nActual: %s", target.getAbsolutePath(), expected, actual)); } } return target.toURI().toURL(); } finally { tmp.delete(); } } catch (IOException e) { throw (IOException)new IOException("Failed to write to "+target).initCause(e); } }</code><technical_language>other instance lines</technical_language>

Target:
protected URL retrieve(Channel channel, long sum1, long sum2) throws IOException, InterruptedException { File target = map(sum1, sum2); File parent = target.getParentFile(); if (target.exists()) { LOGGER.fine(String.format("Jar file already exists: %16X%16X", sum1, sum2)); return target.toURI().toURL(); } parent.mkdirs(); try { File tmp = File.createTempFile(target.getName(), "tmp", parent); try { RemoteOutputStream o = new RemoteOutputStream(new FileOutputStream(tmp)); try { LOGGER.log(Level.FINE, String.format("Retrieving jar file %16X%16X",sum1,sum2)); getJarLoader(channel).writeJarTo(sum1, sum2, o); } finally { o.close(); } Checksum expected = new Checksum(sum1, sum2); Checksum actual = Checksum.forFile(tmp); if (!expected.equals(actual)) { throw new IOException(String.format( "Incorrect checksum of retrieved jar: %s%nExpected: %s%nActual: %s", tmp.getAbsolutePath(), expected, actual)); } if (!tmp.renameTo(target)) { if (!target.exists()) { throw new IOException("Unable to create " + target + " from " + tmp); } actual = Checksum.forFile(target); if (!expected.equals(actual)) { throw new IOException(String.format( "Incorrect checksum of previous jar: %s%nExpected: %s%nActual: %s", target.getAbsolutePath(), expected, actual)); } } return target.toURI().toURL(); } finally { tmp.delete(); } } catch (IOException e) { throw (IOException)new IOException("Failed to write to "+target).initCause(e); } }
Source:
<code>public void onSendToConsole(final SendToConsoleEvent event) { server_.adaptToLanguage( event.getLanguage(), new ServerRequestCallback<Void>() { @Override public void onResponseReceived(Void response) { sendToConsoleImpl(event); } @Override public void onError(ServerError error) { <START> Debug.logError(error); <END> } }); }</code><technical_language>I send console a failsafe; sending console broken indefinitely if broken in language adaptation</technical_language>

Target:
public void onSendToConsole(final SendToConsoleEvent event) { if (!StringUtil.equals(event.getLanguage(), language_)) { server_.adaptToLanguage( event.getLanguage(), new ServerRequestCallback<Void>() { @Override public void onResponseReceived(Void response) { language_ = event.getLanguage(); sendToConsoleImpl(event); } @Override public void onError(ServerError error) { Debug.logError(error); sendToConsoleImpl(event); } }); } else { sendToConsoleImpl(event); } }
Source:
<code>public void actionPerformed(final ActionEvent e) { final Controller controller = Controller.getCurrentController(); final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class); final MapModel model = controller.getMap(); <START> mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, MapStyle.CLEAR_BACKGROUND_IMAGE); <END> }</code><technical_language>I identifier here. I expect equal null</technical_language>

Target:
public void actionPerformed(final ActionEvent e) { final Controller controller = Controller.getCurrentController(); final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class); final MapModel model = controller.getMap(); mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, null); }
Source:
<code>public static Tuple testTuple(List<Object> values, MkTupleParam param) { String stream = param.getStream(); if (stream == null) { stream = Utils.DEFAULT_STREAM_ID; } String component = param.getComponent(); if (component == null) { component = "component"; } int task = 1; List<String> fields = param.getFields(); if (fields == null) { fields = new ArrayList<>(values.size()); for (int i = 1; i <= values.size(); i++) { fields.add("field" + i); } } <START> CustomIndexArray<String> taskToComp = new CustomIndexArray<>(task,task+1); <END> taskToComp.set(task, component); Map<String, Map<String, Fields>> compToStreamToFields = new HashMap<>(); Map<String, Fields> streamToFields = new HashMap<>(); streamToFields.put(stream, new Fields(fields)); compToStreamToFields.put(component, streamToFields); TopologyContext context = new TopologyContext(null, ConfigUtils.readStormConfig(), taskToComp, null, compToStreamToFields, null, "test-storm-id", null, null, 1, null, null, new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(), new AtomicBoolean(false)); return new TupleImpl(context, values, component, 1, stream); }</code><technical_language>If upper inclusive do need task, task+1</technical_language>

Target:
public static Tuple testTuple(List<Object> values, MkTupleParam param) { String stream = param.getStream(); if (stream == null) { stream = Utils.DEFAULT_STREAM_ID; } String component = param.getComponent(); if (component == null) { component = "component"; } int task = 1; List<String> fields = param.getFields(); if (fields == null) { fields = new ArrayList<>(values.size()); for (int i = 1; i <= values.size(); i++) { fields.add("field" + i); } } CustomIndexArray<String> taskToComp = new CustomIndexArray<>(task,task); taskToComp.set(task, component); Map<String, Map<String, Fields>> compToStreamToFields = new HashMap<>(); Map<String, Fields> streamToFields = new HashMap<>(); streamToFields.put(stream, new Fields(fields)); compToStreamToFields.put(component, streamToFields); TopologyContext context = new TopologyContext(null, ConfigUtils.readStormConfig(), taskToComp, null, compToStreamToFields, null, "test-storm-id", null, null, 1, null, null, new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(), new AtomicBoolean(false)); return new TupleImpl(context, values, component, 1, stream); }
Source:
<code>private void refreshView() { <START> Spinner spinner = (Spinner) findViewById(R.id.app_selection_spinner); <END> TextView message = (TextView) findViewById(R.id.welcome_msg); ArrayList<ApplicationRecord> readyApps = CommCareApplication._().getReadyAppRecords(); if (readyApps.size() <= 1) { spinner.setVisibility(View.GONE); message.setText(R.string.login_welcome_single); return; } message.setText(R.string.login_welcome_multiple); ArrayList<String> appNames = new ArrayList<>(); ArrayList<String> appIds = new ArrayList<>(); for (ApplicationRecord r : readyApps) { String name = r.getDisplayName(); appNames.add(name); appIds.add(r.getUniqueId()); namesToRecords.put(name, r); } ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.spinner_text_view, appNames); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String lastApp = prefs.getString(KEY_LAST_APP,""); int position = 0; if (!"".equals(lastApp)) { position = appIds.indexOf(lastApp); if (position == -1) { position = 0; } } spinner.setSelection(position); spinner.setVisibility(View.VISIBLE); }</code><technical_language>declare fields in activity prevent need for this</technical_language>

Target:
private void refreshView() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { refreshActionBar(); } ArrayList<ApplicationRecord> readyApps = CommCareApplication._().getUsableAppRecords(); if (readyApps.size() == 1) { spinner.setVisibility(View.GONE); welcomeMessage.setText(Localization.get("login.welcome.single")); ApplicationRecord r = readyApps.get(0); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putString(KEY_LAST_APP, r.getUniqueId()).commit(); } else { welcomeMessage.setText(Localization.get("login.welcome.multiple")); ArrayList<String> appNames = new ArrayList<>(); ArrayList<String> appIds = new ArrayList<>(); for (ApplicationRecord r : readyApps) { appNames.add(r.getDisplayName()); appIds.add(r.getUniqueId()); appRecordDropdownList.add(r); } ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.spinner_text_view, appNames); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); String currAppId = CommCareApplication._().getCurrentApp().getUniqueId(); int position = appIds.indexOf(currAppId); spinner.setSelection(position); spinner.setVisibility(View.VISIBLE); } }
Source:
<code>public ICompletableFuture<ReadResultSet<E>> readManyAsync(long startSequence, int minCount, int maxCount, IFunction<E, Boolean> filter) { checkSequence(startSequence); checkNotNegative(minCount, "minCount can't be smaller than 0"); checkTrue(maxCount >= minCount, "maxCount should be equal or larger than minCount"); try { <START> checkTrue(minCount <= capacity(), "the minCount should be smaller than or equal to the capacity"); <END> } catch (Throwable e) { e = new ExecutionException(e); ExecutorService userExecutor = getContext().getExecutionService().getUserExecutor(); return new CompletedFuture<ReadResultSet<E>>(getSerializationService(), e, userExecutor); } checkTrue(maxCount <= MAX_BATCH_SIZE, "maxCount can't be larger than " + MAX_BATCH_SIZE); ClientMessage request = RingbufferReadManyCodec.encodeRequest( name, startSequence, minCount, maxCount, toData(filter)); try { ClientInvocationFuture invocationFuture = new ClientInvocation(getClient(), request, getName(), partitionId).invoke(); return new ClientDelegatingFuture<ReadResultSet<E>>(invocationFuture, getSerializationService(), readManyAsyncResponseDecoder); } catch (Exception e) { throw rethrow(e); } }</code><technical_language>interface, this throw IllegalArgumentException minCount is larger capacity. handle cases differently: - capacity() throwing exception - minCount larger capacity</technical_language>

Target:
public ICompletableFuture<ReadResultSet<E>> readManyAsync(long startSequence, int minCount, int maxCount, IFunction<E, Boolean> filter) { checkSequence(startSequence); checkNotNegative(minCount, "minCount can't be smaller than 0"); checkTrue(maxCount >= minCount, "maxCount should be equal or larger than minCount"); try { capacity(); } catch (Throwable e) { e = new ExecutionException(e); ExecutorService userExecutor = getContext().getExecutionService().getUserExecutor(); return new CompletedFuture<ReadResultSet<E>>(getSerializationService(), e, userExecutor); } checkTrue(minCount <= capacity, "the minCount should be smaller than or equal to the capacity"); checkTrue(maxCount <= MAX_BATCH_SIZE, "maxCount can't be larger than " + MAX_BATCH_SIZE); ClientMessage request = RingbufferReadManyCodec.encodeRequest( name, startSequence, minCount, maxCount, toData(filter)); try { ClientInvocationFuture invocationFuture = new ClientInvocation(getClient(), request, getName(), partitionId).invoke(); return new ClientDelegatingFuture<ReadResultSet<E>>(invocationFuture, getSerializationService(), readManyAsyncResponseDecoder); } catch (Exception e) { throw rethrow(e); } }
Source:
<code>protected boolean canDoAction() { <START> storage_pool dc = DbFacade.getInstance().getStoragePoolDAO().get(getParameters().getStoragePoolId()); <END> if (dc == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); return false; } if (!StorageHelperDirector.getInstance() .getItem(getParameters().getStorageServerConnection().getstorage_type()) .ValidateStoragePoolConnectionsInHost(getVds(), Arrays.asList(getConnection()), getParameters().getStoragePoolId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION); return false; } return true; }</code><technical_language>Please replace getStoragePoolDAO() exists AuditLoggableBase</technical_language>

Target:
protected boolean canDoAction() { storage_pool dc = getStoragePoolDAO().get(getParameters().getStoragePoolId()); if (dc == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); return false; } if (!StorageHelperDirector.getInstance() .getItem(getParameters().getStorageServerConnection().getstorage_type()) .ValidateStoragePoolConnectionsInHost(getVds(), Arrays.asList(getConnection()), getParameters().getStoragePoolId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION); return false; } return true; }
Source:
<code>void generateCode() throws IOException { ClassName hashMap = ClassName.get( "java.util", "HashMap"); ClassName str = ClassName.get( String.class ); ParameterizedTypeName mainType = ParameterizedTypeName.get( hashMap, str, str ); Set<CodeBlock> contents = new HashSet<>( ); varResults.forEach( ( key, value ) -> contents.add( <START> CodeBlock.builder().addStatement( "allConfigValues.put($S, $S);", key, value ).build() ) ); <END> TypeSpec ConfigList = TypeSpec.classBuilder( "ConfigList" ) .addModifiers( Modifier.PUBLIC, Modifier.FINAL ) .addField( FieldSpec.builder ( mainType, "allConfigValues", Modifier.STATIC, Modifier.FINAL, Modifier.PUBLIC ) .initializer( "new HashMap<>()" ) .build() ) .addStaticBlock( CodeBlock.join( contents, " " ) ) .build(); JavaFile javaFile = JavaFile.builder( processingEnv.getOptions().get( PACKAGE_NAME ), ConfigList ).build(); javaFile.writeTo( new File( processingEnv.getOptions().get( GENERATION_DIR ) ) ); StringBuilder propertyIndex = new StringBuilder(); indexResults.forEach( (key, value) -> propertyIndex.append( " * [" ). append( key ).append( "](" ).append( value ).append( ")" ).append( System.lineSeparator() ) ); FileUtils.writeStringToFile( new File(processingEnv.getOptions().get( ROOT_DIR ) + File.separator + "target" + File.separator + "property-index-subset.md"), propertyIndex.toString(), Charset.defaultCharset()); }</code><technical_language>; necessary statement apparently includes one, leading double ;;</technical_language>

Target:
void generateCode() throws IOException { ClassName hashMap = ClassName.get( "java.util", "HashMap"); ClassName str = ClassName.get( String.class ); ParameterizedTypeName mainType = ParameterizedTypeName.get( hashMap, str, str ); Set<CodeBlock> contents = new HashSet<>( ); varResults.forEach( ( key, value ) -> contents.add( CodeBlock.builder().addStatement( "allConfigValues.put($S, $S)", key, value ).build() ) ); TypeSpec ConfigList = TypeSpec.classBuilder( "ConfigList" ) .addModifiers( Modifier.PUBLIC, Modifier.FINAL ) .addField( FieldSpec.builder ( mainType, "allConfigValues", Modifier.STATIC, Modifier.FINAL, Modifier.PUBLIC ) .initializer( "new HashMap<>(" + indexResults.size() + ')') .build() ) .addStaticBlock( CodeBlock.join( contents, " " ) ) .build(); JavaFile javaFile = JavaFile.builder( processingEnv.getOptions().get( PACKAGE_NAME ), ConfigList ).build(); javaFile.writeTo( new File( processingEnv.getOptions().get( GENERATION_DIR ) ) ); StringBuilder propertyIndex = new StringBuilder(); indexResults.forEach( (key, value) -> propertyIndex.append( " * [" ). append( key ).append( "](" ).append( value ).append( ")" ).append( System.lineSeparator() ) ); FileUtils.writeStringToFile( new File(processingEnv.getOptions().get( ROOT_DIR ) + File.separator + "target" + File.separator + "property-index-subset.md"), propertyIndex.toString(), Charset.defaultCharset()); }
Source:
<code>public static void notNaN(final double value, final String message, final Object... values) { <START> if (value != value) { <END> throw new IllegalArgumentException(String.format(message, values)); } }</code><technical_language>Double.isNaN(double) here. Reads better, IMHO</technical_language>

Target:
public static void notNaN(final double value, final String message, final Object... values) { if (Double.isNaN(value)) { throw new IllegalArgumentException(String.format(message, values)); } }
Source:
<code><START> public static void getVideoDownloadFolder(Context context) { <END> getFolder(context, R.string.download_path_key, Environment.DIRECTORY_MOVIES); }</code><technical_language>if void this sense</technical_language>

Target:
public static File getVideoDownloadFolder(Context context) { return getFolder(context, R.string.download_path_key, Environment.DIRECTORY_MOVIES); }
Source:
<code>public void fetchMetadataOfPreciousResults() { if (metadataRequest != null) { metadataRequest.cancel(); metadataRequest = null; } Integer jobId = model.getSelectedJob().getId(); SchedulerServiceAsync scheduler = Scheduler.getSchedulerService(); metadataRequest = scheduler.getPreciousTaskName(LoginModel.getInstance().getSessionId(), jobId.toString(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { String msg = JSONUtils.getJsonErrorMessage(caught); <START> if (msg.equals("HTTP 403 Forbidden")) { <END> getModel().preciousTaskNamesNotAuthorized(); LogModel.getInstance() .logImportantMessage(JobResultView.NOT_AUTHORIZED); } else { LogModel.getInstance() .logImportantMessage("Error while fetching metadata of precious results:\n" + JSONUtils.getJsonErrorMessage(caught)); } } @Override public void onSuccess(String jsonString) { try { JSONArray array = parseJSON(jsonString).isArray(); List<String> preciousTaskNames = new ArrayList<>(array.size()); for (int i = 0; i < array.size(); ++i) { String taskName = array.get(i) .isString() .stringValue(); preciousTaskNames.add(taskName); } getModel().setPreciousTaskNamesLoaded(preciousTaskNames); } catch (JSONException e) { LogModel.getInstance() .logCriticalMessage(e.getMessage()); } } }); }</code><technical_language>replace msg.equals msg.contains more resilient if message is updated</technical_language>

Target:
public void fetchMetadataOfPreciousResults() { if (metadataRequest != null) { metadataRequest.cancel(); metadataRequest = null; } Integer jobId = model.getSelectedJob().getId(); SchedulerServiceAsync scheduler = Scheduler.getSchedulerService(); metadataRequest = scheduler.getPreciousTaskName(LoginModel.getInstance().getSessionId(), jobId.toString(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { String msg = JSONUtils.getJsonErrorMessage(caught); if (msg.contains("HTTP 403 Forbidden")) { getModel().preciousTaskNamesNotAuthorized(); LogModel.getInstance() .logImportantMessage(JobResultView.NOT_AUTHORIZED); } else { LogModel.getInstance() .logImportantMessage("Error while fetching metadata of precious results:\n" + JSONUtils.getJsonErrorMessage(caught)); } } @Override public void onSuccess(String jsonString) { try { JSONArray array = parseJSON(jsonString).isArray(); List<String> preciousTaskNames = new ArrayList<>(array.size()); for (int i = 0; i < array.size(); ++i) { String taskName = array.get(i) .isString() .stringValue(); preciousTaskNames.add(taskName); } getModel().setPreciousTaskNamesLoaded(preciousTaskNames); } catch (JSONException e) { LogModel.getInstance() .logCriticalMessage(e.getMessage()); } } }); }
Source:
<code>public int hashCode(){ int hash = 1; hash = hash * 31 + type.hashCode(); <START> hash = hash * 31 + result.hashCode(); <END> return hash; }</code><technical_language>31 from? *=</technical_language>

Target:
public int hashCode(){ int hash = 1; hash *= 31 + type.hashCode(); hash *= 31 + result.hashCode(); return hash; }
Source:
<code>public Collection<String> getDataKeys() { if (data != null) { return data.keySet(); } <START> return Collections.EMPTY_SET; <END> }</code><technical_language>I methods instead, emptySet()</technical_language>

Target:
public Collection<String> getDataKeys() { if (data != null) { return data.keySet(); } return Collections.emptySet(); }
Source:
<code>public String getCommaSeparatedPatientIds() { StringBuilder sb = new StringBuilder(); for (CohortMember member : getMembers()) { sb.append(member.getPatientId().getPatientId().toString()); sb.append(","); } <START> return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : ""; <END> }</code><technical_language>change form sb.toString()? looked cleaner able handle empty builder</technical_language>

Target:
public String getCommaSeparatedPatientIds() { StringBuilder sb = new StringBuilder(); for (CohortMembership member : getMembers()) { sb.append(member.getPatient().getPatientId()); sb.append(","); } return sb.toString(); }
Source:
<code>public ValidationResult validate(Object fileObject) { if ( (fileObject == null && isRequired()) || (fileObject instanceof Collection && isRequired() && ((Collection) fileObject).isEmpty()) ) { return new ValidationResult(ValidationResult.Level.ERROR, getLabel() + " must be specified."); <START> } <END> else if (fileObject == null) { return ValidationResult.SUCCESS; } if (fileObject instanceof Iterable && !(fileObject instanceof Path)) { for (Object listItem : (Iterable) fileObject) { ValidationResult result = validatePath(castToPath(listItem)); if (result.getLevel() != ValidationResult.Level.SUCCESS) return result; } return ValidationResult.SUCCESS; } return validatePath(castToPath(fileObject)); }</code><technical_language>this. name for actual user input command line</technical_language>

Target:
public ValidationResult validate(Object fileObject) { if ( (fileObject == null && isRequired()) || (fileObject instanceof Collection && isRequired() && ((Collection) fileObject).isEmpty()) ) { return new ValidationResult(ValidationResult.Level.ERROR, getName() + " must be specified."); } else if (fileObject == null) { return ValidationResult.SUCCESS; } if (fileObject instanceof Iterable && !(fileObject instanceof Path)) { for (Object listItem : (Iterable) fileObject) { ValidationResult result = validatePath(castToPath(listItem)); if (result.getLevel() != ValidationResult.Level.SUCCESS) return result; } return ValidationResult.SUCCESS; } return validatePath(castToPath(fileObject)); }
Source:
<code>private Serializable computeCacheKey( final MasterReport report ) throws BeanException { final ResourceKey definitionSource = report.getDefinitionSource(); final ResourceKey parent = definitionSource.getParent(); final List<String> sourceKey; if ( parent != null ) { sourceKey = computeDefSourceKey( report, parent ); } else { sourceKey = computeDefSourceKey( report, definitionSource ); } final HashMap<String, String> params = new HashMap<>(); <START> params.put("report-locale", report.getReportEnvironment().getLocale().toString() ); <END> params.put( "query-limit", String.valueOf( report.getQueryLimit() ) ); final ReportParameterDefinition parameterDefinition = report.getParameterDefinition(); final ReportParameterValues parameterValues = report.getParameterValues(); for ( final ParameterDefinitionEntry p : parameterDefinition.getParameterDefinitions() ) { final String name = p.getName(); final Object o = parameterValues.get( name ); if ( o == null ) { params.put( name, null ); } else { params.put( name, ConverterRegistry.toAttributeValue( o ) ); } } final ArrayList<Object> key = new ArrayList<>(); key.add( sourceKey ); key.add( params ); return key; }</code><technical_language>Check style issue, please fix</technical_language>

Target:
private Serializable computeCacheKey( final MasterReport report ) throws BeanException { final ResourceKey definitionSource = report.getDefinitionSource(); final ResourceKey parent = definitionSource.getParent(); final List<String> sourceKey; if ( parent != null ) { sourceKey = computeDefSourceKey( report, parent ); } else { sourceKey = computeDefSourceKey( report, definitionSource ); } final HashMap<String, String> params = new HashMap<>(); params.put( "query-limit", String.valueOf( report.getQueryLimit() ) ); final ReportParameterDefinition parameterDefinition = report.getParameterDefinition(); final ReportParameterValues parameterValues = report.getParameterValues(); for ( final ParameterDefinitionEntry p : parameterDefinition.getParameterDefinitions() ) { final String name = p.getName(); final Object o = parameterValues.get( name ); if ( o == null ) { params.put( name, null ); } else { params.put( name, ConverterRegistry.toAttributeValue( o ) ); } } final ArrayList<Object> key = new ArrayList<>(); key.add( sourceKey ); key.add( params ); key.add( report.getReportEnvironment().getLocale().toString() ); return key; }
Source:
<code>public Object getSampleValue(Integer maxLength, Integer arrayLength) { Preconditions.checkArgument(maxLength == null || maxLength >= 0); char[] key = new char[4]; char[] value = new char[4]; int length = maxLength != null ? maxLength : 1; if (length > (key.length + value.length)) { key = new char[length + 2]; value = new char[length - key.length]; } int j = 1; key[0] = '"'; key[j++] = 'k'; for (int i = 2; i < key.length - 1; i++) { key[j++] = (char) ('0' + RANDOM.get().nextInt(Byte.MAX_VALUE) % 10); } key[j] = '"'; int k = 1; value[0] = '"'; value[k++] = 'v'; for (int i = 2; i < value.length - 1; i++) { value[k++] = (char) ('0' + RANDOM.get().nextInt(Byte.MAX_VALUE) % 10); } value[k] = '"'; StringBuilder sbr = new StringBuilder(); sbr.append("{").append(key).append(":").append(value).append("}"); byte[] bytes = Bytes.toBytes(sbr.toString()); <START> return getPhoenixJson(bytes, 0, bytes.length); <END> }</code><technical_language>Get rid of this method: getPhoenixJson(byte[], offset, length). Instead, getPhoenixJson(String), relying a String. Converting a String -> byte[] -> String is a waste</technical_language>

Target:
public Object getSampleValue(Integer maxLength, Integer arrayLength) { Preconditions.checkArgument(maxLength == null || maxLength >= 0); char[] key = new char[4]; char[] value = new char[4]; int length = maxLength != null ? maxLength : 1; if (length > (key.length + value.length)) { key = new char[length + 2]; value = new char[length - key.length]; } int j = 1; key[0] = '"'; key[j++] = 'k'; for (int i = 2; i < key.length - 1; i++) { key[j++] = (char) ('0' + RANDOM.get().nextInt(Byte.MAX_VALUE) % 10); } key[j] = '"'; int k = 1; value[0] = '"'; value[k++] = 'v'; for (int i = 2; i < value.length - 1; i++) { value[k++] = (char) ('0' + RANDOM.get().nextInt(Byte.MAX_VALUE) % 10); } value[k] = '"'; StringBuilder sbr = new StringBuilder(); sbr.append("{").append(key).append(":").append(value).append("}"); return getPhoenixJson(sbr.toString()); }
Source:
<code>public String getCheckpoint(String replicatorIdentifier) { <START> logger.entering(this.getClass().getName(),"getCheckpoint" + replicatorIdentifier); <END> BasicDocumentRevision doc = dbCore.getLocalDocument(getCheckpointDocumentId(replicatorIdentifier)); if(doc == null) { return null; } Map<String, Object> checkpointDoc = JSONUtils.deserialize(doc.asBytes(), Map.class); if(checkpointDoc == null) { return null; } else { return (String)checkpointDoc.get("lastSequence"); } }</code><technical_language>of this.getClass().getName</technical_language>

Target:
public String getCheckpoint(String replicatorIdentifier) { logger.entering("DatastoreWrapper","getCheckpoint" + replicatorIdentifier); BasicDocumentRevision doc = dbCore.getLocalDocument(getCheckpointDocumentId(replicatorIdentifier)); if(doc == null) { return null; } Map<String, Object> checkpointDoc = JSONUtils.deserialize(doc.asBytes(), Map.class); if(checkpointDoc == null) { return null; } else { return (String)checkpointDoc.get("lastSequence"); } }
Source:
<code>public void updateDownloadProgress(int newProgress) { progress = newProgress; for (int i = progress; i <= newProgress; i++) { <START> dialog.setProgress(i); <END> } }</code><technical_language>Calling setProgress() intermediate values necessary</technical_language>

Target:
public void updateDownloadProgress(int newProgress) { progress = newProgress; dialog.setProgress(newProgress); }
Source:
<code>public SSAInstruction[] getStatements() { if (statements == null) { return NO_STATEMENTS; } else { SSAInstruction[] result = new SSAInstruction[statements.size()]; Iterator<SSAInstruction> it = statements.iterator(); <START> Arrays.setAll(result, i -> it.next()); <END> return result; } }</code><technical_language>toArray</technical_language>

Target:
public SSAInstruction[] getStatements() { return statements == null ? NO_STATEMENTS : statements.toArray(new SSAInstruction[0]); }
Source:
<code>public void testCopyChildren() throws OperationException { DocumentModel folder = session.createDocumentModel(ROOT, "SourceFolder", "Folder"); folder = session.createDocument(folder); DocumentModel childDoc = session.createDocumentModel(folder.getPathAsString(), "childDoc", FILE); session.createDocument(childDoc); OperationContext context = new OperationContext(session); context.setInput(folder); <START> <END> Map<String, Serializable> params = Map.of(TARGET_PROPERTY_KEY, ROOT, NAME_PROPERTY_KEY, "CopyFolder"); DocumentModel result = (DocumentModel) automationService.run(context, CopyDocument.ID, params); result = session.getDocument(result.getRef()); assertEquals(1, session.getChildren(result.getRef()).size()); }</code><technical_language>Context in a try-with-ressource statement, as: try (var context = new OperationContext(session)) { ... }</technical_language>

Target:
public void testCopyChildren() throws OperationException { DocumentModel folder = session.createDocumentModel(ROOT, "SourceFolder", "Folder"); folder = session.createDocument(folder); DocumentModel childDoc = session.createDocumentModel(folder.getPathAsString(), "childDoc", FILE); session.createDocument(childDoc); try (OperationContext context = new OperationContext(session)) { context.setInput(folder); Map<String, Serializable> params = Map.of(TARGET_PROPERTY_KEY, ROOT, NAME_PROPERTY_KEY, COPY_FOLDER_NAME); DocumentModel result = (DocumentModel) automationService.run(context, CopyDocument.ID, params); result = session.getDocument(result.getRef()); assertNotEquals(folder.getId(), result.getId()); assertEquals(COPY_FOLDER_NAME, result.getName()); DocumentModel childCopy = session.getChild(result.getRef(), childDoc.getName()); assertNotEquals(childDoc.getId(), childCopy.getId()); assertEquals(1, session.getChildren(result.getRef()).size()); } }