Skip to content
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

this field should be lazy to avoid early initialization problems. #416

Merged
merged 1 commit into from
Aug 29, 2017

Conversation

gcaliari
Copy link
Contributor

The filed dbConfig should be lazy to avoid early initialization problems.
In my particular case I have a class:

class SomeDAO @Inject()(protected val dbConfigProvider: DatabaseConfigProvider) extends HasDatabaseConfigProvider[JdbcProfile] { ... }

that needs to be mocked and the eager initialization makes the mock fail with a

java.lang.NullPointerException at play.api.db.slick.HasDatabaseConfigProvider$class.$init$(DatabaseConfigProvider.scala:196)

@codecov-io
Copy link

codecov-io commented Aug 25, 2017

Codecov Report

Merging #416 into master will decrease coverage by 39.22%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #416       +/-   ##
==========================================
- Coverage   47.05%   7.82%   -39.23%     
==========================================
  Files          18      19        +1     
  Lines         102     843      +741     
  Branches        6      10        +4     
==========================================
+ Hits           48      66       +18     
- Misses         54     777      +723
Impacted Files Coverage Δ
...ala/play/api/db/slick/DatabaseConfigProvider.scala 92.3% <100%> (-7.7%) ⬇️
...re/src/main/scala/play/api/db/slick/SlickApi.scala 95.65% <0%> (-4.35%) ⬇️
...lay/api/db/slick/evolutions/EvolutionsModule.scala 100% <0%> (ø) ⬆️
samples/computer-database/app/models/Models.scala 0% <0%> (ø)
...src/main/scala/play/api/db/slick/SlickModule.scala 86.66% <0%> (+3.33%) ⬆️
...pi/db/slick/evolutions/internal/DBApiAdapter.scala 50% <0%> (+5.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b713aa3...3a14892. Read the comment docs.

Copy link
Member

@marcospereira marcospereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@marcospereira marcospereira merged commit 0959b40 into playframework:master Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants