defects4j icon indicating copy to clipboard operation
defects4j copied to clipboard

`test` does not run successfully on Mockito bugs

Open jose opened this issue 2 years ago • 2 comments

I am either doing something wrong or Mockito is broken. The Defects4j's test command does not seem to be working properly.


"The class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found"

Environment

#
# Box
#

$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	Scientific
Description:	Scientific Linux release 7.9 (Nitrogen)
Release:	7.9
Codename:	Nitrogen

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

#
# Git
#

$ git --version
git version 1.8.3.1

#
# Perl
#

$ perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi

#
# Java
#

$ echo "$JAVA_HOME"
/homes/jcmc/bin/jdk8u292-b10

$ java -version
Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)

$ javac -version
Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
javac 1.8.0_292

Step-by-step

$ ~/defects4j/framework/bin/defects4j checkout -p "Mockito" -v "1b" -w "/tmp/Mockito-1b"
Checking out 4e9d7607 to /tmp/Mockito-1b................................... OK
Init local repository...................................................... OK
Tag post-fix revision...................................................... OK
Run post-checkout hook..................................................... OK
Excluding broken/flaky tests............................................... OK
Excluding broken/flaky tests............................................... OK
Excluding broken/flaky tests............................................... OK
Initialize fixed program version........................................... OK
Apply patch................................................................ OK
Initialize buggy program version........................................... OK
Diff 4e9d7607:837fd054..................................................... OK
Apply patch................................................................ OK
Tag pre-fix revision....................................................... OK
Check out program version: Mockito-1b...................................... OK

$ cd /tmp/Mockito-1b/
$ ~/defects4j/framework/bin/defects4j compile
Running ant (compile)...................................................... OK
Running ant (compile.tests)................................................ OK

$ ~/defects4j/framework/bin/defects4j test
Running ant (compile.tests)................................................ OK
Running ant (run.dev.tests)................................................ FAIL
Executed command:  cd /tmp/Mockito-1b && ant -f /homes/jcmc/defects4j/framework/projects/defects4j.build.xml -Dd4j.home=/homes/jcmc/defects4j -Dd4j.dir.projects=/homes/jcmc/defects4j/framework/projects -Dbasedir=/tmp/Mockito-1b -Dbuild.compiler=javac1.7 -DOUTFILE=/tmp/Mockito-1b/failing_tests  run.dev.tests 2>&1
Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
Buildfile: /homes/jcmc/defects4j/framework/projects/defects4j.build.xml

compile:

gradle.compile:
     [exec] Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
     [exec] Parallel execution is an incubating feature.
     [exec] :buildSrc:compileJava UP-TO-DATE
     [exec] :buildSrc:compileGroovy UP-TO-DATE
     [exec] :buildSrc:processResources UP-TO-DATE
     [exec] :buildSrc:classes UP-TO-DATE
     [exec] :buildSrc:jar UP-TO-DATE
     [exec] :buildSrc:assemble UP-TO-DATE
     [exec] :buildSrc:compileTestJava UP-TO-DATE
     [exec] :buildSrc:compileTestGroovy UP-TO-DATE
     [exec] :buildSrc:processTestResources UP-TO-DATE
     [exec] :buildSrc:testClasses UP-TO-DATE
     [exec] :buildSrc:test UP-TO-DATE
     [exec] :buildSrc:check UP-TO-DATE
     [exec] :buildSrc:build UP-TO-DATE
     [exec] POM relocation to an other version number is not fully supported in Gradle : xml-apis#xml-apis;2.0.2 relocated to xml-apis#xml-apis;1.0.b2.
     [exec] Please update your dependency to directly use the correct version 'xml-apis#xml-apis;1.0.b2'.
     [exec] Resolution will only pick dependencies of the relocated element.  Artifacts and other metadata will be ignored.
     [exec] Version: 2.0.12-beta
     [exec] :compileJava
     [exec] :testng:processResources
     [exec] :extTest:compileJava UP-TO-DATE
     [exec] :testng:processResources UP-TO-DATE
     [exec] :extTest:processResources UP-TO-DATE
     [exec] :extTest:classes UP-TO-DATE
     [exec] :compileJava UP-TO-DATE
     [exec] :processResources UP-TO-DATE
     [exec] :classes UP-TO-DATE
     [exec] :jar UP-TO-DATE
     [exec] :testng:compileJava UP-TO-DATE
     [exec] :testng:classes UP-TO-DATE
     [exec]
     [exec] BUILD SUCCESSFUL
     [exec]
     [exec] Total time: 7.046 secs
     [exec] Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
     [exec] No Gradle daemons are running.

ant.compile:

gradle.compile.mutants:

ant.compile.mutants:
     [exec] Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
     [exec] POM relocation to an other version number is not fully supported in Gradle : xml-apis#xml-apis;2.0.2 relocated to xml-apis#xml-apis;1.0.b2.

compile.tests:

gradle.compile.tests:
     [exec] Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
     [exec] Parallel execution is an incubating feature.
     [exec] :buildSrc:compileJava UP-TO-DATE
     [exec] :buildSrc:compileGroovy UP-TO-DATE
     [exec] :buildSrc:processResources UP-TO-DATE
     [exec] :buildSrc:classes UP-TO-DATE
     [exec] :buildSrc:jar UP-TO-DATE
     [exec] :buildSrc:assemble UP-TO-DATE
     [exec] :buildSrc:compileTestJava UP-TO-DATE
     [exec] :buildSrc:compileTestGroovy UP-TO-DATE
     [exec] :buildSrc:processTestResources UP-TO-DATE
     [exec] :buildSrc:testClasses UP-TO-DATE
     [exec] :buildSrc:test UP-TO-DATE
     [exec] :buildSrc:check UP-TO-DATE
     [exec] :buildSrc:build UP-TO-DATE
     [exec] POM relocation to an other version number is not fully supported in Gradle : xml-apis#xml-apis;2.0.2 relocated to xml-apis#xml-apis;1.0.b2.
     [exec] Please update your dependency to directly use the correct version 'xml-apis#xml-apis;1.0.b2'.
     [exec] Resolution will only pick dependencies of the relocated element.  Artifacts and other metadata will be ignored.
     [exec] Version: 2.0.12-beta
     [exec] :compileJava
     [exec] :testng:processResources
     [exec] :extTest:compileJava UP-TO-DATE
     [exec] :testng:processResources UP-TO-DATE
     [exec] :extTest:processResources
     [exec] :testng:processTestResources UP-TO-DATE
     [exec] :extTest:classes UP-TO-DATE
     [exec] :extTest:processTestResources UP-TO-DATE
     [exec] :extTest:processResources UP-TO-DATE
     [exec] :compileJava UP-TO-DATE
     [exec] :processResources UP-TO-DATE
     [exec] :classes UP-TO-DATE
     [exec] :compileTestJava UP-TO-DATE
     [exec] :processTestResources UP-TO-DATE
     [exec] :testClasses UP-TO-DATE
     [exec] :jar UP-TO-DATE
     [exec] :extTest:compileTestJava
     [exec] :testng:compileJava UP-TO-DATE
     [exec] :testng:classes UP-TO-DATE
     [exec] :testng:compileTestJava UP-TO-DATE
     [exec] :testng:testClasses UP-TO-DATE
     [exec] :extTest:compileTestJava UP-TO-DATE
     [exec] :extTest:testClasses UP-TO-DATE
     [exec]
     [exec] BUILD SUCCESSFUL
     [exec]
     [exec] Total time: 7.117 secs
     [exec] Picked up _JAVA_OPTIONS: -Xmx4096M -XX:MaxHeapSize=2048M
     [exec] No Gradle daemons are running.

ant.compile.tests:

update.all.tests:

run.dev.tests:

BUILD FAILED
/homes/jcmc/defects4j/framework/projects/defects4j.build.xml:107: Problem: failed to create task or type junit
Cause: the class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant/lib
        -/homes/jcmc/.ant/lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem


Total time: 25 seconds
Cannot run tests! at /homes/jcmc/defects4j/framework/bin/d4j/d4j-test line 135.
Compilation failed in require at /homes/jcmc/defects4j/framework/bin/defects4j line 195.

