I was wondering why this assert works in JUnit:
assertEquals("[String1, String2, String3]", Arrays.asList("String1", "String2", "String3").toString());
I can’t see the toString() being overridden anywhere on List or Collection.
I’m glad it works, but, still curious.
Arrays.asListreturns anArrays#ArrayListthat extendsAbstractListwhich extendsAbstractCollectionwhich implementstoString.