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

Remove unnecessary interfaces #33

Closed
helmbold opened this issue Jun 16, 2016 · 6 comments
Closed

Remove unnecessary interfaces #33

helmbold opened this issue Jun 16, 2016 · 6 comments

Comments

@helmbold
Copy link
Contributor

Some interfaces exist only to hold concrete methods. In languages like Java and Scala this is necessary, but Kotlin supports top level functions, so this code can be slightly reduced by removing the interfaces.

The following interfaces could be removed: Inspectors, Eventually, CollectionMatchers, ExceptionMatchers, IntMatchers, LongMatchers, MapMatchers, StringMatchers, TypeMatchers. This would be a breaking change.

@sksamuel
Copy link
Member

Would it be a breaking change? Is that becausr they'd need to add an
import?
On 16 Jun 2016 21:40, "Christian Helmbold" notifications@github.com wrote:

Some interfaces exist only to hold concrete methods. In languages like
Java and Scala this is necessary, but Kotlin supports top level functions
https://kotlinlang.org/docs/reference/functions.html#function-scope, so
this code can be slightly reduced by removing the interfaces.

The following interfaces could be removed: Inspectors, Eventually,
CollectionMatchers, ExceptionMatchers, IntMatchers, LongMatchers,
MapMatchers, StringMatchers, TypeMatchers. This would be a breaking change.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#33, or mute the thread
https://github.com/notifications/unsubscribe/AAtZGiVW9u2m1kNVKtd52lLgzfKzQ7cGks5qMbSngaJpZM4I3ybP
.

@helmbold
Copy link
Contributor Author

Yes, the code on the user site would have to be changed due to the required imports.

@sksamuel
Copy link
Member

Is there anyway you can inherit imports in Kotlin?
On 16 Jun 2016 21:46, "Christian Helmbold" notifications@github.com wrote:

Yes, the code on the user site would have to be changed due to the
required imports.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#33 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAtZGnQPYmbDoTZS5QBpxMSqDSOYVFTKks5qMbYogaJpZM4I3ybP
.

@helmbold
Copy link
Contributor Author

helmbold commented Jun 16, 2016

At least I'm not aware of such a possibility. But you could place the functions to be inherited in interfaces and add them to the test base class :-D

My idea was to keep the code as clean and idiomatic as possible, but maybe using interfaces here is more convenient for the users.

@sksamuel
Copy link
Member

I only did it as interfaces because I like them to be in scope automatically, and because its quite "scalay". I've been a Scala developer for 5 years at work, and I haven't touched Java since, so a lot of my opinions are influenced by that.

@helmbold
Copy link
Contributor Author

When I was writing this issue, I haven't thought of the convenience aspect. I think it is ok, to just close this ticket.

github-merge-queue bot pushed a commit that referenced this issue Feb 19, 2024
for both `shouldBeUnique` and `shouldNotContainDuplicates` for failures,
print duplicates, such as:
instead of "Sequence should be Unique", print "Sequence should be
Unique, __but has duplicates: [1, 2, 3]__"
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

No branches or pull requests

2 participants