"java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache"

Environment

#
# Box
#

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

#
# Git
#

$ git --version
git version 2.25.1

#
# Perl
#

$ perl -v
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-gnu-thread-multi

#
# Java
#

$ echo "$JAVA_HOME"
/home/jcmcampos/bin/jdk8u292-b10

$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)

$ javac -version
javac 1.8.0_292

Step-by-step

$ ~/defects4j/framework/bin/defects4j checkout -p "Mockito" -v "1b" -w "/tmp/Mockito-1b"
Checking out 4e9d7607 to /tmp/Mockito-1b................................... OK
Init local repository...................................................... OK
Tag post-fix revision...................................................... OK
Run post-checkout hook..................................................... OK
Excluding broken/flaky tests............................................... OK
Excluding broken/flaky tests............................................... OK
Excluding broken/flaky tests............................................... OK
Initialize fixed program version........................................... OK
Apply patch................................................................ OK
Initialize buggy program version........................................... OK
Diff 4e9d7607:837fd054..................................................... OK
Apply patch................................................................ OK
Tag pre-fix revision....................................................... OK
Check out program version: Mockito-1b...................................... OK

$ cd /tmp/Mockito-1b/
$ ~/defects4j/framework/bin/defects4j compile
Running ant (compile)...................................................... OK
Running ant (compile.tests)................................................ OK

$ ~/defects4j/framework/bin/defects4j test
Failing tests: 278
  - org.concurrentmockito.ThreadVerifiesContinuoslyInteractingMockTest
  - org.concurrentmockito.ThreadsRunAllTestsHalfManualTest
  - org.concurrentmockito.ThreadsShareAMockTest
  - org.concurrentmockito.ThreadsShareGenerouslyStubbedMockTest
  - org.concurrentmockito.ThreadsStubSharedMockTest
  - org.concurrentmockito.VerificationInOrderFromMultipleThreadsTest
  - org.mockito.ArgumentCaptorTest
  - org.mockito.MockingDetailsTest
  - org.mockito.MockitoTest
  - org.mockito.exceptions.ReporterTest
  - org.mockito.exceptions.base.MockitoAssertionErrorTest
  - org.mockito.exceptions.base.MockitoExceptionTest
  - org.mockito.internal.AllInvocationsFinderTest
  - org.mockito.internal.InOrderImplTest
  - org.mockito.internal.InvalidStateDetectionTest
  - org.mockito.internal.configuration.ClassPathLoaderTest
  - org.mockito.internal.configuration.MockInjectionTest
  - org.mockito.internal.configuration.injection.ConstructorInjectionTest
  - org.mockito.internal.configuration.injection.SimpleArgumentResolverTest
  - org.mockito.internal.configuration.plugins.PluginFileReaderTest
  - org.mockito.internal.configuration.plugins.PluginFinderTest
  - org.mockito.internal.creation.DelegatingMethodTest
  - org.mockito.internal.creation.MockSettingsImplTest
  - org.mockito.internal.creation.bytebuddy.ByteBuddyMockMakerTest
  - org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGeneratorTest
  - org.mockito.internal.creation.instance.ConstructorInstantiatorTest
  - org.mockito.internal.debugging.LoggingListenerTest
  - org.mockito.internal.debugging.VerboseMockInvocationLoggerTest
  - org.mockito.internal.debugging.WarningsFinderTest
  - org.mockito.internal.debugging.WarningsPrinterImplTest
  - org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilterTest
  - org.mockito.internal.exceptions.stacktrace.StackTraceFilterTest
  - org.mockito.internal.exceptions.util.ScenarioPrinterTest
  - org.mockito.internal.handler.InvocationNotifierHandlerTest
  - org.mockito.internal.handler.MockHandlerFactoryTest
  - org.mockito.internal.handler.MockHandlerImplTest
  - org.mockito.internal.invocation.ArgumentsComparatorTest
  - org.mockito.internal.invocation.InvocationImplTest
  - org.mockito.internal.invocation.InvocationMarkerTest
  - org.mockito.internal.invocation.InvocationMatcherTest
  - org.mockito.internal.invocation.InvocationsFinderTest
  - org.mockito.internal.invocation.SerializableMethodTest
  - org.mockito.internal.junit.JUnitRuleTest
  - org.mockito.internal.matchers.CapturingMatcherTest
  - org.mockito.internal.matchers.ComparableMatchersTest
  - org.mockito.internal.matchers.EqualityTest
  - org.mockito.internal.matchers.EqualsTest
  - org.mockito.internal.matchers.LocalizedMatcherTest
  - org.mockito.internal.matchers.MatchersPrinterTest
  - org.mockito.internal.matchers.MatchersToStringTest
  - org.mockito.internal.matchers.VarargCapturingMatcherTest
  - org.mockito.internal.matchers.apachecommons.EqualsBuilderTest
  - org.mockito.internal.progress.AtLeastTest
  - org.mockito.internal.progress.HandyReturnValuesTest
  - org.mockito.internal.progress.MockingProgressImplTest
  - org.mockito.internal.progress.ThreadSafeMockingProgressTest
  - org.mockito.internal.progress.TimesTest
  - org.mockito.internal.reporting.PluralizerTest
  - org.mockito.internal.runners.RunnerFactoryTest
  - org.mockito.internal.runners.util.RunnerProviderTest
  - org.mockito.internal.runners.util.TestMethodsFinderTest
  - org.mockito.internal.stubbing.InvocationContainerImplStubbingTest
  - org.mockito.internal.stubbing.InvocationContainerImplTest
  - org.mockito.internal.stubbing.answers.AnswersValidatorTest
  - org.mockito.internal.stubbing.answers.MethodInfoTest
  - org.mockito.internal.stubbing.answers.ReturnsArgumentAtTest
  - org.mockito.internal.stubbing.defaultanswers.ReturnsEmptyValuesTest
  - org.mockito.internal.stubbing.defaultanswers.ReturnsGenericDeepStubsTest
  - org.mockito.internal.stubbing.defaultanswers.ReturnsMocksTest
  - org.mockito.internal.stubbing.defaultanswers.ReturnsMoreEmptyValuesTest
  - org.mockito.internal.stubbing.defaultanswers.ReturnsSmartNullsTest
  - org.mockito.internal.util.DecamelizerTest
  - org.mockito.internal.util.MockCreationValidatorTest
  - org.mockito.internal.util.MockNameImplTest
  - org.mockito.internal.util.MockUtilTest
  - org.mockito.internal.util.ObjectMethodsGuruTest
  - org.mockito.internal.util.SimpleMockitoLoggerTest
  - org.mockito.internal.util.TimerTest
  - org.mockito.internal.util.collections.HashCodeAndEqualsSafeSetTest
  - org.mockito.internal.util.collections.IdentitySetTest
  - org.mockito.internal.util.collections.ListUtilTest
  - org.mockito.internal.util.io.IOUtilTest
  - org.mockito.internal.util.junit.JUnitFailureHackerTest
  - org.mockito.internal.util.reflection.AccessibilityChangerTest
  - org.mockito.internal.util.reflection.BeanPropertySetterTest
  - org.mockito.internal.util.reflection.FieldInitializerTest
  - org.mockito.internal.util.reflection.FieldReaderTest
  - org.mockito.internal.util.reflection.FieldsTest
  - org.mockito.internal.util.reflection.GenericMasterTest
  - org.mockito.internal.util.reflection.GenericMetadataSupportTest
  - org.mockito.internal.util.reflection.LenientCopyToolTest
  - org.mockito.internal.util.reflection.ParameterizedConstructorInstantiatorTest
  - org.mockito.internal.util.reflection.SuperTypesLastSorterTest
  - org.mockito.internal.util.reflection.WhiteboxTest
  - org.mockito.internal.verification.DefaultRegisteredInvocationsTest
  - org.mockito.internal.verification.NoMoreInteractionsTest
  - org.mockito.internal.verification.OnlyTest
  - org.mockito.internal.verification.SmartPrinterTest
  - org.mockito.internal.verification.VerificationDataImplTest
  - org.mockito.internal.verification.VerificationOverTimeImplTest
  - org.mockito.internal.verification.argumentmatching.ArgumentMatchingToolTest
  - org.mockito.internal.verification.checkers.AtLeastXNumberOfInvocationsCheckerTest
  - org.mockito.internal.verification.checkers.MissingInvocationCheckerTest
  - org.mockito.internal.verification.checkers.MissingInvocationInOrderCheckerTest
  - org.mockito.internal.verification.checkers.NumberOfInvocationsCheckerTest
  - org.mockito.internal.verification.checkers.NumberOfInvocationsInOrderCheckerTest
  - org.mockito.runners.ConsoleSpammingMockitoJUnitRunnerTest
  - org.mockito.runners.RunnersValidateFrameworkUsageTest$DummyTest
  - org.mockito.runners.RunnersValidateFrameworkUsageTest
  - org.mockito.verification.NegativeDurationTest
  - org.mockito.verification.TimeoutTest
  - org.mockitointegration.NoJUnitDependenciesTest
  - org.mockitousage.PlaygroundTest
  - org.mockitousage.PlaygroundWithDemoOfUnclonedParametersProblemTest
  - org.mockitousage.annotation.AnnotationsTest
  - org.mockitousage.annotation.CaptorAnnotationBasicTest
  - org.mockitousage.annotation.CaptorAnnotationTest
  - org.mockitousage.annotation.CaptorAnnotationUnhappyPathTest
  - org.mockitousage.annotation.DeprecatedAnnotationEngineApiTest
  - org.mockitousage.annotation.DeprecatedMockAnnotationTest
  - org.mockitousage.annotation.InjectionOfInlinedMockDeclarationTest
  - org.mockitousage.annotation.MockInjectionUsingConstructorIssue421Test
  - org.mockitousage.annotation.MockInjectionUsingConstructorTest$ATest
  - org.mockitousage.annotation.MockInjectionUsingConstructorTest
  - org.mockitousage.annotation.MockInjectionUsingSetterOrPropertyTest
  - org.mockitousage.annotation.SpyAnnotationInitializedInBaseClassTest$SubTest
  - org.mockitousage.annotation.SpyAnnotationInitializedInBaseClassTest
  - org.mockitousage.annotation.SpyAnnotationTest
  - org.mockitousage.annotation.SpyInjectionTest
  - org.mockitousage.annotation.WrongSetOfAnnotationsTest
  - org.mockitousage.basicapi.MockAccessTest
  - org.mockitousage.basicapi.MockingDetailsTest
  - org.mockitousage.basicapi.MockingMultipleInterfacesTest
  - org.mockitousage.basicapi.MocksCreationTest
  - org.mockitousage.basicapi.MocksSerializationForAnnotationTest
  - org.mockitousage.basicapi.MocksSerializationTest
  - org.mockitousage.basicapi.ObjectsSerializationTest
  - org.mockitousage.basicapi.ReplacingObjectMethodsTest
  - org.mockitousage.basicapi.ResetTest
  - org.mockitousage.basicapi.UsingVarargsTest
  - org.mockitousage.bugs.AIOOBExceptionWithAtLeastTest
  - org.mockitousage.bugs.ActualInvocationHasNullArgumentNPEBugTest
  - org.mockitousage.bugs.BridgeMethodsHitAgainTest
  - org.mockitousage.bugs.CaptorAnnotationAutoboxingTest
  - org.mockitousage.bugs.ChildWithSameParentFieldInjectionTest
  - org.mockitousage.bugs.ClassCastExOnVerifyZeroInteractionsTest
  - org.mockitousage.bugs.ConcurrentModificationExceptionOnMultiThreadedVerificationTest
  - org.mockitousage.bugs.CovariantOverrideTest
  - org.mockitousage.bugs.DeepStubsWronglyReportsSerializationProblemsTest
  - org.mockitousage.bugs.EqualsWithDeltaTest
  - org.mockitousage.bugs.FinalHashCodeAndEqualsRaiseNPEInInitMocksTest
  - org.mockitousage.bugs.IOOBExceptionShouldNotBeThrownWhenNotCodingFluentlyTest
  - org.mockitousage.bugs.InheritedGenericsPolimorphicCallTest
  - org.mockitousage.bugs.InjectMocksShouldTryPropertySettersFirstBeforeFieldAccessTest
  - org.mockitousage.bugs.InjectionByTypeShouldFirstLookForExactTypeThenAncestorTest
  - org.mockitousage.bugs.Issue353InjectionMightNotHappenInCertainConfigurationTest
  - org.mockitousage.bugs.ListenersLostOnResetMockTest
  - org.mockitousage.bugs.MockitoRunnerBreaksWhenNoTestMethodsTest
  - org.mockitousage.bugs.MultipleInOrdersTest
  - org.mockitousage.bugs.MultithreadedStubbingHalfManualTest
  - org.mockitousage.bugs.NPEOnAnyClassMatcherAutounboxTest
  - org.mockitousage.bugs.NPEWhenMockingThrowablesTest
  - org.mockitousage.bugs.NPEWithCertainMatchersTest
  - org.mockitousage.bugs.ParentClassNotPublicTest
  - org.mockitousage.bugs.ParentTestMockInjectionTest$BaseTest
  - org.mockitousage.bugs.ParentTestMockInjectionTest$ImplicitTest
  - org.mockitousage.bugs.ParentTestMockInjectionTest
  - org.mockitousage.bugs.ShouldAllowInlineMockCreationTest
  - org.mockitousage.bugs.ShouldMocksCompareToBeConsistentWithEqualsTest
  - org.mockitousage.bugs.ShouldNotDeadlockAnswerExecutionTest
  - org.mockitousage.bugs.ShouldNotTryToInjectInFinalOrStaticFieldsTest
  - org.mockitousage.bugs.ShouldOnlyModeAllowCapturingArgumentsTest
  - org.mockitousage.bugs.SpyShouldHaveNiceNameTest
  - org.mockitousage.bugs.StubbingMocksThatAreConfiguredToReturnMocksTest
  - org.mockitousage.bugs.TimeoutWithAtMostOrNeverShouldBeDisabledTest
  - org.mockitousage.bugs.VarargsErrorWhenCallingRealMethodTest
  - org.mockitousage.bugs.VerifyingWithAnExtraCallToADifferentMockTest
  - org.mockitousage.bugs.deepstubs.DeepStubFailingWhenGenericNestedAsRawTypeTest
  - org.mockitousage.bugs.varargs.VarargsAndAnyObjectPicksUpExtraInvocationsTest
  - org.mockitousage.bugs.varargs.VarargsNotPlayingWithAnyObjectTest
  - org.mockitousage.configuration.ClassCacheVersusClassReloadingTest
  - org.mockitousage.configuration.CustomizedAnnotationForSmartMockTest
  - org.mockitousage.constructor.CreatingMocksWithConstructorTest
  - org.mockitousage.customization.BDDMockitoTest
  - org.mockitousage.debugging.InvocationListenerCallbackTest
  - org.mockitousage.debugging.PrintingInvocationsDetectsUnusedStubTest
  - org.mockitousage.debugging.PrintingInvocationsWhenEverythingOkTest
  - org.mockitousage.debugging.PrintingInvocationsWhenStubNotUsedTest
  - org.mockitousage.debugging.VerboseLoggingOfInvocationsOnMockTest
  - org.mockitousage.examples.use.ExampleTest
  - org.mockitousage.internal.debugging.LocationImplTest
  - org.mockitousage.internal.invocation.realmethod.CleanTraceRealMethodTest
  - org.mockitousage.junitrule.InvalidTargetMockitoJUnitRuleTest
  - org.mockitousage.junitrule.MockitoJUnitRuleTest
  - org.mockitousage.junitrule.RuleTestWithFactoryMethodTest
  - org.mockitousage.junitrule.RuleTestWithParameterConstructorTest
  - org.mockitousage.junitrunner.JUnit44RunnerTest
  - org.mockitousage.junitrunner.JUnit45RunnerTest
  - org.mockitousage.junitrunner.ModellingVerboseMockitoTest
  - org.mockitousage.junitrunner.VerboseMockitoRunnerTest
  - org.mockitousage.matchers.AnyXMatchersAcceptNullsTest
  - org.mockitousage.matchers.CapturingArgumentsTest
  - org.mockitousage.matchers.CustomMatcherDoesYieldCCETest
  - org.mockitousage.matchers.CustomMatchersTest
  - org.mockitousage.matchers.GenericMatchersTest
  - org.mockitousage.matchers.HamcrestMatchersTest
  - org.mockitousage.matchers.InvalidUseOfMatchersTest
  - org.mockitousage.matchers.MatchersMixedWithRawArgumentsTest
  - org.mockitousage.matchers.MatchersTest
  - org.mockitousage.matchers.MoreMatchersTest
  - org.mockitousage.matchers.NewMatchersTest
  - org.mockitousage.matchers.ReflectionMatchersTest
  - org.mockitousage.matchers.VerificationAndStubbingUsingMatchersTest
  - org.mockitousage.misuse.CleaningUpPotentialStubbingTest
  - org.mockitousage.misuse.DescriptiveMessagesOnMisuseTest
  - org.mockitousage.misuse.DetectingFinalMethodsTest
  - org.mockitousage.misuse.DetectingMisusedMatchersTest
  - org.mockitousage.misuse.ExplicitFrameworkValidationTest
  - org.mockitousage.misuse.InvalidUsageTest
  - org.mockitousage.misuse.RestrictedObjectMethodsTest
  - org.mockitousage.misuse.SpyStubbingMisuseTest
  - org.mockitousage.packageprotected.MockingPackageProtectedTest
  - org.mockitousage.performance.LoadsOfMocksTest
  - org.mockitousage.performance.StubOnlyAvoidMemoryConsumptionTest
  - org.mockitousage.puzzlers.BridgeMethodPuzzleTest
  - org.mockitousage.puzzlers.OverloadingPuzzleTest
  - org.mockitousage.serialization.AcrossClassLoaderSerializationTest
  - org.mockitousage.serialization.DeepStubsSerializableTest
  - org.mockitousage.serialization.ParallelSerializationTest
  - org.mockitousage.spies.PartialMockingWithSpiesTest
  - org.mockitousage.spies.SpyingOnInterfacesTest
  - org.mockitousage.spies.SpyingOnRealObjectsTest
  - org.mockitousage.spies.StubbingSpiesDoesNotYieldNPETest
  - org.mockitousage.stacktrace.ClickableStackTracesTest
  - org.mockitousage.stacktrace.ClickableStackTracesWhenFrameworkMisusedTest
  - org.mockitousage.stacktrace.ModellingDescriptiveMessagesTest
  - org.mockitousage.stacktrace.PointingStackTraceToActualInvocationChunkInOrderTest
  - org.mockitousage.stacktrace.PointingStackTraceToActualInvocationInOrderTest
  - org.mockitousage.stacktrace.PointingStackTraceToActualInvocationTest
  - org.mockitousage.stacktrace.StackTraceFilteringTest
  - org.mockitousage.stubbing.BasicStubbingTest
  - org.mockitousage.stubbing.CallingRealMethodTest
  - org.mockitousage.stubbing.CloningParameterTest
  - org.mockitousage.stubbing.DeepStubbingTest
  - org.mockitousage.stubbing.DeprecatedStubbingTest
  - org.mockitousage.stubbing.ReturningDefaultValuesTest
  - org.mockitousage.stubbing.SmartNullsStubbingTest
  - org.mockitousage.stubbing.StubbingConsecutiveAnswersTest
  - org.mockitousage.stubbing.StubbingUsingDoReturnTest
  - org.mockitousage.stubbing.StubbingWithCustomAnswerTest
  - org.mockitousage.stubbing.StubbingWithDelegateTest
  - org.mockitousage.stubbing.StubbingWithExtraAnswersTest
  - org.mockitousage.stubbing.StubbingWithThrowablesTest
  - org.mockitousage.verification.AtLeastXVerificationTest
  - org.mockitousage.verification.AtMostXVerificationTest
  - org.mockitousage.verification.BasicVerificationInOrderTest
  - org.mockitousage.verification.BasicVerificationTest
  - org.mockitousage.verification.DescriptiveMessagesOnVerificationInOrderErrorsTest
  - org.mockitousage.verification.DescriptiveMessagesWhenTimesXVerificationFailsTest
  - org.mockitousage.verification.DescriptiveMessagesWhenVerificationFailsTest
  - org.mockitousage.verification.ExactNumberOfTimesVerificationTest
  - org.mockitousage.verification.FindingRedundantInvocationsInOrderTest
  - org.mockitousage.verification.NoMoreInteractionsVerificationTest
  - org.mockitousage.verification.OnlyVerificationTest
  - org.mockitousage.verification.OrdinaryVerificationPrintsAllInteractionsTest
  - org.mockitousage.verification.PrintingVerboseTypesWithArgumentsTest
  - org.mockitousage.verification.RelaxedVerificationInOrderTest
  - org.mockitousage.verification.SelectedMocksInOrderVerificationTest
  - org.mockitousage.verification.VerificationAfterDelayTest
  - org.mockitousage.verification.VerificationExcludingStubsTest
  - org.mockitousage.verification.VerificationInOrderMixedWithOrdiraryVerificationTest
  - org.mockitousage.verification.VerificationInOrderTest
  - org.mockitousage.verification.VerificationInOrderWithCallsTest
  - org.mockitousage.verification.VerificationOnMultipleMocksUsingMatchersTest
  - org.mockitousage.verification.VerificationUsingMatchersTest
  - org.mockitousage.verification.VerificationWithTimeoutTest
  - org.mockitoutil.ClassLoadersTest
  - org.mockitoutil.CustomAssertionsTest

$ head failing_tests
--- org.concurrentmockito.ThreadVerifiesContinuoslyInteractingMockTest
java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)

$ ~/defects4j/framework/bin/defects4j export -p cp.test
Running ant (export.cp.test)............................................... OK
/home/jcmcampos/defects4j/framework/projects/lib/junit-4.11.jar:/tmp/Mockito-1b/build/classes/main:/tmp/Mockito-1b/build/classes/test:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/asm-all-5.0.4.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/assertj-core-2.1.0.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/cglib-and-asm-1.0.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/cobertura-2.0.3.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/fest-assert-1.3.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/fest-util-1.1.4.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/hamcrest-all-1.3.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/hamcrest-core-1.1.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/objenesis-2.1.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/objenesis-2.2.jar:/home/jcmcampos/defects4j/framework/projects/Mockito/lib/powermock-reflect-1.2.5.jar:/tmp/Mockito-1b/compileLib/byte-buddy-0.6.8.jar

The /home/jcmcampos/defects4j/framework/projects/lib/junit-4.11.jar exists and includes the missing class (i.e., junit/framework/JUnit4TestAdapterCache). Any chance the test command is not including that jar file in the classpath?

jose avatar Feb 16 '22 16:02 jose

Well, it seems the problems were due to Ant.

  • I got the The class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found error with Ant v1.9.4 (November 5 2018).
  • I got the java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache error with Ant v1.10.7 (October 24 2019).

I've just updated Ant to its latest version (i.e., 1.10.12) on both machines, re-run both step-by-steps, and the test command does now work as expected. I wonder why/how the test command works (with either Ant v1.9.4, v1.10.7, or v1.10.12) on all projects/bugs but Mockito...

@rjust, should we add Apache Ant >= 1.10.12 to the requirements section?

jose avatar Feb 16 '22 16:02 jose

Hi @jose,

While D4J ships its own version of Ant (as part of the Major mutation framework), a system installation will take precedence. This is something we changed for version 2.0.0 to give users more flexibility in configuring Ant.

It looks like both of your previous Ant installations were missing JUnit on its boot classpath. Perhaps we should check whether Ant is installed/configured correctly and if it is not issue an error or use Major's version of Ant instead.

I'll try to reproduce this, just to make sure we aren't missing anything else.

rjust avatar Feb 27 '22 00:02 rjust