GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Refactored data clumps with the help of LLMs (research project) by compf · Pull Request #3867 · junit-team/junit-framework Conversation
Contributor
OverviewHello maintainers, I am conducting a master thesis project focused on enhancing code quality through automated refactoring of data clumps, assisted by Large Language Models (LLMs). Data clump definitionA data clump exists if
I believe these refactoring can contribute to the project by reducing complexity and enhancing readability of your source code. Pursuant to the EU AI Act, I fully disclose the use of LLMs in generating these refactorings, emphasizing that all changes have undergone human review for quality assurance. Even if you decide not to integrate my changes to your codebase (which is perfectly fine), I ask you to fill out a feedback survey, which will be scientifically evaluated to determine the acceptance of AI-supported refactorings. You can find the feedback survey under https://campus.lamapoll.de/Data-clump-refactoring/en Thank you for considering my contribution. I look forward to your feedback. If you have any other questions or comments, feel free to write a comment, or email me under [email protected] . Best regards, I hereby agree to the terms of the JUnit Contributor License Agreement. Definition of Done
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mpkorstanje
reviewed
|
|
|
||
| assertEquals(1, RethrowExceptionHandler.beforeAllCalls, "Exception should handled in @BeforeAll"); | ||
| assertEquals(1, RethrowExceptionHandler.afterAllCalls, "Exception should handled in @AfterAll"); | ||
| assertEquals(1, RethrowExceptionHandler.callCounter.getBeforeAllCalls(), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
With the introduction of the HandlerCallCounter there is no need to store the counts as a field in the handler. You could now declare a HandlerCallCounter rethrowCounter as a static field on LifecycleMethodExecutionExceptionHandlerTests and reference that everywhere. I.e.
assertEquals(1, rethrowCounter.getBeforeAllCalls(), "Exception should handled in @BeforeAll");
With some thoughtfully chosen method and field names this would reduce the verbosity of the code a bit and keep the whole assertion on a single line.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| public void incrementBeforeAllCalls() { | ||
| beforeAllCalls++; | ||
| } | ||
|
|
||
| public void incrementBeforeEachCalls() { | ||
| beforeEachCalls++; | ||
| } | ||
|
|
||
| public void incrementAfterEachCalls() { | ||
| afterEachCalls++; | ||
| } | ||
|
|
||
| public void incrementAfterAllCalls() { | ||
| afterAllCalls++; | ||
| } | ||
|
|
||
| public int getBeforeAllCalls() { | ||
| return beforeAllCalls; | ||
| } | ||
|
|
||
| public int getBeforeEachCalls() { | ||
| return beforeEachCalls; | ||
| } | ||
|
|
||
| public int getAfterEachCalls() { | ||
| return afterEachCalls; | ||
| } | ||
|
|
||
| public int getAfterAllCalls() { | ||
| return afterAllCalls; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Since this class is only a local test helper, I don't think we need to encapsulate the fields. Therefore, I think these methods should be inlined.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thank you very much for the feedback. @marcphilipp I have just applied the suggested changes. @mpkorstanje While I like your reasoning, I think this should be part of a larger redesign of the test classes. I haven't implement your proposal for now but I would be happy to do so if others concur |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
eb0cf99 to
3f75c2f
Compare
|
@compf Thanks! 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.