Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

junit · JUnit, the Java unit testing framework written by Kent Beck and Erich Gamma.

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 31225
  • Category: Java
  • Founded: Nov 6, 2000
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 10968 - 10997 of 24405   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#10968 From: "lavangu" <lavangu@...>
Date: Fri May 7, 2004 7:50 am
Subject: Overriding AssertEquals
lavangu
Send Email Send Email
 
Is there any way i can override AssertEquals?
My intention is to compare 2 Arraylists for similarity of its
contents.

#10969 From: "Reginald Braithwaite-Lee" <raganwald@...>
Date: Fri May 7, 2004 2:19 pm
Subject: where_bugs_come_from
raganwald
Send Email Send Email
 
"Code is frequently rewritten in ways that do not change its
behaviour. A better algorithm is chosen, or the code is modified to
fix a bug. Accepted wisdom is that the continued running of the
existing unit-tests is sufficient proof that the code continues to
work as intended. However, changing the code is likely to move the
important edge-cases in ways that render existing tests pointless,
and additional tests necessary."

http://fishbowl.pastiche.org/2004/04/27/where_bugs_come_from

--
Reginald Braithwaite-Lee
http://www.braithwaite-lee.com/

#10970 From: "komali_java" <komali_java@...>
Date: Thu May 6, 2004 7:26 pm
Subject: new to Junit
komali_java
Send Email Send Email
 
Hey all,
  I am new to JUnit can ayone tell me where to look for basics of
JUnit othe than JUnit.org like some books to refer etc.
Thank you.

#10971 From: "sumitgupta_us" <sumitgupta_us@...>
Date: Wed May 5, 2004 8:05 pm
Subject: JUnit Reports WITHOUT ant?
sumitgupta_us
Send Email Send Email
 
How can I generate JUnit reports, WITHOUT using ANT? I want to
generate it at the runtime in my Web Application.

Thanks,

Sumit

#10972 From: "ferrismatic" <ferrismatic@...>
Date: Fri May 7, 2004 2:14 pm
Subject: Junit with TopLink?
ferrismatic
Send Email Send Email
 
Hello:

I am wondering if anyone has Junit with a TopLink-enabled application?
Our EJBs are fully intertwined with TopLink, and I'm not quite sure
how this would work, perhaps using mock objects? Has anyone used
Easymock or Junit with TopLink?

Thanks,
Matthew E. Ferris

#10973 From: "J. B. Rainsberger" <jbrains@...>
Date: Fri May 7, 2004 9:50 pm
Subject: Re: Junit with TopLink?
nails762
Send Email Send Email
 
ferrismatic wrote:

> Hello:
>
> I am wondering if anyone has Junit with a TopLink-enabled application?
> Our EJBs are fully intertwined with TopLink, and I'm not quite sure
> how this would work, perhaps using mock objects? Has anyone used
> Easymock or Junit with TopLink?

If your EJBs are fully coupled to TopLink, there's your problem. Your
best bet for quick relief is some combination of jMock/EasyMock and
MockEJB. For /real/ relief, you need to extract your TopLink client code
out of your EJBs and test it separately. The separation allows you to
insert some separating interfaces, at which point you can use
EasyMock/jMock to help test each side of the interface. As for the
TopLink client code, a mock objects approach is likely what I would try
first.

Good luck.
--
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

#10974 From: "J. B. Rainsberger" <jbrains@...>
Date: Fri May 7, 2004 9:46 pm
Subject: Re: new to Junit
nails762
Send Email Send Email
 
komali_java wrote:

> Hey all,
> I am new to JUnit can ayone tell me where to look for basics of
> JUnit othe than JUnit.org like some books to refer etc.
> Thank you.

I like the books JUnit in Action and JUnit Recipes, as well as
Test-Driven Development: By Example, which provides a long example in
Java/JUnit.

JUnit Recipes will be available in July, but the others are already out.
--
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

