Index: DynObjectFactoryTest.java
===================================================================
--- DynObjectFactoryTest.java	(revision 628)
+++ DynObjectFactoryTest.java	(revision 629)
@@ -5,6 +5,9 @@
 import java.util.GregorianCalendar;
 import java.util.Map;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.gvsig.tools.ToolsLocator;
 import org.gvsig.tools.dynobject.DynClass;
 import org.gvsig.tools.dynobject.DynObject;
@@ -15,8 +18,6 @@
 import org.gvsig.tools.persistence.exception.PersistenceException;
 import org.gvsig.tools.persistence.exception.PersistenceTypeNotSupportedException;
 import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class DynObjectFactoryTest extends AbstractBasicTest {
 
@@ -25,7 +26,7 @@
 
 	private static int counter = 0;
 
-	protected static final String OBJ1_NAME = "MyObjectBasicTypes";
+	protected String OBJ1_NAME = "MyObjectBasicTypes";
 	protected DynObjectManager dynManager;
 
 	private static Date getDate() {
@@ -39,47 +40,62 @@
 	}
 
 	protected void register() throws Exception {
-		if(this.manager.getDynObjectDefinition(OBJ1_NAME)==null){
+		if (this.manager.getDynObjectDefinition(OBJ1_NAME) == null) {
 			InputStream resource = this
-			.getClass()
-			.getClassLoader()
-			.getResourceAsStream(
-			"org/gvsig/tools/persistence/BasicTypes2Test.xml");
-			
-			Map definitions = this.dynManager.importDynClassDefinitions(resource, null);
-			DynClass dynStruct = (DynClass)definitions.get(OBJ1_NAME);
+					.getClass()
+					.getClassLoader()
+					.getResourceAsStream(
+							"org/gvsig/tools/persistence/BasicTypes2Test.xml");
+
+			Map definitions = this.dynManager.importDynClassDefinitions(
+					resource, null);
+			DynClass dynStruct = (DynClass) definitions.get(OBJ1_NAME);
 			this.manager.addDefinition(dynStruct, null, null);
 		}
 
 	}
-	
-	private DynObject createDynObject1(){
-		DynObject obj = this.dynManager.createDynObject(OBJ1_NAME, PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE);
-		float value = (counter/3)*700;
 
-		obj.setDynValue("a", new Integer((int)value));
+	protected DynObject createDynObject1() {
+		return createDynObject1(OBJ1_NAME);
+	}
+
+	protected DynObject createDynObject1(String name) {
+		DynObject obj = this.dynManager.createDynObject(name,
+				PersistenceManager.PERSISTENCE_DYNOBJECT_NAMESPACE);
+		float value = (counter / 3) * 700;
+
+		obj.setDynValue("a", new Integer((int) value));
 		obj.setDynValue("b", new Long((long) value));
 		obj.setDynValue("c", new Double(value));
 		obj.setDynValue("d", new Float(value));
-		obj.setDynValue("e", new Boolean((counter%2) == 0));
+		obj.setDynValue("e", new Boolean((counter % 2) == 0));
 		obj.setDynValue("f", String.valueOf(value));
 		obj.setDynValue("g", getDate());
-		
+
 		counter++;
-		
+
 		return obj;
 	}
 
 	void check(DynObject obj1, DynObject obj2) {
-		assertEquals("int value mistmach", obj1.getDynValue("a"), obj2.getDynValue("a"));
-		assertEquals("long value mistmach", obj1.getDynValue("b"), obj2.getDynValue("b"));
-		assertEquals("double value mistmach", ((Double)obj1.getDynValue("c")).doubleValue(), ((Double)obj2.getDynValue("c")).doubleValue(),0.01);
-		assertEquals("float value mistmach", ((Float)obj1.getDynValue("d")).floatValue(), ((Float)obj2.getDynValue("d")).floatValue(), 0.01);
-		assertEquals("boolean value mistmach", obj1.getDynValue("e"), obj2.getDynValue("e"));
-		assertEquals("String value mistmach", obj1.getDynValue("f"), obj2.getDynValue("f"));
-		assertTrue("Date value mistmach", obj1.getDynValue("g").equals(obj2.getDynValue("g")));
+		assertEquals("int value mistmach", obj1.getDynValue("a"),
+				obj2.getDynValue("a"));
+		assertEquals("long value mistmach", obj1.getDynValue("b"),
+				obj2.getDynValue("b"));
+		assertEquals("double value mistmach",
+				((Double) obj1.getDynValue("c")).doubleValue(),
+				((Double) obj2.getDynValue("c")).doubleValue(), 0.01);
+		assertEquals("float value mistmach",
+				((Float) obj1.getDynValue("d")).floatValue(),
+				((Float) obj2.getDynValue("d")).floatValue(), 0.01);
+		assertEquals("boolean value mistmach", obj1.getDynValue("e"),
+				obj2.getDynValue("e"));
+		assertEquals("String value mistmach", obj1.getDynValue("f"),
+				obj2.getDynValue("f"));
+		assertTrue("Date value mistmach",
+				obj1.getDynValue("g").equals(obj2.getDynValue("g")));
 	}
-	
+
 	public void testRegisterFactory() throws Exception {
 		register();
 	}
@@ -92,19 +108,21 @@
 			assertNotNull("Can't retrieve state", state);
 			DynStruct definition = state.getDefinition();
 			assertNotNull("Can't register class", definition);
-			assertEquals("Registration don't work, name incorrect", OBJ1_NAME,
-					definition.getName());
+			assertEquals("Registration doesn't work, incorrect name", obj
+					.getDynClass().getName(), definition.getName());
 		} catch (BaseException ex) {
 			logger.warn(ex.getMessageStack(), ex);
 			throw ex;
 		}
 	}
-	
-	public void testSetState() throws PersistenceTypeNotSupportedException, PersistenceClassNotRegistered, PersistenceException, PersistenceValidateExceptions {
+
+	public void testSetState() throws PersistenceTypeNotSupportedException,
+			PersistenceClassNotRegistered, PersistenceException,
+			PersistenceValidateExceptions {
 		DynObject obj1 = createDynObject1();
 		PersistentState state = manager.getState(obj1);
 		assertNotNull("Can't retrieve state", state);
-		
+
 		DynObject obj2 = (DynObject) manager.create(state);
 		check(obj1, obj2);
 	}
@@ -118,8 +136,8 @@
 		DynObject obj1 = createDynObject1();
 		PersistentState state = this.saveAndRestoreState(obj1);
 		DynObject obj2 = (DynObject) manager.create(state);
-		
-		check(obj1, obj2);		
+
+		check(obj1, obj2);
 	}
 
 	protected String getTestId() {
@@ -127,5 +145,4 @@
 
 	}
 
-
 }
