Provide tooling to work with 3rd party libraries where the components are not named
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reviewing pull request #255, which the issue identifies as the proposed entry point for component naming. Check how field-derived names, generated names, overwriting, and generated-only mode are handled, and consider the examples in this issue as the completion criteria.
Written by the indexing model from the issue text.
Description
I work a lot with 3rd party software where the UI has not been well designed and components generally do not have a 'name' attribute set, and that makes the matching code quite verbose, or sometimes impossible and I have to resort to reflection to access the components.
I've raised a PR https://github.com/assertj/assertj-swing/pull/255 which addresses this by providing a mechanism to set the name of components. It works as follows:
Use the field name where possible. e.g.
private JTextField myText; // Set the name to be 'myText'
For anonymous fields, use a unique generated name. e.g.
public void createComponents(){
add(new JTextField()); // Set the name to be 'JTextField-1'
add(new JTextField()); // Set the name to be 'JTextField-2'
}
Optionally allow overwriting the names of fields. This is useful where the components have been given unsuitable or identical names.
public void createComponentsBadly(){
textField1.setName("text1");
...
textField2.setName("text1");
}
Optionally allow only using generated names. This is useful when the code has been obfuscated and the field names do not provide any meaning, or when the field names are confusing
private JTextField a; // Set the name to be 'JTextField-1'
private JTextField b; // Set the name to be 'JTextField-2'
private JTextField combo1; // Set the name to be 'JTextField-3'
- Dominant language
- Java
- Stars
- 121
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from assertj/assertj-swing
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
assertj/assertj-swing#279 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
assertj/assertj-swing#278 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
assertj/assertj-swing#276 · 1 comment ·
-
Update unit test to avoid deprecated `ExpectedException.none()` by using `Assert.assertThrows()` Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
assertj/assertj-swing#275 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
assertj/assertj-swing#277 · 1 comment ·
All issues in assertj/assertj-swing
Similar issues
-
certification
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Openbug ecr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Needs: Triage Type: Feature request
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·