Re: Mockito dependency problems

27 views
Skip to first unread message

Jordan Parker

unread,
Jul 20, 2017, 6:05:53 PM7/20/17
to Hyun Joon Seol, finatra-users
Hi -

Now that you've added the Mockito dependency, I'd try investigating what the compiler spits out with -Ylogclasspath, as it suggests. Perhaps that will shed some light on what else is missing/broken.

- J


On Thu, Jul 20, 2017 at 1:44 PM, Hyun Joon Seol <hyunjo...@gmail.com> wrote:
I also tried adding mockito as well.


On Thursday, July 20, 2017 at 1:38:22 PM UTC-7, Hyun Joon Seol wrote:
I have tried a lot of different dependency declarations but my tests are failing when I add Mockito.

here is the source code:
class RentrakServiceTest extends Test with Mockito {

test("Should obtain flashes") {
//val serviceMock = smartMock[ConcreteRentrakFetchService]
//assert(Await.result(serviceMock.flash()).split("\n").head == "Rentrak")
}

}

Using pants for build, here is the console output:
[error] missing or invalid dependency detected while loading class file 'Mockito.class'.
                       [error] Could not access type Mockito in value org.specs2.mock,
                       [error] because it (or its dependencies) are missing. Check your build definition for
                       [error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
                       [error] A full rebuild may help if 'Mockito.class' was compiled against an incompatible version of org.specs2.mock.
                       [error] missing or invalid dependency detected while loading class file 'ScalaTestExpectations.class'.
                       [error] Could not access type Expectations in package org.specs2.matcher,
                       [error] because it (or its dependencies) are missing. Check your build definition for
                       [error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
                       [error] A full rebuild may help if 'ScalaTestExpectations.class' was compiled against an incompatible version of org.specs2.matcher.
                       [error] /Redacted/RentrakServiceTest.scala:7: illegal inheritance;
                       [error]  self-type RentrakServiceTest does not conform to com.twitter.inject.Test's selftype com.twitter.inject.Test
                       [error] class RentrakServiceTest extends Test with Mockito {
                       [error]                                  ^
                       [error] /Redacted/RentrakServiceTest.scala:7: illegal inheritance;
                       [error]  self-type RentrakServiceTest does not conform to com.twitter.inject.Mockito's selftype com.twitter.inject.Mockito
                       [error] class RentrakServiceTest extends Test with Mockito {
                       [error]                                            ^
                       [error] four errors found
                       [error] Compile failed at Jul 20, 2017 1:33:57 PM [0.589s]

My dependencies:
'3rdparty/jvm:finatra-test',
'3rdparty/jvm:inject-core',
'3rdparty/jvm:inject-core-test',
'3rdparty/jvm:inject-app',
'3rdparty/jvm:inject-app-test',
'3rdparty/jvm:inject-server',
'3rdparty/jvm:inject-server-test',
'3rdparty/jvm:inject-modules',
'3rdparty/jvm:inject-modules-test',
'3rdparty/jvm:scalatest',
'3rdparty/jvm:scalacheck',
'3rdparty/jvm:guice-testlib',
'3rdparty/jvm:guice-testlib-test',
'3rdparty/jvm:slf4j-simple',
where the actual dependencies are 
jar_library(name='inject-core',
jars=[
jar(org='com.twitter', name='inject-core_2.11', rev='2.11.0')
],)

jar_library(name='inject-core-test',
jars=[
jar(org='com.twitter', name='inject-core_2.11', rev='2.11.0', classifier='tests')
],)

jar_library(name='inject-app',
jars=[
jar(org='com.twitter', name='inject-app_2.11', rev='2.11.0')
],)

jar_library(name='inject-app-test',
jars=[
jar(org='com.twitter', name='inject-app_2.11', rev='2.11.0', classifier='tests')
],)

jar_library(name='inject-server',
jars=[
jar(org='com.twitter', name='inject-server_2.11', rev='2.11.0')
],)

jar_library(name='inject-server-test',
jars=[
jar(org='com.twitter', name='inject-server_2.11', rev='2.11.0', classifier='tests')
],)

jar_library(name='inject-modules',
jars=[
jar(org='com.twitter', name='inject-modules_2.11', rev='2.11.0')
],)

jar_library(name='inject-modules-test',
jars=[
jar(org='com.twitter', name='inject-modules_2.11', rev='2.11.0', classifier='tests')
],)

jar_library(name='finatra-test',
jars=[
jar(org='com.twitter', name='finatra-http_2.11', rev='2.11.0', classifier='tests'),
],
dependencies=[
'3rdparty/jvm:inject-core-test',
],)
jar_library(name='scalatest',
jars = [
jar(org='org.scalatest', name='scalatest_2.11', rev='3.0.0'),
],)

jar_library(name='scalacheck',
jars = [
jar(org='org.scalacheck', name='scalacheck_2.11', rev='1.13.4'),
],)

I've also tried putting all specs2 in the dependency as well but nothing is getting me across this problem.
What additional dependencies do I need to add?

--
You received this message because you are subscribed to the Google Groups "finatra-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to finatra-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hyun Joon Seol

unread,
Jul 21, 2017, 12:20:20 PM7/21/17
to finatra-users, hyunjo...@gmail.com
For future reference, Mockito dependency needed to be in the compile scope as well as test scope.

Thanks Jordan!
To unsubscribe from this group and stop receiving emails from it, send an email to finatra-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages