Skip to content

Instantly share code, notes, and snippets.

@niclash
Created February 18, 2012 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niclash/1856867 to your computer and use it in GitHub Desktop.
Save niclash/1856867 to your computer and use it in GitHub Desktop.
ValueBuilder Testcase
@Test
public void testInner()
{
ValueBuilder<InnerValue> innerBuilder = module.newValueBuilder( InnerValue.class );
InnerValue inner = innerBuilder.prototype();
List<String> list = inner.listProp().get();
list.add( "Qi4j" );
inner.mapProp().set( new HashMap<String, String>() );
inner = innerBuilder.newInstance();
// If we reach this point, value creation went well
try
{
inner.listProp().get().add( "Should be immutable now!" ); // Must not be allowed
fail( "List is not immutable!");
} catch( Exception e )
{
// expected
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment