Introduction

The WOUnit framework contains a set of utilities for testing WebObjects applications using JUnit 4.7 or later capabilities. This library can be useful if you write unit/integration tests for Enterprise Objects or employ the TDD technique on your projects.

WOUnit is free software released under the Apache 2 license. Visit the WOUnit website for more information and a complete guide on how to use this framework.

Usage

Here is a brief example that demonstrates some of the features of WOUnit: rules, special annotations and specific matchers for assertion.

import static com.wounit.matchers.EOAssert.*;
import com.wounit.rules.MockEditingContext;
import com.wounit.annotations.Dummy;
import com.wounit.annotations.UnderTest;

public class FooTest {
    @Rule
    public MockEditingContext ec = new MockEditingContext("MyModel");

    @Dummy
    private Bar dummyBar;

    @UnderTest
    private Foo foo;

    @Test
    public void cantSaveFooWithOnlyOneBar() {
        foo.addToBarRelationship(dummyBar);

        confirm(foo, cannotBeSavedBecause("Foo must have at least 2 bars related to it"));
    }
}