#10975 From: "J. B. Rainsberger" <jbrains@...>
Date: Fri May 7, 2004 9:47 pm
Subject: Re: Overriding AssertEquals
nails762
Send Email Send Email
 
lavangu wrote:
> Is there any way i can override AssertEquals?
> My intention is to compare 2 Arraylists for similarity of its
> contents.

Two options:

1. assertEquals(Arrays.asList(expectedArray), Arrays.asList(actualArray));

2. JUnit-addons: ArrayAssert. junit-addons.sourceforge.net

Good luck.
--
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

#10976 From: "J. B. Rainsberger" <jbrains@...>
Date: Fri May 7, 2004 9:45 pm
Subject: Re: JUnit Reports WITHOUT ant?
nails762
Send Email Send Email
 
sumitgupta_us wrote:

> How can I generate JUnit reports, WITHOUT using ANT? I want to
> generate it at the runtime in my Web Application.

Why not use Ant? The other alternatives are considerably more work.
Before we get into them, why can't you/don't you want to use Ant?
--
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

#10977 From: Jason Rogers <jacaetevha@...>
Date: Fri May 7, 2004 7:05 pm
Subject: Re: Overriding AssertEquals
jacaetev
Send Email Send Email
 
On Fri, 2004-05-07 at 07:50, lavangu wrote:
> Is there any way i can override AssertEquals?
> My intention is to compare 2 Arraylists for similarity of its
> contents.

Look at the contract of List.equals(Object):
<quote>
Compares the specified object with this list for equality. Returns true
if and only if the specified object is also a list, both lists have the
same size, and all corresponding pairs of elements in the two lists are
equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null :
e1.equals(e2)).) In other words, two lists are defined to be equal if
they contain the same elements in the same order. This definition
ensures that the equals method works properly across different
implementations of the List interface.
</quote>

Of course, if your two lists are not ordered the same you will have to
do something else, like use JUnitAdd-ons or sorting them with a
Comparator before you assert for equality (Collections.sort(List,
Comparator).

--
Jason Rogers

"Where there is no vision, the people perish..."
Bible, Proverbs 29:18

#10978 From: "ericnickell2000" <nickell@...>
Date: Fri May 7, 2004 9:47 pm
Subject: Re: Overriding AssertEquals
ericnickell2000
Send Email Send Email
 
--- In junit@yahoogroups.com, "lavangu" <lavangu@y...> wrote:
> Is there any way i can override AssertEquals?
> My intention is to compare 2 Arraylists for similarity of its
> contents.

No, afraid not.

assertEquals is static.

I usually add my own, a la...

(Copyright (C) 2004, Palo Alto Research Center. All rights reserved.)

public abstract class BaseTestCase extends TestCase {

	 protected void assertEqualsArray(String message, int[] expected,
int[] actual) {
		 assertEquals(asString(expected), asString(actual));
		 assertEquals(expected.length, actual.length);
		 for (int i = 0; i < actual.length; i++) {
			 assertEquals(expected[i], actual[i]);
		 }
	 }

	 protected void assertEqualsArray(int[] expected, int[] actual) {
		 assertEqualsArray(null, expected, actual);
	 }

	 private String asString(int[] array) {
		 StringBuffer result = new StringBuffer();
		 String prefix = "[[";
		 for (int i = 0; i < array.length; i++) {
			 result.append(prefix);
			 prefix = ", ";
			 result.append(i);
			 result.append(":");
			 result.append(array[i]);
		 }
		 result.append("]]");
		 return result.toString();
	 }
}

#10979 From: Kevin Klinemeier <zipwow@...>
Date: Fri May 7, 2004 11:57 pm
Subject: Re: Overriding AssertEquals
zipwow
Send Email Send Email
 
Or can't you also just compare them as Collections:

assertEquals("Wrong number of stuff stored", expected.size(),
received.size());
assertTrue("Some elements do not match",
received.containsAll(expected));

I've been bit by using Collection.equals(...) a couple of times, so
this one stands out in my mind.

-Kevin

--- Jason Rogers <jacaetevha@...> wrote:
> On Fri, 2004-05-07 at 07:50, lavangu wrote:
> > Is there any way i can override AssertEquals?
> > My intention is to compare 2 Arraylists for similarity of its
> > contents.
>
> Look at the contract of List.equals(Object):
> <quote>
> Compares the specified object with this list for equality. Returns
> true
> if and only if the specified object is also a list, both lists have
> the
> same size, and all corresponding pairs of elements in the two lists
> are
> equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null :
> e1.equals(e2)).) In other words, two lists are defined to be equal if
> they contain the same elements in the same order. This definition
> ensures that the equals method works properly across different
> implementations of the List interface.
> </quote>
>
> Of course, if your two lists are not ordered the same you will have
> to
> do something else, like use JUnitAdd-ons or sorting them with a
> Comparator before you assert for equality (Collections.sort(List,
> Comparator).
>
> --
> Jason Rogers
>
> "Where there is no vision, the people perish..."
> Bible, Proverbs 29:18
>
>





__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

#10980 From: "ericnickell2000" <nickell@...>
Date: Sat May 8, 2004 4:13 pm
Subject: Re: Overriding AssertEquals
ericnickell2000
Send Email Send Email
 
Sorry.  I read "ArrayLists" as "Arrays".  See other responses for
correct answers.

--- In junit@yahoogroups.com, "ericnickell2000" <nickell@d...> wrote:
> --- In junit@yahoogroups.com, "lavangu" <lavangu@y...> wrote:
> > Is there any way i can override AssertEquals?
> > My intention is to compare 2 Arraylists for similarity of its
> > contents.
>
> No, afraid not.
>
> assertEquals is static.
>
> I usually add my own, a la...
>
> (Copyright (C) 2004, Palo Alto Research Center. All rights reserved.)
>
> public abstract class BaseTestCase extends TestCase {
>
>  protected void assertEqualsArray(String message, int[] expected,
> int[] actual) {
> 	 assertEquals(asString(expected), asString(actual));
> 	 assertEquals(expected.length, actual.length);
> 	 for (int i = 0; i < actual.length; i++) {
> 		 assertEquals(expected[i], actual[i]);
> 	 }
>  }
>
>  protected void assertEqualsArray(int[] expected, int[] actual) {
> 	 assertEqualsArray(null, expected, actual);
>  }
>
>  private String asString(int[] array) {
> 	 StringBuffer result = new StringBuffer();
> 	 String prefix = "[[";
> 	 for (int i = 0; i < array.length; i++) {
> 		 result.append(prefix);
> 		 prefix = ", ";
> 		 result.append(i);
> 		 result.append(":");
> 		 result.append(array[i]);
> 	 }
> 	 result.append("]]");
> 	 return result.toString();
>  }
> }

#10981 From: "hshah_mse" <hshah_mse@...>
Date: Sun May 9, 2004 6:22 am
Subject: looking for 3.8.0 version of Junit for windows XP
hshah_mse
Send Email Send Email
 
Hi all,
I am looking for a an older version of junit for a school project.To
test a application i have developed.any lead would help.
thanks,
Shah

#10982 From: Girish Patil <sairamgirish@...>
Date: Sun May 9, 2004 8:34 am
Subject: JUnit GuideLines
sairamgirish
Send Email Send Email
 
Hi
This is regarding the JUnit Test classes
Is there any guidline available for How many test
classes/test methods one should write for Testing
methods
For EG
For method
  myMethod(String st1,Object ob1,Object ob1){
..
  }

I can write test methods with Different combinations
like passing null string ,valid string ,null object
ob1
etc...

is there any guideline on this ?


Regards
Girish




__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

#10983 From: Vladimir Ritz Bossicard <vladimir@...>
Date: Mon May 10, 2004 6:00 am
Subject: Re: looking for 3.8.0 version of Junit for windows XP
vbossica
Send Email Send Email
 
> I am looking for a an older version of junit for a school project.To
> test a application i have developed.any lead would help.

JUnit 3.8.0 had a release problem (iirc did not work properly on Solaris) and
the same code was re-released as 3.8.1.  The previous version of 3.8.1 is 3.7.

-Vladimir

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

#10984 From: "Chappell, Simon P" <simon.chappell@...>
Date: Mon May 10, 2004 1:18 pm
Subject: RE: JUnit GuideLines
simon.chappell@...
Send Email Send Email
 
I'll take first crack at this one, hopefully I'll beat JB to the punch! :-)

Girish,

The answer is "it depends" or "it's up to you", whichever one you feel fits the
circumstances best.

The reason for this is that unit testing is a voluntary thing. Unit tests are
written by programmers for programmers. As a programmer implementing some
requested functionality, I write tests that help me feel comfortable that my
code does what the specification asked for. I like to call my tests with a mix
of known good data, known bad data and problematic edge-cases. (If you don't
know what the edge-cases are, then spend more time understanding the
specification or business problem). So, when you have written enough test cases
to feel comfortable, stop and move to the next programming task.

Also, remember that your objective should be to test behaviour rather than
methods. Unfortunately, there is often a one to one correspondence between the
two in many people's code, but don't let this fool you into beliveing that
methods are always the same as behaviour. To use JB's least favourite example,
consider accessors for a value, e.g. Name. To code the accessor behaviour for
this you might have a setName() and a getName() method, but the two methods are
both part of one behaviour, so to test the Name accessor behaviour, you would
write one test and ensure that you could retrieve the same value that you had
just stored.

Hope this helps,

Simon

-----------------------------------------------------------------
Simon P. Chappell                     simon.chappell@...
Java Programming Specialist                      www.landsend.com
Lands' End, Inc.                                   (608) 935-4526

"Wisdom is not the prerogative of the academics." - Peter Chappell

>-----Original Message-----
>From: Girish Patil [mailto:sairamgirish@...]
>Sent: Sunday, May 09, 2004 3:34 AM
>To: junit@yahoogroups.com
>Subject: [junit] JUnit GuideLines
>
>
>Hi
>This is regarding the JUnit Test classes
>Is there any guidline available for How many test
>classes/test methods one should write for Testing
>methods
>For EG
>For method
> myMethod(String st1,Object ob1,Object ob1){
>..
> }
>
>I can write test methods with Different combinations
>like passing null string ,valid string ,null object
>ob1
>etc...
>
>is there any guideline on this ?
>
>
>Regards
>Girish
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Win a $20,000 Career Makeover at Yahoo! HotJobs
>http://hotjobs.sweepstakes.yahoo.com/careermakeover
>
>
>
>------------------------ Yahoo! Groups Sponsor
>---------------------~-->
>Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
>Now with Pop-Up Blocker. Get it for free!
>http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/5cFolB/TM
>---------------------------------------------------------------
>------~->
>
>
>Yahoo! Groups Links
>
>
>
>
>
>

#10985 From: Jason Rogers <jacaetevha@...>
Date: Mon May 10, 2004 9:40 am
Subject: Re: Overriding AssertEquals
jacaetev
Send Email Send Email
 
On Fri, 2004-05-07 at 23:57, Kevin Klinemeier wrote:
> Or can't you also just compare them as Collections:
>
> assertEquals("Wrong number of stuff stored", expected.size(),
> received.size());
> assertTrue("Some elements do not match",
> received.containsAll(expected));
>
> I've been bit by using Collection.equals(...) a couple of times, so
> this one stands out in my mind.

But I didn't quote the Collection.equals(Object) method, I quoted
List.equals(Object) which is very different.  I believe the original
post specifically mentioned Lists...

--
Jason Rogers

"Where there is no vision, the people perish..."
Bible, Proverbs 29:18

#10986 From: "J. B. Rainsberger" <jbrains@...>
Date: Mon May 10, 2004 5:31 pm
Subject: Re: JUnit GuideLines
nails762
Send Email Send Email
 
Girish Patil wrote:

> Hi
> This is regarding the JUnit Test classes
> Is there any guidline available for How many test
> classes/test methods one should write for Testing
> methods
> For EG
> For method
> myMethod(String st1,Object ob1,Object ob1){
> ..
> }
>
> I can write test methods with Different combinations
> like passing null string ,valid string ,null object
> ob1
> etc...
>
> is there any guideline on this ?

Yes: test until fear turns to boredom. Keep adding tests until you feel
as though adding more tests won't make you feel more confident that the
method works. When in doubt, add another test. When you get bored with
adding tests -- that is, when the next test isn't likely to find a
defect -- stop.

There are also general principles for testing that you can apply to this
specific case. Books like Lessons Learned in Software Testing would help
here.
--
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

#10987 From: "Tom Cox" <tcox56_98@...>
Date: Mon May 10, 2004 3:26 pm
Subject: Re: Overriding AssertEquals
tcox56_98
Send Email Send Email
 
For completeness, shouldn't you also check:

expected.containsAll(received);

--- In junit@yahoogroups.com, Kevin Klinemeier <zipwow@y...> wrote:
> Or can't you also just compare them as Collections:
>
> assertEquals("Wrong number of stuff stored", expected.size(),
> received.size());
> assertTrue("Some elements do not match",
> received.containsAll(expected));
>
> I've been bit by using Collection.equals(...) a couple of times, so
> this one stands out in my mind.
>
> -Kevin

#10988 From: "Danijel Arsenovski" <darsenovski@...>
Date: Mon May 10, 2004 5:03 pm
Subject: junit and Visual Age 4 menu integration
darsenovski@...
Send Email Send Email
 
Hi,

I have imported junit source to VA4 and I can execute sample tests.
Now I would like to be able to invoke TestRunner by right mouse-click over a
class.
I followed the instructions on junit site on how to integrate with VA 3.5.
I have created a dir: junit-swingui-TestRunner inside dir tools
and added a default.ini with following content
Name=JUnit
Version=3.8.1
Menu-Items=JUnit,junit.swingui.TestRunner,-c

I have added a junit source also to the dir, since if I don't, Visual Age
reports "class not found" and TestRunner does not appear.

Now, with junit source inside junit-swingui-TestRunner dir,when I invoke junit
with right mouseclick, a swing TestRunner appears with correct TestCase name to
execute (that class that I clicked on) but reports an error "Class not found"
when i try to run it. It does not seem to see any class in my workspace.

Anyone can help me with this?

Thanks

#10989 From: "Scott Vachalek" <scott@...>
Date: Mon May 10, 2004 5:45 pm
Subject: Re: JUnit GuideLines
svachalek
Send Email Send Email
 
There is an old guideline from procedural programming days (sorry I don't
remember the original source) that says that the number of tests should be >=
the cyclomatic complexity of a function.  (There are many texts on cyclomatic
complexity but in short it's basically the number of loops/branches in a method
+ 1.)

That is, a function with no branches can be covered in one test, with a single
branch you need two tests (true path and false path) and so on.  For loops,
consider the case of "loop entered" vs "loop never entered".  The basic idea is
that this should give you more or less 100% coverage by most metrics, and
without basic coverage you can't have fully tested a method.  (The reverse is
not true; you can have 100% coverage without fully testing.)

As far as I know, the science behind code coverage hasn't quite caught up to the
world of exceptions and objects: stack unwinding and polymorphism add all kinds
of hidden branches so in many cases the complexity is a gross underestimate.  On
the other hand, as Mr. Chappell mentioned, a single method may often be too
small a unit to properly test.  On the whole though, I think getting code
coverage is a good goal and a measurable one, and complexity is often a fair
enough estimate while you are writing tests.

Scott


----- Original Message -----
   From: Girish Patil
   To: junit@yahoogroups.com
   Sent: Sunday, May 09, 2004 1:34 AM
   Subject: [junit] JUnit GuideLines


   Hi
   This is regarding the JUnit Test classes
   Is there any guidline available for How many test
   classes/test methods one should write for Testing
   methods
   For EG
   For method
   myMethod(String st1,Object ob1,Object ob1){
   ..
   }

   I can write test methods with Different combinations
   like passing null string ,valid string ,null object
   ob1
   etc...

   is there any guideline on this ?


   Regards
   Girish




   __________________________________
   Do you Yahoo!?
   Win a $20,000 Career Makeover at Yahoo! HotJobs
   http://hotjobs.sweepstakes.yahoo.com/careermakeover


         Yahoo! Groups Sponsor
               ADVERTISEMENT





------------------------------------------------------------------------------
   Yahoo! Groups Links

     a.. To visit your group on the web, go to:
     http://groups.yahoo.com/group/junit/

     b.. To unsubscribe from this group, send an email to:
     junit-unsubscribe@yahoogroups.com

     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]

#10990 From: Jason Rogers <jacaetevha@...>
Date: Mon May 10, 2004 5:10 pm
Subject: Re: junit and Visual Age 4 menu integration
jacaetev
Send Email Send Email
 
It's been a few years for me since I used VAJ, but I believe it is a
workspace classpath problem.  Put those classes on your workspace
classpath.

On Mon, 2004-05-10 at 17:03, Danijel Arsenovski wrote:
> Hi,
>
> I have imported junit source to VA4 and I can execute sample tests.
> Now I would like to be able to invoke TestRunner by right mouse-click over a
class.
> I followed the instructions on junit site on how to integrate with VA 3.5.
> I have created a dir: junit-swingui-TestRunner inside dir tools
> and added a default.ini with following content
> Name=JUnit
> Version=3.8.1
> Menu-Items=JUnit,junit.swingui.TestRunner,-c
>
> I have added a junit source also to the dir, since if I don't, Visual Age
reports "class not found" and TestRunner does not appear.
>
> Now, with junit source inside junit-swingui-TestRunner dir,when I invoke junit
with right mouseclick, a swing TestRunner appears with correct TestCase name to
execute (that class that I clicked on) but reports an error "Class not found"
when i try to run it. It does not seem to see any class in my workspace.
>
> Anyone can help me with this?
>
> Thanks
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
--
Jason Rogers

"Where there is no vision, the people perish..."
Bible, Proverbs 29:18

#10991 From: "Danijel Arsenovski" <darsenovski@...>
Date: Mon May 10, 2004 9:47 pm
Subject: RE: junit and Visual Age 4 menu integration
darsenovski@...
Send Email Send Email
 
Of course it was, silly me...

Thanks Jason.

-----Mensaje original-----
De: Jason Rogers [mailto:jacaetevha@...]
Enviado el: Lunes, 10 de Mayo de 2004 13:11
Para: junit@yahoogroups.com
Asunto: Re: [junit] junit and Visual Age 4 menu integration


It's been a few years for me since I used VAJ, but I believe it is a
workspace classpath problem.  Put those classes on your workspace
classpath.

On Mon, 2004-05-10 at 17:03, Danijel Arsenovski wrote:
> Hi,
>
> I have imported junit source to VA4 and I can execute sample tests.
> Now I would like to be able to invoke TestRunner by right mouse-click over a
class.
> I followed the instructions on junit site on how to integrate with VA 3.5.
> I have created a dir: junit-swingui-TestRunner inside dir tools
> and added a default.ini with following content
> Name=JUnit
> Version=3.8.1
> Menu-Items=JUnit,junit.swingui.TestRunner,-c
>
> I have added a junit source also to the dir, since if I don't, Visual Age
reports "class not found" and TestRunner does not appear.
>
> Now, with junit source inside junit-swingui-TestRunner dir,when I invoke junit
with right mouseclick, a swing TestRunner appears with correct TestCase name to
execute (that class that I clicked on) but reports an error "Class not found"
when i try to run it. It does not seem to see any class in my workspace.
>
> Anyone can help me with this?
>
> Thanks
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
--
Jason Rogers

"Where there is no vision, the people perish..."
Bible, Proverbs 29:18




Yahoo! Groups Links

#10992 From: "J. B. Rainsberger" <jbrains@...>
Date: Mon May 10, 2004 9:11 pm
Subject: Re: Re: Overriding AssertEquals
nails762
Send Email Send Email
 
Tom Cox wrote:

> For completeness, shouldn't you also check:
>
> expected.containsAll(received);

For any two collections, if they are the same size and A contains all of
B's elements, then B must contains of all A's elements. If you remove
the condition that they are the same size, then this theorem fails.

Since A contains all of B's elements, A must have at least B elements.
If A contains an element /not in/ B, then A must have |B|+1 elements,
contradicting the hypothesis that they are the same size. Thus A must
contain /only/ the elements in B, so that B contains all of A's
elements, too.

Sorry... I hadn't stretched my set theory muscles in a while. :)
--
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

#10993 From: "ericnickell2000" <nickell@...>
Date: Tue May 11, 2004 4:55 pm
Subject: Re: Overriding AssertEquals
ericnickell2000
Send Email Send Email
 
--- In junit@yahoogroups.com, "J. B. Rainsberger" <jbrains@r...> wrote:
> Tom Cox wrote:
>
> > For completeness, shouldn't you also check:
> >
> > expected.containsAll(received);
>
> For any two collections, if they are the same size and A contains
all of
> B's elements, then B must contains of all A's elements. If you remove
> the condition that they are the same size, then this theorem fails.

I disagree.

public void testAssumption() {
	 Collection collectionA = new HashSet(Arrays.asList(new String[] {"x",
"y", "z"}));
	 Collection collectionB = new ArrayList(Arrays.asList(new String[]
{"x", "y", "x"}));

	 assertTrue("A is a Collection", collectionA instanceof Collection);
	 assertTrue("B is a Collection", collectionB instanceof Collection);
	 assertTrue("A and B are the same size", collectionA.size() ==
collectionB.size());
	 assertTrue("A contains all of B", collectionA.containsAll(collectionB));

	 assertTrue("B does *not* contain all of A",
!collectionB.containsAll(collectionA));
}



>
> Since A contains all of B's elements, A must have at least B elements.
> If A contains an element /not in/ B, then A must have |B|+1 elements,
> contradicting the hypothesis that they are the same size. Thus A must
> contain /only/ the elements in B, so that B contains all of A's
> elements, too.
>
> Sorry... I hadn't stretched my set theory muscles in a while. :)

Me, neither.

Eric

#10994 From: "J. B. Rainsberger" <jbrains@...>
Date: Tue May 11, 2004 5:42 pm
Subject: Re: Re: Overriding AssertEquals
nails762
Send Email Send Email
 
ericnickell2000 wrote:
> --- In junit@yahoogroups.com, "J. B. Rainsberger" <jbrains@r...> wrote:
>  > Tom Cox wrote:
>  >
>  > > For completeness, shouldn't you also check:
>  > >
>  > > expected.containsAll(received);
>  >
>  > For any two collections, if they are the same size and A contains
> all of
>  > B's elements, then B must contains of all A's elements. If you remove
>  > the condition that they are the same size, then this theorem fails.
>
> I disagree.
>
> public void testAssumption() {
>       Collection collectionA = new HashSet(Arrays.asList(new String[] {"x",
> "y", "z"}));
>       Collection collectionB = new ArrayList(Arrays.asList(new String[]
> {"x", "y", "x"}));
>
>       assertTrue("A is a Collection", collectionA instanceof Collection);
>       assertTrue("B is a Collection", collectionB instanceof Collection);
>       assertTrue("A and B are the same size", collectionA.size() ==
> collectionB.size());
>       assertTrue("A contains all of B",
> collectionA.containsAll(collectionB));
>
>       assertTrue("B does *not* contain all of A",
> !collectionB.containsAll(collectionA));
> }

