JUnit

How to set expectation on void method using easymocks?

November 2, 2009
By admin

Use EasyMock.expectLastCall() method to set expectation on void methods. eg. mock.documentChanged(“Document”); expectLastCall().times(3);
Read more »

Tags:
Posted in EasyMock, J2EE, JUnit | No Comments »

When are tests garbage collected?

April 16, 2009
By admin

By design, the tree of Test instances is built in one pass, then the tests are executed in a second pass. The test runner holds strong references to all Test instances for the duration of the test execution. This means that for a very long test run with many Test instances, none of the...
Read more »

Tags: , , ,
Posted in JUnit | No Comments »

Do I need to write a test class for every class I need to test?

April 16, 2009
By admin

No. It is a convention to start with one test class per class under test, but it is not necessary. Test classes only provide a way to organize tests, nothing more. Generally you will start with one test class per class under test, but then you may find that a small group of tests...
Read more »

Tags: , , ,
Posted in JUnit | No Comments »

How do I test things that must be run in a J2EE container (e.g. servlets, EJBs)?

April 16, 2009
By admin

Refactoring J2EE components to delegate functionality to other objects that don’t have to be run in a J2EE container will improve the design and testability of the software. Cactus is an open source JUnit extension that can be used to test J2EE components in their natural environment.
Read more »

Tags: , , ,
Posted in JUnit | No Comments »

Why does JUnit only report the first failure in a single test?

April 16, 2009
By admin

Reporting multiple failures in a single test is generally a sign that the test does too much, compared to what a unit test ought to do. Usually this means either that the test is really a functional/acceptance/customer test or, if it is a unit test, then it is too big a unit test. JUnit...
Read more »

Tags: , , ,
Posted in JUnit | No Comments »

Calendar

    September 2010
    M T W T F S S
    « Jul    
     12345
    6789101112
    13141516171819
    20212223242526
    27282930