Asserts for CharSequence contents
See original GitHub issueA lot of APIs in Android deal with CharSequence
. And using assertEquals()
with CharSequence
arguments is cumbersome and unstable. One has to reproduce the exact same type which might change later.
And sometimes it just does not work (e.g. StringBuilder
uses default Object.equals()
implementation).
Therefore I would suggest to add new methods like
assertContentEquals(CharSequence expected, CharSequence actual)
that would compare just the content, irregardless of the type it’s been wrapped into.
(Pull request #949 was trying to do that with generic assertEquals()
which is indeed questionable)
I can create a pull request if you find this proposal reasonable.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
AbstractCharSequenceAssert (AssertJ fluent assertions 3.12.0 ...
Base class for all implementations of assertions for CharSequence s. ... Verifies that the actual CharSequence is equal to the content of the...
Read more >AbstractCharSequenceAssert (AssertJ fluent assertions 2.0.0 API)
Base class for all implementations of assertions for CharSequence s. ... Verifies that the actual CharSequence is equal to the content of the...
Read more >Test CharSequences for equality in JUnit - java - Stack Overflow
You can by using CharBuffer s: assertEquals(CharBuffer.wrap(a), CharBuffer.wrap(b));. The javadoc of .equals for CharBuffer guarantees this:
Read more >CharSequence
dropRight( -1 ) == 'groovy' assert text.dropRight( 10 ) == ''. Parameters: num - number of characters. Returns: CharSequence after removing the right...
Read more >Source (GraalVM Truffle Java API Reference)
getName()); assert resource.toURI().equals(source.getURI()); Each URL source is represented as a canonical object, indexed by the URL. Contents are read ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@joseph-mccarthy GitHub apparently only lets you assign issues to someone on the project’s team. But we almost never assign issues anyway. Feel free to submit a pull request after reading https://github.com/junit-team/junit4/blob/master/CONTRIBUTING.md
@kcooney I am assuming that @joseph-mccarthy is no longer working on this and I’ve opened a PR with implementation.