/**
 * 
 */
package net.ontopia.topicmaps.impl.tmapi2.test;

import junit.framework.TestCase;

import org.tmapi.core.Locator;
import org.tmapi.core.Occurrence;
import org.tmapi.core.TMAPIException;
import org.tmapi.core.Topic;
import org.tmapi.core.TopicMap;
import org.tmapi.core.TopicMapSystem;
import org.tmapi.core.TopicMapSystemFactory;

/**
 * @author niederhausen
 *
 */
public class LocatorExternalFormTest extends TestCase {

	public void testLocatorExternalForm() throws TMAPIException {
		 String male = "http://www.ex%25-st.com";
		   TopicMapSystemFactory factory = TopicMapSystemFactory.newInstance();
		   TopicMapSystem sys = factory.newTopicMapSystem();
		   TopicMap tm = sys.createTopicMap("foo:baa");
		   Topic t = tm.createTopic();
		   Locator l = tm.createLocator(male);
		   Occurrence o = t.createOccurrence(tm.createTopic(), l, tm.createTopic());
		   try {
		     o.locatorValue().toExternalForm();
		   } catch (NullPointerException e) {
		     fail("NullPointerException occurred");
		   }
	}
}

@@ -340,43 +340,8 @@
 y;%0A%0A
-/**%0A * @author niederhausen%0A *%0A */%0A
 publ
@@ -459,16 +459,18 @@
 on %7B%0A%09%09 
+  
 String m
@@ -499,16 +499,17 @@
 5-st.com
+/
 %22;%0A%09%09   
@@ -756,16 +756,73 @@
 (male);%0A
+%09%09   %0A%09%09   assertEquals(male, l.toExternalForm());%0A%09%09   %0A
 %09%09   Occ
@@ -901,148 +901,353 @@
 %09   
+S
 tr
-y %7B%0A%09%09     o.locatorValue().toExternalForm();%0A%09%09   %7D catch (NullPointerException e) %7B%0A%09%09     fail(%22NullPointerException occurred%22
+ing locString = o.getValue();%0A%09%09   assertEquals(male, locString);%0A%09%09   %0A%09%09   // try to create a locator form value by hand%0A%09%09   Locator l2 = tm.createLocator(locString);%0A%09%09   assertEquals(male, l2);%0A%09%09   %0A%09%09   %0A%09%09   Locator loc = o.locatorValue();%0A%09%09   assertNotNull(loc);%0A%09%09  %0A%09%09   assertEquals(male, o.locatorValue().toExternalForm()
 );%0A%09%09  
- %7D
 %0A%09%7D%0A

test update for issue 225