Skip to content

Instantly share code, notes, and snippets.

@mockitoguy
Last active August 15, 2021 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mockitoguy/462a1bea005ce40e563d020e42f9d793 to your computer and use it in GitHub Desktop.
Save mockitoguy/462a1bea005ce40e563d020e42f9d793 to your computer and use it in GitHub Desktop.
build.sh failure
mockito-scala$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment Corretto-8.252.09.1 (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM Corretto-8.252.09.1 (build 25.252-b09, mixed mode)
mockito-scala$ ./build.sh
[info] Loading project definition from /Users/sfaber/mockito/mockito-scala/project
[info] Loading settings from build.sbt ...
[info] Set current project to root (in build file:/Users/sfaber/mockito/mockito-scala/)
[success] Total time: 0 s, completed Aug 15, 2021 9:50:33 AM
[info] Updating ...
[info] Updating core...
[info] Done updating.
[info] Done updating.
[info] Compiling 20 Scala sources to /Users/sfaber/mockito/mockito-scala/core/target/scala-2.12/classes ...
[warn] there were two deprecation warnings (since 2.11.0); re-run with -deprecation for details
[warn] one warning found
[info] Done compiling.
[info] Compiling 16 Scala sources to /Users/sfaber/mockito/mockito-scala/core/target/scala-2.12/test-classes ...
[info] Done compiling.
[info] FunctionMatchersTest:
[info] function0[T]
[info] - should pass if return value matches
[info] - should fail
[info] MockitoSugarTest_212:
[info] mock[T]
[info] - should work with default arguments in traits
[info] - should work with by-name arguments and matchers (by-name arguments have to be the last ones when using matchers)
[info] - should work with by-name and Function0 arguments (by-name arguments have to be the last ones when using matchers)
[info] MockitoFixtureTest:
[info] MockitoFixture
[info] - should check the mocks were called with the right arguments
[info] - should work on tests with setup
[info] ArgCaptorTest:
[info] Captor
[info] - should capture a simple AnyRef argument
[info] - should capture a simple AnyVal argument
[info] - should capture a complex argument
[info] - should expose the captured value to use with custom matchers
[info] - should expose all the captured values to use with custom matchers
[info] ValCaptor
[info] - should work with value case classes
[info] - should work with value non-case classes
[info] MockitoSugar$Test:
[info] mock[T]
[info] - should create a valid mock
[info] - should create a mock with default answer
[info] - should create a mock with default answer from implicit scope
[info] - should create a mock with name
[info] ThatMatchersTest:
[info] argThat[T]
[info] - should work with AnyRef
[info] argThat[T]
[info] - should work with AnyVal
[info] primitiveThat[T]
[info] - should work with AnyVal
[info] DoSomethingTest:
[info] doCallRealMethod
[info] - should work as normal
[info] doAnswer
[info] - should work as normal
[info] doReturn(toBeReturned)
[info] - should not fail with overloading issues
[info] doReturn(toBeReturned, toBeReturnedNext)
[info] - should not fail with overloading issues
[info] doReturn(toBeReturned)
[info] - should work with AnyVals
[info] doReturn(toBeReturned, toBeReturnedNext)
[info] - should work with AnyVals
[info] doThrow
[info] - should work as normal
[info] doThrow[T]
[info] - should work as normal
[info] EqMatchersTest:
[info] eqToVal[T]
[info] - should work with value classes
[info] eqTo[T]
[info] - should work with AnyRef
[info] eqTo[T]
[info] - should work with AnyVal
[info] same[T]
[info] - should work with AnyRef
[info] isA[T]
[info] - should work with AnyRef
[info] isA[T]
[info] - should work with AnyVal
[info] refEq[T]
[info] - should work on scala types
[info] IdiomaticMockitoFixtureTest:
[info] MockitoFixture
[info] - should check the mocks were called with the right arguments
[info] - should work on tests with setup
[info] IdiomaticMockitoTest:
[info] StubbingOps
[info] - should stub a return value
[info] - should stub multiple return values
[info] - should stub a real call
[info] - should stub an exception to be thrown
[info] - should stub an exception instance to be thrown
[info] - should chain exception and value
[info] - should chain value and exception
[info] - should simplify stubbing an answer where we don't care about any param
[info] - should simplify answer API
[info] - should chain answers
[info] - should allow using less params than method on answer stubbing
[info] - should stub a mock inline that has default args
[info] - should stub a high order function
[info] - should stub a method that returns a function
[info] DoSomethingOps
[info] - should stub a spy that would fail if the real impl is called
[info] - should stub a spy with an answer
[info] - should stub a real call
[info] - should stub a failure
[info] VerificationOps
[info] - should check a mock was not used
[info] - should check a method was called
[info] - should check a method was the only one called
[info] - should check a method was never called
[info] - should check a method was called twice
[info] - should check a method was called at least twice
[info] - should check a method was called at most twice
[info] - should check a method was called more times than expected
[info] - should work with a captor
[info] - should check invocation order
[info] IdiomaticMatchers
[info] - should allow to write '*' instead of any
[info] MockitoScalaSessionTest:
[info] MockitoScalaSession
[info] - should check unused stubs
[info] - should check incorrect stubs
[info] - should check incorrect stubs after the expected one was called
[info] - should check SmartNull
[info] - should check incorrect stubs after the expected one was called on a final class
[info] - should check unexpected invocations
[info] - should not check unexpected invocations if the call was verified
[info] - should check incorrect stubs with default arguments
[info] - should work with default arguments
[info] - should work with default arguments when passing an argument
[info] - should work with default arguments when passing an argument but production code doesn't
[info] - should re-throw an exception produced by the test
[info] - should re-throw an real NPE produced by the test (an NPE not related to an un-stubbed mock call)
[info] - should don't check unexpected stubs for lenient mocks
[info] - should check unexpected stubs for lenient mocks
[info] - should don't check unexpected stubs in lenient setting
[info] - should check unexpected stubs in lenient setting
[info] - should don't check unused stubs for lenient mocks
[info] - should check unused stubs for not lenient mocks
[info] - should don't check unused stubs in lenient setting
[info] - should check unused stubs in not lenient setting
[info] - should work with nested deep stubs
[info] - should not fail if a final deep stub is called in a non stubbed method
[info] - should not fail if a nested deep stub is called in a non stubbed method
[info] - should fail if a nested deep stub is stubbed but not used
[info] AnyMatchersTest:
[info] any[Collection]
[info] - should work with Scala types
[info] any
[info] - should work with AnyRef
[info] anyVal
[info] - should work with a value class
[info] any
[info] - should work with AnyVal
[info] anyPrimitive
[info] - should work with AnyVal
[info] ResetMocksAfterEachTestTest:
[info] ResetMocksAfterEachTest
[info] - should have clean state for test 1
[info] - should have clean state for test 2
[info] DefaultAnswerTest:
[info] DefaultAnswer
[info] - should resolve default parameters
[info] DefaultAnswer.defaultAnswer
[info] - should call real method for default arguments
[info] - should return a smart null for unknown cases
[info] - should return a smart standard monad
[info] - should return a default value for primitives
[info] - should work for value classes
[info] ReturnsEmptyValues
[info] - should return a default value for primitives
[info] - should return the empty values for known classes
[info] MockitoSugarTest:
[info] mock[T]
[info] - should create a valid mock
[info] - should create a mock while stubbing another
[info] - should default answer should deal with default arguments
[info] - should create a mock with default answer
[info] - should create a mock with default answer from implicit scope
[info] - should create a mock with name
[info] - should work with inline mixins
[info] - should work with standard mixins
[info] - should work with by-name arguments (argument order doesn't matter when not using matchers)
[info] - should work with primitive by-name arguments
[info] - should work with Function0 arguments
[info] - should should stop the user passing traits in the settings
[info] reset[T]
[info] - should reset mocks
[info] verifyNoMoreInteractions
[info] - should ignore the calls to the methods that provide default arguments
[info] argumentCaptor[T]
[info] - should deal with default arguments
[info] spy[T]
[info] - should create a valid spy
[info] spyLambda[T]
[info] - should create a valid spy for lambdas and anonymous classes
[info] Run completed in 2 seconds, 169 milliseconds.
[info] Total number of tests run: 124
[info] Suites: completed 15, aborted 0
[info] Tests: succeeded 124, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 15 s, completed Aug 15, 2021 9:50:47 AM
[info] Defining Global / publishTo
[info] The new value will be used by core / otherResolvers, core / publishConfiguration and 3 others.
[info] Run `last` for details.
[info] Reapplying settings...
[info] Set current project to root (in build file:/Users/sfaber/mockito/mockito-scala/)
[info] Setting Scala version to 2.11.12 on 2 projects.
[info] Excluded 1 projects, run ++ 2.11.12 -v for more details.
[info] Reapplying settings...
[info] Set current project to root (in build file:/Users/sfaber/mockito/mockito-scala/)
[info] Packaging /Users/sfaber/mockito/mockito-scala/core/target/scala-2.11/mockito-scala_2.11-0.4.7-sources.jar ...
[info] Done packaging.
[info] Wrote /Users/sfaber/mockito/mockito-scala/core/target/scala-2.11/mockito-scala_2.11-0.4.7.pom
[info] Updating core...
[info] Done updating.
[info] Compiling 20 Scala sources to /Users/sfaber/mockito/mockito-scala/core/target/scala-2.11/classes ...
[info] Main Scala API documentation to /Users/sfaber/mockito/mockito-scala/core/target/scala-2.11/api...
[warn] there were two deprecation warnings; re-run with -deprecation for details
model contains 66 documentable templates
[warn] /Users/sfaber/mockito/mockito-scala/core/src/main/scala/org/mockito/MockitoAPI.scala:54:55: Variable 1 undefined in comment for method doReturn in trait MockitoFixture
[warn] * both method doReturn in class Mockito of type (x$1: Any, x$2: Object*)org.mockito.stubbing.Stubber
[warn] ^
[warn] /Users/sfaber/mockito/mockito-scala/core/src/main/scala/org/mockito/MockitoAPI.scala:54:65: Variable 2 undefined in comment for method doReturn in trait MockitoFixture
[warn] * both method doReturn in class Mockito of type (x$1: Any, x$2: Object*)org.mockito.stubbing.Stubber
[warn] ^
[warn] /Users/sfaber/mockito/mockito-scala/core/src/main/scala/org/mockito/MockitoAPI.scala:55:55: Variable 1 undefined in comment for method doReturn in trait MockitoFixture
[warn] * and method doReturn in class Mockito of type (x$1: Any)org.mockito.stubbing.Stubber
[warn] ^
[warn] four warnings found
[info] Main Scala API documentation successful.
[info] Packaging /Users/sfaber/mockito/mockito-scala/core/target/scala-2.11/mockito-scala_2.11-0.4.7-javadoc.jar ...
[info] Done packaging.
[warn] there were two deprecation warnings; re-run with -deprecation for details
[warn] one warning found
[info] Done compiling.
[info] Packaging /Users/sfaber/mockito/mockito-scala/core/target/scala-2.11/mockito-scala_2.11-0.4.7.jar ...
[error] java.util.zip.ZipException: duplicate entry: org/mockito/captor/Captor.class
[error] at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:232)
[error] at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
[error] at sbt.io.IO$.addFileEntry$1(IO.scala:550)
[error] at sbt.io.IO$.$anonfun$writeZip$3(IO.scala:559)
[error] at sbt.io.IO$.$anonfun$writeZip$3$adapted(IO.scala:559)
[error] at scala.collection.Iterator.foreach(Iterator.scala:944)
[error] at scala.collection.Iterator.foreach$(Iterator.scala:944)
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1432)
[error] at scala.collection.IterableLike.foreach(IterableLike.scala:71)
[error] at scala.collection.IterableLike.foreach$(IterableLike.scala:70)
[error] at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error] at sbt.io.IO$.writeZip(IO.scala:559)
[error] at sbt.io.IO$.$anonfun$archive$1(IO.scala:513)
[error] at sbt.io.IO$.$anonfun$archive$1$adapted(IO.scala:510)
[error] at sbt.io.IO$.$anonfun$withZipOutput$1(IO.scala:595)
[error] at sbt.io.IO$.$anonfun$withZipOutput$1$adapted(IO.scala:584)
[error] at sbt.io.Using.apply(Using.scala:22)
[error] at sbt.io.IO$.withZipOutput(IO.scala:584)
[error] at sbt.io.IO$.archive(IO.scala:510)
[error] at sbt.io.IO$.jar(IO.scala:489)
[error] at sbt.Package$.makeJar(Package.scala:122)
[error] at sbt.Package$.$anonfun$apply$4(Package.scala:76)
[error] at sbt.Package$.$anonfun$apply$4$adapted(Package.scala:74)
[error] at sbt.util.Tracked$.$anonfun$outputChanged$1(Tracked.scala:101)
[error] at sbt.Package$.apply(Package.scala:85)
[error] at sbt.Defaults$.$anonfun$packageTask$1(Defaults.scala:1103)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:263)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:272)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:263)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (core / Compile / packageBin) java.util.zip.ZipException: duplicate entry: org/mockito/captor/Captor.class
[error] Total time: 9 s, completed Aug 15, 2021 9:50:58 AM
mockito-scala$ find . -name Captor.class
./core/target/scala-2.11/classes/org/mockito/captor/Captor.class
./core/target/scala-2.12/classes/org/mockito/captor/Captor.class
./macro/target/scala-2.11/classes/org/mockito/captor/Captor.class
./macro/target/scala-2.13/classes/org/mockito/captor/Captor.class
./macro/target/scala-2.12/classes/org/mockito/captor/Captor.class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment