Overview

This is a tool that simplifies testing by allowing one to create test interface implementations from a yml object definition.

Usage

For example, consider the following interfaces:

public interface SomeInterface {
	String getName();
	int getIntValue();
	SomeOtherInterface getRelatedObject();
}

public interface SomeOtherInterface {
	String getOtherName();
	Collection<SomeInterface> getLotsOfStuff();
}

One can easily piece together a definition of all of these objects using the following yml definition:

--- !SomeInterface
  name: my name
  intValue: 925
  relatedObject:
    otherName: other name
    lotsOfStuff: !SomeInterface
      - name: look, nested name
        intValue: 1
      - name: look, another nested name
        intValue: 2

If the above file is in /tmp/test.yml, then the following code should work:

YamlMock<SomeInterface> ym=new YamlMock<SomeInterface>(SomeInterface.class);

FileReader fr=new FileReader("/tmp/test.yml");
try {
	SomeInterface si=ym.create(fr);

	// The following will print ``my name'':
	System.out.println(si.getName());

	// The following will print ``nested name'':
	System.out.println(si.getRelatedObject().iterator().next().getName());
} finally {
	fr.close();
}

See the the API docs for more details.

Where to Get

Binary Distributions

My maven 1 repository has the latest binary version here:

http://bleu.west.spy.net/~dustin/repo/

Source Code

The source can be downloaded or checked out from my mercurial repository.

Dependencies

This project is built on the JvYAML parser.

License

This project is released under the MIT license.