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

EqualsMatcher does not work for String.class #63

Closed
skrilagg opened this issue Jun 1, 2021 · 3 comments
Closed

EqualsMatcher does not work for String.class #63

skrilagg opened this issue Jun 1, 2021 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@skrilagg
Copy link

skrilagg commented Jun 1, 2021

Hi,

after I finished working on SaveSamples-part of a service execution, I started with the LoadSamples-part.
This quickly throw me an Matcher-Error for a call like Sample.of(service.doStuff(Matchers.equalTo("MyString"))); as the EqualsMatcher does not allow a type without an equals-implementation.

As a workaround I then used Matcher.matcher(param -> "MyString".equals(param)).

When taking a look at e.g. hamcrest as matcher library, this is working with String as well.
I thought about implementing a hamcrest-to-ParameterMatcher wrapper but wanted to let you know first as you maybe want to do something about this inside deepsampler.

Best regards,
Michel Pittelkow

@JanSchankin
Copy link
Contributor

JanSchankin commented Jun 8, 2021

Hi Michel,

unfortunatly, I was unable to reproduce this, yet. Could you provide us with a StackTrace or a running example, maybe even a short TestCase?

In theory DeepSampler should be able to use Strings in Matchers::equalTo(...). It is even the default Matcher, so you could just write

Sample.of(service.doStuff("MyString"));

There are some running tests that show the usage of Strings with equalTo():

First, the implicit version without writing Matchers.equalTo(...):

And then the explicit version using Matchers.equalTo(...) (well, I used a static import here, so it's just equalTo(...) in this case):

Is this what is throwing Execptions in your case, or am I on the wrong track?

Greetings
Jan

@JanSchankin JanSchankin self-assigned this Jun 8, 2021
@skrilagg
Copy link
Author

Hi Jan,

I just tried to reproduce this error once more, but without success. I'll close this issue, sorry for any inconveniences caused.

Best regards
Michel

@JanSchankin
Copy link
Contributor

Hi Michel,
no problem, issue reports and suggestions for improvements are always welcome!
Greetings
Jan

@JanSchankin JanSchankin added the help wanted Extra attention is needed label Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants