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

Check the received value in producers (synch/asych) mocks agains a regexp #687

Merged
merged 3 commits into from
Jul 6, 2016

Conversation

jacksilv
Copy link
Contributor

Fixes #667. Thanks to have a look guys

@eapache
Copy link
Contributor

eapache commented Jun 23, 2016

I would prefer not adding a method to Encoder, not all messages are encodable as strings. Instead I think the more general solution is to support passing a callback func ([]byte) error into the mock. Then if you know your messages are strings you can cast yourself and do whatever regexp checks you want; if not you can do whatever other sanity checks you want. Does this make sense?

@jacksilv
Copy link
Contributor Author

Thanks @eapache for your comments, I updated my code

@@ -25,6 +27,21 @@ type ErrorReporter interface {
Errorf(string, ...interface{})
}

type ValueChecker func(val []byte) error
Copy link
Contributor

Choose a reason for hiding this comment

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

could use a (brief) godoc comment

@eapache
Copy link
Contributor

eapache commented Jun 24, 2016

Thanks, this is pretty good now, just a few little things.

@eapache eapache merged commit 12de47f into IBM:master Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants