New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FORGE-1863: Create a GenerateHashcodeEquals command inside the dev-tools... #470
Conversation
<artifactId>ui-test-harness</artifactId> | ||
<classifier>forge-addon</classifier> | ||
<scope>test</scope> | ||
<optional>true</optional> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional flag should be removed for test dependencies. They won't be included by subsequent projects anyway.
for(String fieldString : fields.getValue()) { | ||
selectedFields.add(targetClass.getField(fieldString)); | ||
} | ||
Refactory.createHashCodeAndEquals(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should prompt the user to choose if they want their existing methods to be overwritten.
UIPrompt comes to mind for this use case. @gastaldi what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Build 488 outcome was FAILURE using a merge of 490ddb2 Build problems:Failed tests detected
Failed tests
|
} | ||
|
||
@Test | ||
public void testHashCodeAndEqualsAlreadyInClass() throws Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test where only one method is missing and assert that they did not get overwritten (if we decide to implement that support)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test is already here, will add the check for overwriting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
On Tue, Jun 10, 2014 at 2:40 PM, Matej Briskar notifications@github.com
wrote:
In
dev-tools-java/src/test/java/org/jboss/forge/addon/devtools/java/JavaEqualsHashcodeCommandTest.java:
commandController.initialize();
commandController.setValueFor("targetClass", "Test");
UISelectMany<String> component = (UISelectMany<String>) commandController.getInputs().get("fields");
Iterable<String> valueChoices = component.getValueChoices();
commandController.setValueFor("fields", valueChoices);
commandController.execute();
reloadTargetClass();
assertNotNull(targetClass.getField("id"));
assertTrue(targetClass.getField("id").isPrivate());
assertNotNull(targetClass.getMethod("equals", Object.class));
getMethod("hashCode"));assertNotNull(targetClass.
- }
- @test
- public void testHashCodeAndEqualsAlreadyInClass() throws Exception
the test is already here, will add the check for overwriting.
—
Reply to this email directly or view it on GitHub
https://github.com/forge/core/pull/470/files#r13611121.
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."
Build 492 outcome was FAILURE using a merge of 490ddb2 Build problems:Failed tests detected
Failed tests
|
fixed |
… dev-tools-java addon
Build 506 outcome was FAILURE using a merge of 0c93e42 Build problems:Execution timeout
|
Build 535 outcome was FAILURE using a merge of 0c93e42 Build problems:Failed tests detected
Failed tests
|
Build 548 outcome was FAILURE using a merge of 0c93e42 Build problems:Failed tests detected
Failed tests
|
Build 521 outcome was FAILURE using a merge of 0c93e42 Build problems:Failed tests detected
Failed tests
|
Build 549 outcome was FAILURE using a merge of 0c93e42 Build problems:Failed tests detected
Failed tests
|
Build 520 outcome was FAILURE using a merge of 0c93e42 Build problems:Process exited with code 1
|
Build 553 outcome was FAILURE using a merge of 0c93e42 Build problems:Failed tests detected
Failed tests
|
Build 525 outcome was FAILURE using a merge of 0c93e42 Build problems:Process exited with code 1
|
Build 528 outcome was FAILURE using a merge of 0c93e42 Build problems:Process exited with code 1
|
Build 556 outcome was FAILURE using a merge of 0c93e42 Build problems:Failed tests detected
Failed tests
|
Last time I checked, you were having trouble with the simple-container. Still having trouble or is this ready? If stuck, let us know and we will help! |
...-java addon.
After the command, it writes Success and works correctly (tested in the command line and the tests), however in the command line it also leaves an exception:
Exception when parsing/running: java-generate-equals-and-hashcode --targetClass org.First.First --fields myFirstField , org.jboss.forge.roaster.model.impl.JavaClassImpl cannot be cast to org.jboss.forge.addon.resource.Resource
The same happens for the command java-generate-getters-and-setters.