A unit test extention.;Making unit testing of POJO's / DTO's / Beans and;Immutable beans easy
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
README
pom.xml

README

===============================================================================
= beanunit
===============================================================================
Is a unit test extension for automated testing of beans.

The best way to demonstrate the working of this project is to look at the unit
tests.

Check out or download the master or one of the latest tags and see for yourself.

If you have great ideas for extending or improving the code please contact me.
Collaborators are welcome.


Cheerz,
Ivo.

Twitter: @IvoNet (or #beanunit in the sentence)
Contact: http://www.ivonet.nl/home/contact

===============================================================================
- License / Copyright
===============================================================================
Copyright 2011 Ivo Woltring

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

===============================================================================
= GOAL
===============================================================================
The goal of this jar is to perform automated useful unit tests on "simple" beans
of different kinds.
* methods that makes easy work of testing default behavior pojos (beans).
* methods for testing beans that are immutable after construction.
* Asserts "simple" beans that are constructed using the "Builder" pattern as
  documented by Joshua Bloch ("Effective Java" - Second Edition).
  (see builder package in src/test/java)


The actual goal is to make useful unit tests for objects everybody hates to test
because they seem so easy to make.
This way there is much more tested on these simple objects without sacrificing
anything.
Test coverage is 100% in many cases with almost no effort and I would claim
that the tests are useful.

===============================================================================
= Prerequisites
===============================================================================
* Maven 2 or 3. I build with maven 3 but at this time version 2 also works
* Java 1.6 (should there be a 1.5 build to?)

 ===============================================================================
= RULEZ
===============================================================================
The tests done on the beans are described below...

===============================================================================
== Builder
===============================================================================
* A Builder has only one constructor
* A Builder constructor can have parameters (for mandatory properties)
* A Builder has a build() method if no other is provided
* Builder methods always have as the return type the Builder itself (this)
* After the build method is called the resulting Object is immutable.
* Can override equals / hashcode

===============================================================================
== POJO
===============================================================================
* Default constructor
* Bean specification (Getters and Setters for all properties)
* if equal method overridden / hashCode method must also be overridden in the
  same class
* if objects are equal the hashCode must also be equal

===============================================================================
== Immutable constructed beans
===============================================================================
* Must be completely constructed by a constructor
* Must only have Getters after construction
* Can override equals / hashcode

===============================================================================
= Usage
===============================================================================
This project is synced to the maven central repository so you can add it as a
dependency to your maven project.

More explanation here: http://ivonet.github.com/beanunit/
===============================================================================
= Whishes
===============================================================================
* Add null tests for the CIBA class?
* Automated testing of enums? is it possible / necessary?
* Is testing of the toString() method an option.
** Test if toString does something else then Object.toString.