You're right. I missed this:

...for any collections /of the same type/ (both Sets, both Lists or both
Maps).

Implicit assumption. :)

>  > Since A contains all of B's elements, A must have at least B elements.
>  > If A contains an element /not in/ B, then A must have |B|+1 elements,
>  > contradicting the hypothesis that they are the same size. Thus A must
>  > contain /only/ the elements in B, so that B contains all of A's
>  > elements, too.
>  >
>  > Sorry... I hadn't stretched my set theory muscles in a while. :)
>
> Me, neither.

Well played.
--
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

#10995 From: "John L. Webber" <John.Webber@...>
Date: Wed May 12, 2004 6:47 am
Subject: Re: Re: Overriding AssertEquals (OT)
John.Webber@...
Send Email Send Email
 
Does that mean game and set to Eric? ;-)

Sorry, couldn't resist!

John

J. B. Rainsberger wrote:

>> > Since A contains all of B's elements, A must have at least B elements.
>> > If A contains an element /not in/ B, then A must have |B|+1 elements,
>> > contradicting the hypothesis that they are the same size. Thus A must
>> > contain /only/ the elements in B, so that B contains all of A's
>> > elements, too.
>> >
>> > Sorry... I hadn't stretched my set theory muscles in a while. :)
>>
>>Me, neither.
>>
>>
>
>Well played.
>
>

--
---------------------------------------------------------
  Jentro Technologies GmbH
  John L. Webber, Software Development
---------------------------------------------------------
  Rosenheimer Str. 145e     81671 München
  Tel. +49 89 189 169 80     mailto:John.Webber@...
  Fax  +49 89 189 169 99     http://www.jentro.com
---------------------------------------------------------
NOTICE: The information contained in this e-mail is confidential or may
otherwise be legally privileged. It is intended for the named recipient only. If
you have received it in error, please notify us immediately by reply or by
calling the telephone number above and delete this message and all its
attachments without any use or further distribution of its contents. Please note
that any unauthorised review, copying, disclosing or otherwise making use of the
information is strictly prohibited. Thank you.
---------------------------------------------------------

#10996 From: shockofpoint6@...
Date: Wed May 12, 2004 3:17 am
Subject: Unit testing a __intternalconstructor
nervousxians
Send Email Send Email
 
Hi all,

class MyClass has 3 constructors, all of which call the same private
method __internalconstructor(p1,p2,p3,p4);

Since __internalconstructor is critical to all 3 public constructors,
I want to unit test it, but it is private, so I want to use

public static java.lang.Object PrivateAccessor.invoke
(java.lang.Object object,java.lang.String name,
                                       java.lang.Class[] parameterTypes,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable

Problem: I have to create a new instance of a MyClass object, before I
can use invoke, but if I do that, I will be calling
__internalconstructor prematurely in the unit test.

Any suggestions?

Is my use of an __internalconstructor wrong? Is there another way to
not duplicate constructor code, but to still let multiple constructors
call the same functionality?

#10997 From: "francesco_xplabs" <francesco.cirillo@...>
Date: Wed May 12, 2004 1:49 pm
Subject: Problems downloading JUnitFAQ.txt
francesco_xp...
Send Email Send Email
 
Hi everybody,

I'd like to download JUnitFAQ.txt from the File section, but it
seems there's something not working properly (dangling reference?!).
Is there another pointer to that file?

--Francesco Cirillo

Messages 10968 - 10997 of 24405   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help