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: 31224
  • Category: Java
  • Founded: Nov 6, 2000
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
Messages 23805 - 23834 of 24384   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#23805 From: Georg Thimm <le_garcon_enerve@...>
Date: Wed Feb 1, 2012 1:32 pm
Subject: Re: Call for help: Assertions for Comparable
le_garcon_en...
Send Email Send Email
 
Hi!

Please feel fre to take some code for this out of "unofficialjunit" on
sourceforge.

Regards,
 Georg


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

#23806 From: wensi liu <juky.liu@...>
Date: Tue Feb 7, 2012 1:38 am
Subject: Customize the JUnit result
juky.liu@...
Send Email Send Email
 
Hi All,

Is there a way to get more detail info after running test cases? like spend
how many time for each test case? list all passed test cases other than
just failed?

I am able to get some limit info form TestResult, but not enough to me.

any suggestions would be appreciate!

I launch test by TestRunner BTW.

Thanks
Wensi


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

#23807 From: "Wayne" <wdtj@...>
Date: Wed Feb 15, 2012 2:54 pm
Subject: Displaying test case name from the testcase
wdtj
Send Email Send Email
 
Forgive me if this is a FAQ, but I have tried digging through the documentation
and the answer was not apparent.

I am writing some test cases.  As part of the testing, I want to keep a log of
the responses from the code for debugging purposes.  It would be really helpful
to have some simple process to print out the tests name and other properties
into the log.  Since there are hundreds of tests, I would like to make this a
common step (ie call a method) to do this.  Problem is finding the name of the
test itself (without having to pass it into the logging method or hacking the
stack).

I see there is a Description class in the runner.  Is there any way to access
the runner (i.e. a singleton or static getter) from the test case?

#23808 From: Dawid Weiss <dawid.weiss@...>
Date: Wed Feb 15, 2012 11:05 pm
Subject: Re: Displaying test case name from the testcase
dawid.weiss@...
Send Email Send Email
 
You should write a @Rule that will intercept the Description associated
with the current test case and store it somewhere (or use it directly).
Check out the javadoc for @Rule.

http://kentbeck.github.com/junit/javadoc/latest/org/junit/rules/TestRule.html


Dawid

On Wed, Feb 15, 2012 at 3:54 PM, Wayne <wdtj@...> wrote:

> **
>
>
> Forgive me if this is a FAQ, but I have tried digging through the
> documentation and the answer was not apparent.
>
> I am writing some test cases. As part of the testing, I want to keep a log
> of the responses from the code for debugging purposes. It would be really
> helpful to have some simple process to print out the tests name and other
> properties into the log. Since there are hundreds of tests, I would like to
> make this a common step (ie call a method) to do this. Problem is finding
> the name of the test itself (without having to pass it into the logging
> method or hacking the stack).
>
> I see there is a Description class in the runner. Is there any way to
> access the runner (i.e. a singleton or static getter) from the test case?
>
>
>


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

#23809 From: David Saff <david@...>
Date: Thu Feb 16, 2012 2:32 am
Subject: Re: Displaying test case name from the testcase
dsaff
Send Email Send Email
 
See also
https://github.com/KentBeck/junit/blob/master/src/main/java/org/junit/rules/Test\
Name.java

On Wed, Feb 15, 2012 at 6:05 PM, Dawid Weiss <dawid.weiss@...> wrote:
> You should write a @Rule that will intercept the Description associated
> with the current test case and store it somewhere (or use it directly).
> Check out the javadoc for @Rule.
>
> http://kentbeck.github.com/junit/javadoc/latest/org/junit/rules/TestRule.html
>
>
> Dawid
>
> On Wed, Feb 15, 2012 at 3:54 PM, Wayne <wdtj@...> wrote:
>
>> **
>>
>>
>> Forgive me if this is a FAQ, but I have tried digging through the
>> documentation and the answer was not apparent.
>>
>> I am writing some test cases. As part of the testing, I want to keep a log
>> of the responses from the code for debugging purposes. It would be really
>> helpful to have some simple process to print out the tests name and other
>> properties into the log. Since there are hundreds of tests, I would like to
>> make this a common step (ie call a method) to do this. Problem is finding
>> the name of the test itself (without having to pass it into the logging
>> method or hacking the stack).
>>
>> I see there is a Description class in the runner. Is there any way to
>> access the runner (i.e. a singleton or static getter) from the test case?
>>
>>
>>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#23810 From: "coretek89" <coretek89@...>
Date: Thu Feb 16, 2012 10:24 am
Subject: JUnitCore Stopping
coretek89
Send Email Send Email
 
Hello,

I wan't to ask for a solution to stop and/or destroy a JUnitCore.
Like pleaseStop() on the RunNotifier.

I already tried ExecutorsService with no success.
My only not yet tested solution is to System.exit my java programm after
starting a new process of it.

#23811 From: "nirh20" <nir.heifetz@...>
Date: Wed Feb 22, 2012 2:27 pm
Subject: How to set the order in Junit
nirh20
Send Email Send Email
 
Hi all
I would like to know  how to set an order in Junit,
Details: the Junit tests are executing from quickbuild.
Thanks

#23812 From: Matthew Farwell <matthew@...>
Date: Wed Feb 22, 2012 3:48 pm
Subject: Re: How to set the order in Junit
mjfarwell
Send Email Send Email
 
Hi,

If you're asking about the ordering of tests, it's discouraged in JUnit.
For more information, see this stackoverflow Answer:

http://stackoverflow.com/questions/7845929/has-junit4-begun-supporting-ordering-\
of-test-is-it-intentional/7846712#7846712


Matthew Farwell.

Le 22 février 2012 15:27, nirh20 <nir.heifetz@...> a écrit :

> **
>
>
> Hi all
> I would like to know how to set an order in Junit,
> Details: the Junit tests are executing from quickbuild.
> Thanks
>
>
>


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

#23813 From: "nirh20" <nir.heifetz@...>
Date: Thu Feb 23, 2012 7:29 am
Subject: Re: How to set the order in Junit
nirh20
Send Email Send Email
 
Thank you very much!
I will look on it


--- In junit@yahoogroups.com, Matthew Farwell <matthew@...> wrote:
>
> Hi,
>
> If you're asking about the ordering of tests, it's discouraged in JUnit.
> For more information, see this stackoverflow Answer:
>
>
http://stackoverflow.com/questions/7845929/has-junit4-begun-supporting-ordering-\
of-test-is-it-intentional/7846712#7846712
>
>
> Matthew Farwell.
>
> Le 22 février 2012 15:27, nirh20 <nir.heifetz@...> a écrit :
>
> > **
> >
> >
> > Hi all
> > I would like to know how to set an order in Junit,
> > Details: the Junit tests are executing from quickbuild.
> > Thanks
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>

#23814 From: "mjfarwell" <matthew@...>
Date: Sat Feb 25, 2012 6:11 am
Subject: Re: Alphabetizing test method run order?
mjfarwell
Send Email Send Email
 
Hi,

I've submitted a pull request for this
https://github.com/KentBeck/junit/pull/386.

@SortMethodsWith(MethodSorters.NAME_ASC)
public class MyTest {
}


There are four possibilities for the MethodSorters:

MethodSorters.DEFAULT: the default value, deterministic, but not predictable
MethodSorters.JVM: the order in which the tests are returned by the JVM, i.e.
there is no sorting done
MethodSorters.NAME_ASC: sorted in order of method name, ascending
MethodSorters.NAME_DESC: sorter in order of method name, descending

I would love to have feedback on this proposal.

Thanks.

Matthew Farwell.

--- In junit@yahoogroups.com, David Saff <david@...> wrote:
>
> On Thu, Sep 22, 2011 at 9:08 AM, mjfarwell <matthew@...> wrote:
> > If you change the order then at least change it so that if people have
problems due to ordering they can easily change the order. Yes, I know that
their tests are broken, but they probably do too. If the order is based upon the
hashCode, I have to either run that test with a custom Runner (and make sure
that it's usable in Eclipse, Jenkins, maven, etc. etc.)[*]. If the order is
simply the name, then all I have to do to 'fix' my problem is change the name.
>
> That's a fair request.  Actually, I think the code has evolved to the
> point that adding a feature to ParentRunner to support this would be
> remarkably easy:
>
> @RunWith(Suite.class)
> @SuiteClasses({...})
> public class MySuite {
>   @SortWith public static Sorter alpha = Sorters.ALPHABETICAL;
>   @FilterWith public static Filter category = new
> CategoryFilter(MyCategory.class);
> }
>
> Anyone want to take a crack at it?
>
>    David Saff

#23815 From: anu smina <anu_rose45@...>
Date: Sun Feb 26, 2012 11:42 am
Subject: Urgent please clear my doubts
anu_rose45
Send Email Send Email
 
I dont know how to install and run  junit. I tried different methods given in
the web. Nothing works. So please help me to run the program

1. Java is intstalled in C:\Program Files\Java\Jdk1.6.0
2. At which location should i intstall Junit( Eg: F:\)
3. If i installed JUnit in (F:\) the where should i place the program
checkforprime.java and checkforprimetest.java. In C drive or in F drive
4. Im having Windows OS.


Please send me the steps to run the program


Regards
Anu Smitha


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

#23816 From: Malte Finsterwalder <malte@...>
Date: Mon Feb 27, 2012 3:00 pm
Subject: Re: Urgent please clear my doubts
maltefinster...
Send Email Send Email
 
JUnit is a jar file, which needs to be added to your classpath. So you
can install it anywhere.
The easiest way to run junit is actually in an IDE (Eclipse, IntelliJ,
Netbeans, ...)

Greetings,
    Malte

On 26 February 2012 12:42, anu smina <anu_rose45@...> wrote:
> I dont know how to install and run  junit. I tried different methods given in
the web. Nothing works. So please help me to run the program
>
> 1. Java is intstalled in C:\Program Files\Java\Jdk1.6.0
> 2. At which location should i intstall Junit( Eg: F:\)
> 3. If i installed JUnit in (F:\) the where should i place the program
checkforprime.java and checkforprimetest.java. In C drive or in F drive
> 4. Im having Windows OS.
>
>
> Please send me the steps to run the program
>
>
> Regards
> Anu Smitha
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#23817 From: mihir jhala <mihir_933@...>
Date: Mon Feb 27, 2012 7:58 pm
Subject: Re: Urgent please clear my doubts
mihirjhala
Send Email Send Email
 
Hello,
 
Better way to work with Juint is to have IDE like eclipse.It allready has Juint
in-built in it.So you can download eclipse and when you go to
file-->new--->other---->java ---->it will have Juint option.You can create your
test cases from there.
 
 
Thanks,
Mihir


________________________________
From: anu smina <anu_rose45@...>
To: junit@yahoogroups.com
Sent: Sunday, 26 February 2012 6:42 AM
Subject: [junit] Urgent please clear my doubts


 
I dont know how to install and run  junit. I tried different methods given in
the web. Nothing works. So please help me to run the program

1. Java is intstalled in C:\Program Files\Java\Jdk1.6.0
2. At which location should i intstall Junit( Eg: F:\)
3. If i installed JUnit in (F:\) the where should i place the program
checkforprime.java and checkforprimetest.java. In C drive or in F drive
4. Im having Windows OS.

Please send me the steps to run the program

Regards
Anu Smitha

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




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

#23818 From: "mjfarwell" <matthew@...>
Date: Tue Feb 28, 2012 7:08 am
Subject: Removing methods JUnitCore#runMainAndExit and JUnitCore#runMain
mjfarwell
Send Email Send Email
 
Hi,
I've submitted a pull request to make private the methods
JUnitCore#runMainAndExit and JUnitCore#runMain
(https://github.com/KentBeck/junit/blob/master/src/main/java/org/junit/r\
unner/JUnitCore.java)
Can I ask anyone who uses these methods to say so, because we want a
small survey to see if they are used extensively. Also, if you do use
them, can you say if you could work without them. Please note that both
of these methods are marked as do not use:
/** * Do not use. Testing purposes only. * @param system  */
This is the pull request: https://github.com/KentBeck/junit/pull/370
<https://github.com/KentBeck/junit/pull/370> .
I did a quick github search, and I found two projects which use runMain
(none that use runMainAndExit):
https://github.com/gliptak/JAllele <https://github.com/gliptak/JAllele>
(multiple uses, last modification 2 years
ago)https://github.com/SteMo/Zeiterfassung_HiWis_TUD (single use)
Does anyone use these methods?
Thanks.
Matthew Farwell.






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

#23819 From: "saurav" <sauravkr@...>
Date: Tue Feb 28, 2012 2:17 am
Subject: RE: Urgent please clear my doubts
sauravkr
Send Email Send Email
 
You can put anything at any place just classpath for jars and path for java
command  should be defined.



Regards,

Saurav



From: junit@yahoogroups.com [mailto:junit@yahoogroups.com] On Behalf Of mihir
jhala
Sent: Tuesday, February 28, 2012 1:28 AM
To: junit@yahoogroups.com
Subject: Re: [junit] Urgent please clear my doubts





Hello,

Better way to work with Juint is to have IDE like eclipse.It allready has Juint
in-built in it.So you can download eclipse and when you go to
file-->new--->other---->java ---->it will have Juint option.You can create your
test cases from there.


Thanks,
Mihir

________________________________
From: anu smina <anu_rose45@... <mailto:anu_rose45%40yahoo.co.in> >
To: junit@yahoogroups.com <mailto:junit%40yahoogroups.com>
Sent: Sunday, 26 February 2012 6:42 AM
Subject: [junit] Urgent please clear my doubts


I dont know how to install and run  junit. I tried different methods given in
the web. Nothing works. So please help me to run the program

1. Java is intstalled in C:\Program Files\Java\Jdk1.6.0
2. At which location should i intstall Junit( Eg: F:\)
3. If i installed JUnit in (F:\) the where should i place the program
checkforprime.java and checkforprimetest.java. In C drive or in F drive
4. Im having Windows OS.

Please send me the steps to run the program

Regards
Anu Smitha

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

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





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

#23820 From: "sk_smile5n" <sk_smile5n@...>
Date: Wed Feb 29, 2012 10:13 am
Subject: Integrating unit tests
sk_smile5n
Send Email Send Email
 
I have multiple products/applications. Some are running on Java background and
some on .NET background.
Correspondingly unit test cases are written for both the cases.
Let us say for Java applications unit tests are written in JUNIT.
For .NET applications unit tests are written in NUNIT.

We can also assume that these tests are configured in some build tool like
ANT,Maven,NMaven etc.

My requirement is to integrate all these tests in a common framework(or a
platform) and run them in a common environment which can be User Interface or a
batch or a command.


Please let me know if am not clear with the requirement.

#23821 From: Matthew Farwell <matthew@...>
Date: Wed Feb 29, 2012 1:22 pm
Subject: Re: Integrating unit tests
mjfarwell
Send Email Send Email
 
Salut,

You can probably use jenkins for this, although I haven't done it myself. I
found the following references on the net:

Jenkins – TFS and MSBuild: http://yakiloo.com/jenkins-tfs-and-msbuild/
MSBuild + NUnit:
http://jenkins.361315.n4.nabble.com/MSBuild-NUnit-td377769.html

I would look at the jenkins docs for more information, for instance:
https://wiki.jenkins-ci.org/display/JENKINS/NUnit+Plugin

Matthew Farwell.


Le 29 février 2012 11:13, sk_smile5n <sk_smile5n@...> a écrit :

> **
>
>
> I have multiple products/applications. Some are running on Java background
> and some on .NET background.
> Correspondingly unit test cases are written for both the cases.
> Let us say for Java applications unit tests are written in JUNIT.
> For .NET applications unit tests are written in NUNIT.
>
> We can also assume that these tests are configured in some build tool like
> ANT,Maven,NMaven etc.
>
> My requirement is to integrate all these tests in a common framework(or a
> platform) and run them in a common environment which can be User Interface
> or a batch or a command.
>
> Please let me know if am not clear with the requirement.
>
>
>


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

#23822 From: "sk_smile5n" <sk_smile5n@...>
Date: Thu Mar 1, 2012 11:12 am
Subject: Re: Integrating unit tests
sk_smile5n
Send Email Send Email
 
Hi Matthew,

Thanks for your immediate response.  I basically need to integrate both Junit
and Nunit test cases in a common platform.

Else will put it in this way. There are few test cases which are in TestNG and
few with Nunit. What all the possible ways from which i can call and execute all
the unit tests? There shouldn't be to runs. On a single run both cases should
produce test results.

Thanks in advance.

--- In junit@yahoogroups.com, Matthew Farwell <matthew@...> wrote:
>
> Salut,
>
> You can probably use jenkins for this, although I haven't done it myself. I
> found the following references on the net:
>
> Jenkins – TFS and MSBuild: http://yakiloo.com/jenkins-tfs-and-msbuild/
> MSBuild + NUnit:
> http://jenkins.361315.n4.nabble.com/MSBuild-NUnit-td377769.html
>
> I would look at the jenkins docs for more information, for instance:
> https://wiki.jenkins-ci.org/display/JENKINS/NUnit+Plugin
>
> Matthew Farwell.
>
>
> Le 29 février 2012 11:13, sk_smile5n <sk_smile5n@...> a écrit :
>
> > **
> >
> >
> > I have multiple products/applications. Some are running on Java background
> > and some on .NET background.
> > Correspondingly unit test cases are written for both the cases.
> > Let us say for Java applications unit tests are written in JUNIT.
> > For .NET applications unit tests are written in NUNIT.
> >
> > We can also assume that these tests are configured in some build tool like
> > ANT,Maven,NMaven etc.
> >
> > My requirement is to integrate all these tests in a common framework(or a
> > platform) and run them in a common environment which can be User Interface
> > or a batch or a command.
> >
> > Please let me know if am not clear with the requirement.
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>

#23823 From: Hunter Hegler <jhhegler@...>
Date: Mon Mar 19, 2012 9:12 am
Subject: Naming Conventions
jhhegler
Send Email Send Email
 
Hey Everybody,

What are some naming conventions you practice for naming unit tests?  I'm
Particularly interested in how you name unit tests for overloaded methods.

Thanks,
Hunter Hegler


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

#23824 From: Malte Finsterwalder <malte@...>
Date: Mon Mar 19, 2012 3:05 pm
Subject: Re: Naming Conventions
maltefinster...
Send Email Send Email
 
I usually don't name my tests after methods I test, but rather after
the functionality to test and the result to expect.

Some examples:
aUserWithoutBonusDoesNotGetAnOffer
aUserWithBonusGetsAnOffer
wrongPasswordIsRejected

Does that help?

Greetings,
    Malte

#23825 From: Colin Vipurs <zodiaczx6@...>
Date: Mon Mar 19, 2012 4:10 pm
Subject: Re: Naming Conventions
zodiac_zx6
Send Email Send Email
 
The same as this but with the added part that we name our tests so that
class name (-Test) + test name form a coherent sentence about the
behaviour, e.g.

PasswordValidatorTest
    - rejectsPasswordLessThan8Characters
    - rejectsPasswordWithNoDigits



On Mon, Mar 19, 2012 at 3:05 PM, Malte Finsterwalder <
malte@...> wrote:

> **
>
>
> I usually don't name my tests after methods I test, but rather after
> the functionality to test and the result to expect.
>
> Some examples:
> aUserWithoutBonusDoesNotGetAnOffer
> aUserWithBonusGetsAnOffer
> wrongPasswordIsRejected
>
> Does that help?
>
> Greetings,
> Malte
>
>



--
Maybe she awoke to see the roommate's boyfriend swinging from the
chandelier wearing a boar's head.

Something which you, I, and everyone else would call "Tuesday", of course.


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

#23826 From: Tomek Kaczanowski <kaczanowski.tomek@...>
Date: Mon Mar 19, 2012 1:28 pm
Subject: Re: Naming Conventions
kaczanowski.tomek@...
Send Email Send Email
 
Rule of a thumb: do not test methods, tests classes
responsibility/behaviour. If you follow this rule, you won't have to find
names for overloaded methods, but for different responsibilities that each
of them should represent.

--
Regards / Pozdrawiam
Tomek Kaczanowski
http://practicalunittesting.com


2012/3/19 Hunter Hegler <jhhegler@...>

>
>
> Hey Everybody,
>
> What are some naming conventions you practice for naming unit tests? I'm
> Particularly interested in how you name unit tests for overloaded methods.
>
> Thanks,
> Hunter Hegler
>
> [Non-text portions of this message have been removed]
>
>
>


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

#23827 From: Georg Thimm <le_garcon_enerve@...>
Date: Tue Mar 20, 2012 10:48 am
Subject: Re: Naming Conventions
le_garcon_en...
Send Email Send Email
 
Hi!

I try to describe the expected behaviour (much like the other posts).
At some point, I included method names and aded a digit or tested behaviour, but
that was not experessive/too lengthy.

Regards,
  Georg

 
----------------------------------------------------------
Georg Thimm
Ortelsburgerstr. 16a, 21337 Lüneburg
Tel: 01577 951 7773              LinkedIn Profile: 
http://de.linkedin.com/pub/georg-thimm/14/432/78a

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

#23828 From: "Aslak" <aslak.hellesoy@...>
Date: Sun Mar 25, 2012 9:42 pm
Subject: Release 4.11?
aslak_hellesoy
Send Email Send Email
 
Hi all,

I'm about to release Cucumber-JVM 1.0.0. (a pure Java implementation for the
popular Ruby BDD tool).

Cucumber-JVM has some decent JUnit integration (a custom runner), but there is
one little snag making it a little painful to use [1]. I have submitted a pull
request for that [2].

I realise you have a lot of open tickets, and need to make sure stuff doesn't
break. I'm not saying my pull request should be treated any differently than
others. But it would be good to know whether you think it will be in 4.11 and
approximately when it's due.

Knowing it's not likely to be released any time soon would be helpful too, we'd
have to hack our way around it (we've tried before - it's hard).

Cheers,
Aslak

[1] https://github.com/KentBeck/junit/pull/405
[2] https://github.com/cucumber/cucumber-jvm/issues/225

#23829 From: "mphilipp1982" <mphilipp82@...>
Date: Fri Mar 30, 2012 6:51 pm
Subject: Request for feedback: JUnit + Hamcrest 1.3
mphilipp1982
Send Email Send Email
 
Hi,

we are currently working on making JUnit use and work with the latest version of
Hamcrest (1.3.RC2).

All but one matcher that used to be provided by JUnitMatchers are now shipped
with Hamcrest Core, i.e. CoreMatchers. Moreover, Hamcrest has introduced a
couple of signature changes for these and other matchers, including hasItem,
hasItems, both, and either. In some cases, these signature changes might cause
compiler errors.

Therefore, if you use JUnit and Hamcrest in your project, we kindly ask for your
help to try to compile and run your tests using the hamcrest-1.3 branch from
[1]. If you find any problems, please provide feedback through this mailing list
or by adding a comment to the corresponding pull request [2].

Cheers, Marc

[1] https://github.com/marcphilipp/junit/tree/hamcrest-1.3
[2] https://github.com/KentBeck/junit/pull/404

#23830 From: Dale Emery <dale@...>
Date: Fri Mar 30, 2012 7:50 pm
Subject: Re: Request for feedback: JUnit + Hamcrest 1.3
dhemery...
Send Email Send Email
 
I've been using 1.3RC2 since it came out. I haven't noticed any problems, but I
probably haven't used any of the moved matchers other than is().

Dale

--
Dale Emery
Consultant to software teams and leaders
http://dhemery.com

"It depends upon what the meaning of the word 'is' is." —William Jefferson
Clinton

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

#23831 From: "zekey99854" <steve.hostettler@...>
Date: Tue Apr 3, 2012 12:05 pm
Subject: Migration to JUnit 4.10
zekey99854
Send Email Send Email
 
Hello,

I recently migrated 4.10 and I've got the following warning in a class that
extends BlockJUnit4ClassRunner:

The method withBefores(FrameworkMethod, Object, Statement) from the type
BlockJUnit4ClassRunner is deprecated.

Here is the class
public class DerbyWeldJUnit4Runner extends WeldJUnit4Runner {
...
     /**
      * Initializes the Database state. {@inheritDoc}
      */
     @Override
     protected final Statement withBefores(final FrameworkMethod method,
             final Object target, final Statement statement) {
      ....
         return super.withBefores(method, target, statement);
     }
}

In the javadoc, it is written that I should use Rules. I have three
issues/questions regarding that  modification:

1) I use BlockJUnit4ClassRunner not to extends anything specific to the tests
2) I do not want to add @Rule in the client test class (or in a parent class)
3) The actual snippet that I used in the withBefores method uses a bunch of
objects initialized in the DerbyWeldJUnit4Runner class.

So here is my question: How can integrate the Rule without having to modify the
current client test code? Did I miss something in the design.

Many thanks in advance

#23832 From: "KandiSweetie7330" <santhoshjoy@...>
Date: Thu Apr 5, 2012 12:58 am
Subject: Junit method check
santhu_12ka4
Send Email Send Email
 
I have a Mockito code,


		 String[] activeGroupName = {"activeJob1", "activeJob2"};
		
Mockito.when(f_active.retrieveJobNames(GROUP_NAME)).thenReturn(activeGroupName);
		 String[] inactiveGroupName = {"inactiveJob1", "inactiveJob2"};
		
Mockito.when(f_inactive.retrieveJobNames(GROUP_NAME)).thenReturn(inactiveGroupNa\
me);


Same I have to write in Junit. Here GROUP_NAME is a string value. If the when
condition gets true then i have to return the String[]. Please suggest me how to
write the same code in Junit.

#23833 From: David Saff <david@...>
Date: Fri Apr 6, 2012 7:43 pm
Subject: Re: Junit method check
dsaff
Send Email Send Email
 
santhoshjoy,

JUnit does not have a built-in mocking framework.  You can use Mockito with
JUnit, so you don't need to give up your Mockito code.

    David Saff

On Wed, Apr 4, 2012 at 8:58 PM, KandiSweetie7330 <santhoshjoy@...>wrote:

> I have a Mockito code,
>
>
>                String[] activeGroupName = {"activeJob1", "activeJob2"};
>
> 
Mockito.when(f_active.retrieveJobNames(GROUP_NAME)).thenReturn(activeGroupName);
>                String[] inactiveGroupName = {"inactiveJob1",
> "inactiveJob2"};
>
> 
Mockito.when(f_inactive.retrieveJobNames(GROUP_NAME)).thenReturn(inactiveGroupNa\
me);
>
>
> Same I have to write in Junit. Here GROUP_NAME is a string value. If the
> when condition gets true then i have to return the String[]. Please suggest
> me how to write the same code in Junit.
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>


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

#23834 From: David Saff <david@...>
Date: Thu Apr 12, 2012 7:08 pm
Subject: Re: Migration to JUnit 4.10
dsaff
Send Email Send Email
 
Steve,

I think we over-aggressively deprecated withBefores.  It is unlikely to be
truly removed any time soon.  Thanks,

    David Saff

On Tue, Apr 3, 2012 at 8:05 AM, zekey99854 <steve.hostettler@...>wrote:

> Hello,
>
> I recently migrated 4.10 and I've got the following warning in a class
> that extends BlockJUnit4ClassRunner:
>
> The method withBefores(FrameworkMethod, Object, Statement) from the type
> BlockJUnit4ClassRunner is deprecated.
>
> Here is the class
> public class DerbyWeldJUnit4Runner extends WeldJUnit4Runner {
> ...
>    /**
>     * Initializes the Database state. {@inheritDoc}
>     */
>    @Override
>    protected final Statement withBefores(final FrameworkMethod method,
>            final Object target, final Statement statement) {
>     ....
>        return super.withBefores(method, target, statement);
>    }
> }
>
> In the javadoc, it is written that I should use Rules. I have three
> issues/questions regarding that  modification:
>
> 1) I use BlockJUnit4ClassRunner not to extends anything specific to the
> tests
> 2) I do not want to add @Rule in the client test class (or in a parent
> class)
> 3) The actual snippet that I used in the withBefores method uses a bunch
> of objects initialized in the DerbyWeldJUnit4Runner class.
>
> So here is my question: How can integrate the Rule without having to
> modify the current client test code? Did I miss something in the design.
>
> Many thanks in advance
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>


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

Messages 23805 - 23834 of 24384   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