Index: trunk/testsrc/ws/fugue88/ContextTest.java
===================================================================
--- trunk/testsrc/ws/fugue88/ContextTest.java	(revision 5)
+++ trunk/testsrc/ws/fugue88/ContextTest.java	(revision 5)
@@ -0,0 +1,191 @@
+/*
+ * Created on Aug 2, 2005
+ * 
+ * $Log$
+ * Revision 1.1  2005/08/19 17:51:17  dsowen
+ * Fixed: NPEs when using accessors from paths, &c.  Included tests.
+ * Fixed: parsing exception wasn't very enlightening.
+ *
+ * Revision 1.2  2005/08/12 19:01:46  dsowen
+ * Feature: can automatically fill missing parts of a graph.
+ *
+ * Revision 1.1  2005/08/03 00:35:29  dsowen
+ * Initial commit.
+ *
+ */
+package ws.fugue88;
+
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+import ws.fugue88.jpath.Accessor;
+import ws.fugue88.jpath.Context;
+import ws.fugue88.jpath.ContextFactory;
+import ws.fugue88.jpath.Path;
+
+/**
+ * @author dsowen
+ */
+public class ContextTest extends TestCase {
+
+	public void testFieldIdentifier() throws Exception
+	{
+		class A {
+
+			String b = "test";
+		}
+		A a = new A();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createContext(a);
+		assertSame(a.b, context.getTarget(new Path("/b")));
+
+		Accessor accessor = context.getTargetAccessor(new Path("/b"));
+		assertSame(a.b, accessor.getValue());
+		accessor.setValue("done");
+		assertEquals("done", accessor.getValue());
+		assertEquals("done", a.b);
+	}
+
+	public void testGetterIdentifier() throws Exception
+	{
+		class A {
+
+			String getB()
+			{
+				return "test";
+			}
+		}
+		A a = new A();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createContext(a);
+		assertEquals("test", context.getTarget(new Path("/b")));
+		try {
+			context.getTargetAccessor(new Path("/b")).setValue("done");
+			assertTrue(false);
+		} catch(UnsupportedOperationException e) {}
+	}
+
+	public void testGetterSetterIdentifier() throws Exception
+	{
+		class A {
+
+			String getB()
+			{
+				return x;
+			}
+
+			void setB(String s)
+			{
+				x = s;
+			}
+
+			String x = "test";
+		}
+		A a = new A();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createContext(a);
+		assertEquals("test", context.getTarget(new Path("/b")));
+		context.getTargetAccessor(new Path("/b")).setValue("done");
+		assertEquals("done", a.getB());
+	}
+
+	public void testKey() throws Exception
+	{
+		class A {
+
+			HashMap b = new HashMap();
+
+			A()
+			{
+				b.put("c", "test");
+			}
+		}
+		A a = new A();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createContext(a);
+		assertEquals("test", context.getTarget(new Path("/b['c']")));
+		context.getTargetAccessor(new Path("/b['c']")).setValue("done");
+		assertEquals("done", a.b.get("c"));
+	}
+
+	public void testEarlyNull() throws Exception
+	{
+		class A {
+
+			String s;
+		}
+		class B {
+
+			A a;
+		}
+		B b = new B();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createContext(b);
+		assertNull(context.getTarget(new Path("/a/s")));
+		assertNull(b.a);
+	}
+
+	static class A {
+
+		String s;
+	}
+
+	public void testAutoGraphTargets() throws Exception
+	{
+		class B {
+
+			A a;
+		}
+		B b = new B();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createModifyingContext(b);
+		assertNull(context.getTarget(new Path("/a/s")));
+		assertNotNull(b.a);
+		assertNull(b.a.s);
+	}
+
+	public void testAutoGraphAccessors() throws Exception
+	{
+		class B {
+
+			A a;
+		}
+		B b = new B();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createModifyingContext(b);
+		Accessor accessor = context.getTargetAccessor(new Path("/a/s"));
+		assertNotNull(b.a);
+		assertNull(b.a.s);
+	}
+
+	private static class PrivateClass {
+
+		String s;
+
+		private PrivateClass()
+		{
+		}
+	}
+
+	public void testConstructPrivate() throws Exception
+	{
+		class B {
+
+			PrivateClass x;
+		}
+		B b = new B();
+
+		ContextFactory factory = new ContextFactory();
+		Context context = factory.createModifyingContext(b);
+		assertNull(context.getTarget(new Path("/x/s")));
+		assertNotNull(b.x);
+		assertNull(b.x.s);
+	}
+}
Index: trunk/testsrc/ws/fugue88/jpath/ContextTest.java
===================================================================
--- trunk/testsrc/ws/fugue88/jpath/ContextTest.java	(revision 4)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Created on Aug 2, 2005
- * 
- * $Log$
- * Revision 1.2  2005/08/12 19:01:46  dsowen
- * Feature: can automatically fill missing parts of a graph.
- *
- * Revision 1.1  2005/08/03 00:35:29  dsowen
- * Initial commit.
- *
- */
-package ws.fugue88.jpath;
-
-import java.util.HashMap;
-
-import junit.framework.TestCase;
-
-/**
- * @author dsowen
- */
-public class ContextTest extends TestCase {
-
-	public void testFieldIdentifier() throws Exception
-	{
-		class A {
-
-			String b = "test";
-		}
-		A a = new A();
-
-		ContextFactory factory = new ContextFactory();
-		Context context = factory.createContext(a);
-		assertSame(a.b, context.getTarget(new Path("/b")));
-
-		Accessor accessor = context.getTargetAccessor(new Path("/b"));
-		assertSame(a.b, accessor.getValue());
-		accessor.setValue("done");
-		assertEquals("done", accessor.getValue());
-		assertEquals("done", a.b);
-	}
-
-	public void testGetterIdentifier() throws Exception
-	{
-		class A {
-
-			String getB()
-			{
-				return "test";
-			}
-		}
-		A a = new A();
-
-		ContextFactory factory = new ContextFactory();
-		Context context = factory.createContext(a);
-		assertEquals("test", context.getTarget(new Path("/b")));
-		try {
-			context.getTargetAccessor(new Path("/b")).setValue("done");
-			assertTrue(false);
-		} catch(UnsupportedOperationException e) {}
-	}
-
-	public void testGetterSetterIdentifier() throws Exception
-	{
-		class A {
-
-			String getB()
-			{
-				return x;
-			}
-
-			void setB(String s)
-			{
-				x = s;
-			}
-
-			String x = "test";
-		}
-		A a = new A();
-
-		ContextFactory factory = new ContextFactory();
-		Context context = factory.createContext(a);
-		assertEquals("test", context.getTarget(new Path("/b")));
-		context.getTargetAccessor(new Path("/b")).setValue("done");
-		assertEquals("done", a.getB());
-	}
-
-	public void testKey() throws Exception
-	{
-		class A {
-
-			HashMap b = new HashMap();
-
-			A()
-			{
-				b.put("c", "test");
-			}
-		}
-		A a = new A();
-
-		ContextFactory factory = new ContextFactory();
-		Context context = factory.createContext(a);
-		assertEquals("test", context.getTarget(new Path("/b['c']")));
-		context.getTargetAccessor(new Path("/b['c']")).setValue("done");
-		assertEquals("done", a.b.get("c"));
-	}
-
-	public void testEarlyNull() throws Exception
-	{
-		class A {
-
-			String s;
-		}
-		class B {
-
-			A a;
-		}
-		B b = new B();
-
-		ContextFactory factory = new ContextFactory();
-		Context context = factory.createContext(b);
-		assertNull(context.getTarget(new Path("/a/s")));
-		assertNull(b.a);
-	}
-
-	static class A {
-
-		String s;
-	}
-
-	public void testAutoGraph() throws Exception
-	{
-		class B {
-
-			A a;
-		}
-		B b = new B();
-
-		ContextFactory factory = new ContextFactory();
-		Context context = factory.createModifyingContext(b);
-		assertNull(context.getTarget(new Path("/a/s")));
-		assertNotNull(b.a);
-		assertNull(b.a.s);
-	}
-}
