Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Better LDUser equality #96

Closed
igillis opened this issue Jun 14, 2017 · 6 comments
Closed

Better LDUser equality #96

igillis opened this issue Jun 14, 2017 · 6 comments

Comments

@igillis
Copy link

igillis commented Jun 14, 2017

I have a class that wraps LDClient usage. I want to be able to write tests for this class that mock out LDUserInterface::boolVariation and LDUserInterface::allFlags using Mockito. However, there's no way to set up an argument matcher against LDUser because a) it doesn't implement a useful equals method and b) it doesn't expose any of its state.

Sample code:

LDUser expectedUser = new LDUser.Builder("asdf").custom("foo", 1).build();
when(ldClient.allFlags(eq(expectedUser)).thenReturn(true);
@drichelson
Copy link
Contributor

Thanks for reaching out @igillis! Would an equals() method on LDUser suffice?

@igillis
Copy link
Author

igillis commented Jun 15, 2017

Yep, that would work. Happy to put up a PR if you want -- not sure what your process looks like.

@drichelson
Copy link
Contributor

@igillis we'll do it. I'll have it on your desk by Monday morning at the latest.

@igillis
Copy link
Author

igillis commented Jun 15, 2017

Awesome :)

This was referenced Jun 16, 2017
@drichelson
Copy link
Contributor

@igillis We just release https://github.com/launchdarkly/java-client/releases/tag/2.2.6 which addresses this issue.

@igillis
Copy link
Author

igillis commented Jun 19, 2017

nice, thanks for the quick turnaround!

eli-darkly added a commit that referenced this issue Sep 4, 2018
preserve prerequisite flag value in event even if flag was off
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants