Print the fully qualified class names if the simple class names are the same
See original GitHub issueI have 2 overloads of a method:
setDeadline(java.time.Duration)
setDeadline(org.joda.time.Duration)
There’s a mocking failure in a test (calling the wrong overload), but the error message isn’t super helpful:
1) myMethod(com.google.frobber.MyClassTest)
Argument(s) are different! Wanted:
myClass.setDeadline(
(Duration) PT1S
);
-> at com.google.frobber.MyClassTest.myMethod(MyClassTest.java:287)
Actual invocation has different arguments:
myClass.setDeadline(
(Duration) PT1S
);
The output attempts to include the classnames to help disambiguate, but in this case, the simple class names are identical (Duration
). We should be able to detect this, and print the FQCNs if the simple names are equal.
Alternatively, we could always print the FQCNs:
(We already do something similar in Truth.)
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Find classes with same full qualified name in Java during ...
I think each (fully qualified) class name can refer to only one class in the JRE; see for example this question.
Read more >Chapter 6. Names - Oracle Help Center
A qualified name N.x may be used to refer to a member of a package or reference type, where N is a simple...
Read more >Get the fully-qualified name of a class in Java - Tutorialspoint
The fully-qualified class name can be obtained using the getName() method. A program that demonstrates this is given as follows −. Example.
Read more >Retrieving a Class Name in Java - Baeldung
Explore different ways to retrieve a class name in Java. ... In Java, there are two kinds of names: simple and qualified. A...
Read more >get_class - Manual - PHP
::class fully qualified class name, instead of get_class <?php namespace my\library\mvc; class Dispatcher {} print Dispatcher::class; // FQN ...
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
@chaehwanli’s changes would have printed the full name even when the classes would have different simple names. I have added a list of indexes in PrintSettings which would do this only for arguments having same simple names.
@chaehwanli Looking at https://github.com/chaehwanli/mockito/commit/2175bfb43e75d80976d75ab0338aaf751cdee9eb I think that would be the correct fix for this. Do you mind sending that as a PR?