Issue #13809: Kill mutation in PackageObjectFactory#13924
Issue #13809: Kill mutation in PackageObjectFactory#13924romani merged 1 commit intocheckstyle:masterfrom
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
src/test/java/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java
Outdated
Show resolved
Hide resolved
fbbe29b to
8a647a0
Compare
8a647a0 to
1796b15
Compare
romani
left a comment
There was a problem hiding this comment.
I updated wording a bit.
ok to merge if CI is green.
1796b15 to
417b748
Compare
417b748 to
171c0d1
Compare
Issue #13809: Kill mutation in PackageObjectFactory
Explaination
if the string contains packageSeparator then the instance will be null. Probably no test case is possible.