Skip to content
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

extract test classes and improve test coverage #118

Merged
merged 3 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public class MYCleanUpConstants {
*
*/
public static final String JUNIT_CLEANUP_4_EXTERNALRESOURCE= "cleanup.junitcleanup_4_externalresource"; //$NON-NLS-1$
/**
*
*/
public static final String JUNIT_CLEANUP_4_RULEEXTERNALRESOURCE= "cleanup.junitcleanup_4_ruleexternalresource"; //$NON-NLS-1$
/**
*
*/
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public ICleanUpFix createFix(final CleanUpContext context) throws CoreException
return null;
}
Set<CompilationUnitRewriteOperationWithSourceRange> operations= new LinkedHashSet<>();
Set<ASTNode> nodesprocessed= new HashSet<>();
computeFixSet.forEach(i -> i.findOperations(compilationUnit, operations, nodesprocessed));
computeFixSet.forEach(i -> i.findOperations(compilationUnit, operations, new HashSet<ASTNode>()));
if (operations.isEmpty()) {
return null;
}
Expand Down Expand Up @@ -105,17 +104,20 @@ private EnumSet<JUnitCleanUpFixCore> computeFixSet() {
EnumSet<JUnitCleanUpFixCore> fixSet = isEnabled(JUNIT_CLEANUP)
? EnumSet.allOf(JUnitCleanUpFixCore.class)
: EnumSet.noneOf(JUnitCleanUpFixCore.class);
Map<String, JUnitCleanUpFixCore> cleanupMappings = Map.of(
MYCleanUpConstants.JUNIT_CLEANUP_4_ASSERT, JUnitCleanUpFixCore.ASSERT,
MYCleanUpConstants.JUNIT_CLEANUP_4_ASSUME, JUnitCleanUpFixCore.ASSUME,
MYCleanUpConstants.JUNIT_CLEANUP_4_AFTER, JUnitCleanUpFixCore.AFTER,
MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORE, JUnitCleanUpFixCore.BEFORE,
MYCleanUpConstants.JUNIT_CLEANUP_4_AFTERCLASS, JUnitCleanUpFixCore.AFTERCLASS,
MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORECLASS, JUnitCleanUpFixCore.BEFORECLASS,
MYCleanUpConstants.JUNIT_CLEANUP_4_TEST, JUnitCleanUpFixCore.TEST,
MYCleanUpConstants.JUNIT_CLEANUP_4_IGNORE, JUnitCleanUpFixCore.IGNORE,
MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER, JUnitCleanUpFixCore.RULETEMPORARYFOLDER,
MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME, JUnitCleanUpFixCore.RULETESTNAME
Map<String, JUnitCleanUpFixCore> cleanupMappings = Map.ofEntries(
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSERT, JUnitCleanUpFixCore.ASSERT),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_ASSUME, JUnitCleanUpFixCore.ASSUME),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTER, JUnitCleanUpFixCore.AFTER),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORE, JUnitCleanUpFixCore.BEFORE),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_AFTERCLASS, JUnitCleanUpFixCore.AFTERCLASS),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_BEFORECLASS, JUnitCleanUpFixCore.BEFORECLASS),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_TEST, JUnitCleanUpFixCore.TEST),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_IGNORE, JUnitCleanUpFixCore.IGNORE),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH, JUnitCleanUpFixCore.RULETEMPORARYFOLDER),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE, JUnitCleanUpFixCore.EXTERNALRESOURCE),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER, JUnitCleanUpFixCore.RUNWITH),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME, JUnitCleanUpFixCore.RULETESTNAME),
Map.entry(MYCleanUpConstants.JUNIT_CLEANUP_4_RULEEXTERNALRESOURCE, JUnitCleanUpFixCore.RULEEXTERNALRESOURCE)
);
cleanupMappings.forEach((config, fix) -> {
if (!isEnabled(config)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class CleanUpMessages {
public static String JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_AFTERCLASS;
public static String JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULETEMPORARYFOLDER;
public static String JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULETESTNAME;
public static String JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULEEXTERNALRESOURCE;
public static String JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_EXTERNALRESOURCE;
public static String JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RUNWITH;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_BEFORECLASS=BeforeClass
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_AFTERCLASS=AfterClass
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULETEMPORARYFOLDER=Rule TemporaryFolder
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULETESTNAME=Rule Testname
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULEEXTERNALRESOURCE=RuleExternalResource
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_EXTERNALRESOURCE=ExternalResource
JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RUNWITH=RunWith
JavaFeatureTabPage_GroupName_JUnit=JUnit
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void setDefaultOptions(CleanUpOptions options) {
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_TEST, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RULEEXTERNALRESOURCE, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH, CleanUpOptions.FALSE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
CleanUpMessages.JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_EXTERNALRESOURCE, MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE,
FALSE_TRUE);
intent(junitGroup);
final CheckboxPreference junit_ruleexternalresource= createCheckboxPref(junitGroup, numColumns-1,

Check warning

Code scanning / PMD

The local variable name 'vdf_initializer' doesn't match '[a-z][a-zA-Z0-9]*' Warning

The final local variable name 'junit_ruleexternalresource' doesn't match '[a-z][a-zA-Z0-9]*'
CleanUpMessages.JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RULEEXTERNALRESOURCE, MYCleanUpConstants.JUNIT_CLEANUP_4_RULEEXTERNALRESOURCE,
FALSE_TRUE);
intent(junitGroup);
final CheckboxPreference junit_runwith= createCheckboxPref(junitGroup, numColumns-1,
CleanUpMessages.JavaFeatureTabPage_CheckboxName_JUNIT_CLEANUP_RUNWITH, MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH,
FALSE_TRUE);
Expand All @@ -103,6 +107,7 @@
junit_afterclass,
junit_ruletempfolder,
junit_ruletestname,
junit_ruleexternalresource,
junit_externalresource,
junit_runwith});
intent(junitGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void setDefaultOptions(CleanUpOptions options) {
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_TEST, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETESTNAME, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RULETEMPORARYFOLDER, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RULEEXTERNALRESOURCE, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_EXTERNALRESOURCE, CleanUpOptions.FALSE);
options.setOption(MYCleanUpConstants.JUNIT_CLEANUP_4_RUNWITH, CleanUpOptions.FALSE);
}
Expand Down
Loading
Loading