}
@Test
public void to_string() throws Exception
{
ClassFab cf = newClassFab("FredRunnable", BaseLocatable.class);
cf.addInterface(Runnable.class);
cf.addInterface(Serializable.class);
cf.addField("_map", Map.class);
cf.addConstructor(new Class[] { Map.class, Runnable.class },
new Class[] { IllegalArgumentException.class, DataFormatException.class }, "{ _map = $1; }");
MethodSignature sig = new MethodSignature(Map.class, "doTheNasty", new Class[] { int.class, String.class },
new Class[] { InstantiationException.class,
IllegalAccessException.class });
cf.addMethod(Modifier.PUBLIC + Modifier.FINAL + Modifier.SYNCHRONIZED, sig, "{ return _map; }");
String toString = cf.toString();
assertContains(toString,
"public class FredRunnable extends " + BaseLocatable.class.getName() + "\n" + " implements java.lang.Runnable, java.io.Serializable");
assertContains(toString, "private java.util.Map _map;");