by Anonymous
tags:
border:

 

by andrew
border:

 Mockito really helps when you want to make white box testing. In addition to testing the results of some code, you can make sure that the code makes necessary method calls during its execution. 

For example, the following method prints the current time:

by ittayd
border:

http://code.google.com/p/junitparams/

 

This project adds a new runner to JUnit and provides much easier and readable parameterised tests for JUnit >=4.5.

 

For example:

@Test
@Parameters({ 
            "17, false", 
            "22, true" })
public void personIsAdult(int age, boolean valid) throws Exception {
    assertThat(new Person(age).isAdult(), is(valid));
}

 

by roni
tags:
border:

When I wrote a JUnit class for testing inprocess FTP server, I'd like to startup the server when the class initiates and shutdown when the class is being destroyed.

I saw it is pretty easy with JUnit 4 annotations to use the @BeforeClass and @AfterClass above the startup and shutdown methods, and insert the required actions inside them.

tags:
border:

how do i save the testing results to xml when running junit4 from the command line? i need this xml to be in the standard format that the eclipse junit plugin allows to open and view...

10x,
Sagi

by hila
tags:
border:

Hi,

I'm building a filter (well it's a complicated one) and need to test it with JUnit in eclipse. I need to mock request and response.

Does anyone know how? I heard about easyMock, is it any good ?

I need something simple as I'm not building this whole web application with million of screens and objects.