question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: no nulls by default.

See original GitHub issue

In scala code null is rarely used in favour instead of Option.None or for collections an empty collection. As a result the actual code is not checking or expecting null.

This doesn’t play well with mockito which returns nulls by default for non-stubbed methods, is it possible to somehow wire up something to change this behaviour inside this framework itself.

So it could default for e.g. any Option[T] into None, List[T] into Nil , etc.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bbonannocommented, Aug 24, 2018

For the empty defaults, that’s exactly what we have now, check this test

https://github.com/mockito/mockito-scala/pull/30/files#diff-757050a165ef4dd5d1090f1e22959dc9R128

I’m going to add wrappers for DEEP_STUBS and the others so they can be easily composable

1reaction
bbonannocommented, Aug 20, 2018

Thanks for raising this, I’m actually working on it already 😃

Keep tuned

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent a custom property from being saved without a default value ...
Prevent a custom property from being saved without a default value (no NULLS allowed). Feature Request to the Orion custom property editor prevent...
Read more >
[Feature Request] Allow Nulls for Optional Fields #266 - GitHub
Create a collection with optional fields. Upload some documents where those fields are null rather than non-existent. Observe the following ...
Read more >
Default Request Types (Now Available in the Featur...
We are excited to "Default Request Types", a new feature that will ensure that issues no longer lose their Request Type when they...
Read more >
Boolean field defaults: `null` vs `false`? - DatoCMS community
On boolean fields, is it possible to configure the default value to be false instead of null if it's never been touched?
Read more >
Constructor parameter default value when receiving null input ...
In this case, I will only get my default value if the parameter is not specified at all, but if the input to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found