-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add scalatest plus mockito as a dependency. #296
Conversation
toshetah
commented
Nov 26, 2020
- Add scalatest plus mockito as a dependency.
- Fix docs accordingly.
- Fix brokenn link to travis at the first page.
Hi @toshetah, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement: |
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.
Nice improvements! I think we should keep scalatestplus-mockito as an optional dependency, though.
@@ -128,7 +129,6 @@ lazy val docs = project | |||
commonSettings, | |||
libraryDependencies ++= Seq( | |||
"org.mockito" % "mockito-core" % MockitoVersion % Test, | |||
"org.scalatestplus" %% "mockito-3-2" % ScalatestMockitoVersion % Test, |
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 think we should keep this here: mockito is an optional dependency, and it's up to the user to add it if they want.
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.
Why? It is same as scalatest. I created a new project, and copied to it UserServiceSpec.scala, and it fails on the import of MockitoSugar. Why having one of them imported and not the other? It will cause the user to go and look for the compatible version, while you already did it.
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.
We need to choose whether we are providing a complete solution or we don't. If we decided to upgrade ScalaTest to beyond 3.0.8, we have to bring the dependencies to make it actually work, and not let the user to try all versions until he finds a good one. @raboof
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.
Another question we need to ask ourself is, will we have any user, that will use this library, and won't use mockito-3-2 ? The answer is probably no, because otherwise he won't have MockitoSugar
.
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.
If you look at for example https://www.playframework.com/documentation/2.8.x/ScalaTestingWithScalaTest#Unit-Testing-Controllers, that is a useful scalatestplus-play spec that doesn't use mockito, right? or am I reading that wrong?
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.
You are right about the example you provided. But take a look at this one. It won't work as it is.
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.
The reason it works at the docs is that mockito-3-2 is added at the docs
project. A user that will copy paste it into a new project will fail importing.
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.
Exactly, so I propose we add the documentation on how to add the scalatestplus-mockito dependency to your build in that section. As far as I can see it is only used in that section, right? So it is an optional tool you can use with scalatestplus-play
, but not one that is required for all use cases.
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.
ok, if you insist.
Don't you agree with my claims? I just want the best for this great project! |
I generally prefer to keep optional dependencies optional and not pull them in when not all users would use them - but I don't feel too strongly about it ;)
Your improvements are definitely much appreciated and make this project even better! Thanks! |
@raboof, I forgot to tell you that the reason I got to this, was answering a StackOverflow post asking where has |