junit-objects (JO) is a regression testing and profiling framework for Java objects

junit-objects is different from Junit in that it allows you to assert the state of objects and design patterns rather than the result of method calls. It should be seen as a replacement for previous unit testing frameworks.


  • junit-objects focuses on testing objects: their structure, state and behavior
  • An object's state is asserted with testing protocols. For instance, the following asserts that an object has isTrue set as true; and that myString matches the regular expression "[junit]{4}-[objects]*"

    <object-state name="sampleState">

  • JO greatly reduces the amount of code in a unit-test in this manner; allowing you to "bolt on" (and reuse) assertion sequences anywhere, with no change to your test methods
  • When an object changes state (its properties and behavior), you can assert that the change is deterministic and well-behaved
  • JO profiles let you assert design patterns and anti-patterns to keep your objects consistent and well-behaved
  • Also use JO profiling to root out design entropy (let JO suggest where objects may benefit from using a particular design pattern)

Start Using JO

Find out more about JO features...
Getting started with junit-objects
Writing your first test with junit-objects
Full guide to unit-testing with junit-objects

Other Benefits of JO Over Junit

  • Unit testing is more structured and object-oriented with JO
  • XML-based test configuration makes reuse and redeployment easy
  • Assertion protocols make JO tests readable and expressive
  • Flexible assertion protocols (such as ognl) greatly reduce amount of code needed to create a test
  • Runtime Metaphors (equivalent of junit testXXX() methods) mimic the application, while test sequences can be bolted on or off
  • JO provides sophisticated "hotswappable" mock objects without needing code
  • JO helps you maintain design integrity in your code with object and entropy profiling
GetJava Download Button Logo
Support This Project