Re: What is/are the difference(s) between assertSame and assertEquals in JUnit?



Stanimir Stamenkov wrote:
Fri, 08 Aug 2008 21:25:42 -0400, /Lew/:
Arne Vajhøj wrote:
Maybe assertSame should have been called assertSameObject.

It would have made the meaning of it more obvious.

Perhaps it would have, but I don't see it. How about 'assertIsSame()'? This extends the convention that "isX" expresses a boolean condition "X", and avoids the noise-word "Object" in the method name.

May be it is not 'assertIsSame()' as it is not an instance method and takes up two arguments, so one may think of 'assertAreSame' (they). :-)

Anyway, I think 'assertSame' is just fine as it keeps the name reasonably short which makes it more convenient once you get use to it.

Short variable names are not a major priority for me.

Arne
.



Relevant Pages

  • Re: What is/are the difference(s) between assertSame and assertEquals in JUnit?
    ... This extends the convention that "isX" expresses a boolean condition "X", and avoids the noise-word "Object" in the method name. ... May be it is not 'assertIsSame' as it is not an instance method and takes up two arguments, so one may think of 'assertAreSame' ...
    (comp.lang.java.programmer)
  • Re: current type in static methods
    ... >> because using GetTypeor class has a different meaning, ... >> instance method is useful too ... the first option alters the meaning of the "this" ... keyword which is not good. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: new-style classes and len method
    ... I was misunderstanding ... the meaning of "classmethod", thinking of it as an instance method. ...
    (comp.lang.python)
  • Re: new-style classes and len method
    ... the meaning of "classmethod", thinking of it as an instance method. ... class object, such a confusion is not so surprising!-) ...
    (comp.lang.python)