-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Issue #13809: Kill mutation in PackageObjectFactory #13924
Conversation
635061a
to
f8573f7
Compare
CI is timeouting during test execution, that is weird, please investigate. |
f8573f7
to
091da85
Compare
Rebased by GitHub |
I thought we mentioned this area before. This is another time saving area. If name provided has a period in it, then it is always a full class path. They will never be in I don't agree with the way the code was changed. |
This update not merge able for sure, CI can not pass. |
@Kevin222004 @Test
public void testCreateObjectWithNameContainingPackageSeparator() throws Exception {
final ClassLoader classLoader = ClassLoader.getSystemClassLoader();
final Set<String> packages = Collections.singleton(BASE_PACKAGE);
final PackageObjectFactory objectFactory =
new PackageObjectFactory(packages, classLoader, TRY_IN_ALL_REGISTERED_PACKAGES);
try (MockedStatic<ModuleReflectionUtil> utilities =
mockStatic(ModuleReflectionUtil.class)) {
utilities.when(() -> ModuleReflectionUtil.getCheckstyleModules(packages, classLoader))
.thenThrow(new IllegalStateException("mock exception"));
final Object object = objectFactory.createModule(MockClass.class.getName());
assertWithMessage("Object should be an instance of MockClass")
.that(object)
.isInstanceOf(MockClass.class);
}
} When this test is executed, |
thenThrow(new IllegalStateException("creation of objects by fully qualified names Shou not call for search of modules in classpath")) And we need to add comment above test method to explain why we need this test. |
091da85
to
fbbe29b
Compare
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.
Items
src/test/java/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java
Outdated
Show resolved
Hide resolved
fbbe29b
to
8a647a0
Compare
8a647a0
to
1796b15
Compare
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 updated wording a bit.
ok to merge if CI is green.
1796b15
to
417b748
Compare
417b748
to
171c0d1
Compare
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.
lgtm
Issue #13809: Kill mutation in PackageObjectFactory
Explaination
if the string contains packageSeparator then the instance will be null. Probably no test case is possible.