/**
 * LICENSE INFORMATION
 * 
 * Copyright 2005-2008 by FZI (http://www.fzi.de). Licensed under a BSD license
 * (http://www.opensource.org/licenses/bsd-license.php) <OWNER> = Max Völkel
 * <ORGANIZATION> = FZI Forschungszentrum Informatik Karlsruhe, Karlsruhe,
 * Germany <YEAR> = 2010
 * 
 * Further project information at http://semanticweb.org/wiki/RDF2Go
 */

package org.ontoware.rdf2go.model;

import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;


/**
 * @author sauermann
 */
public class SyntaxTest extends TestCase {
	
	/**
	 * @see junit.framework.TestCase#setUp()
	 */
	@Override
	protected void setUp() throws Exception {
		super.setUp();
	}
	
	/**
	 * @see junit.framework.TestCase#tearDown()
	 */
	@Override
	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	/**
	 * Test method for
	 * {@link org.ontoware.rdf2go.model.Syntax#register(org.ontoware.rdf2go.model.Syntax)}
	 * .
	 */
	public void testRegister() {
		Syntax s = new Syntax("spargel", "application/spargel", ".spargel");
		Syntax.register(s);
		Syntax s1 = Syntax.forMimeType("application/spargel");
		assertEquals(s, s1);
	}
	
	/**
	 * Test method for
	 * {@link org.ontoware.rdf2go.model.Syntax#forName(java.lang.String)}.
	 */
	public void testForName() {
		Syntax.resetFactoryDefaults();
		Syntax s = Syntax.forName("rdfxml");
		assertNotNull(s);
		assertEquals("rdfxml", s.getName());
	}
	
	/**
	 * Test method for
	 * {@link org.ontoware.rdf2go.model.Syntax#forMimeType(java.lang.String)}.
	 */
	public void testForMimeType() {
		Syntax.resetFactoryDefaults();
		Syntax s = Syntax.forMimeType("application/x-turtle");
		assertNotNull(s);
		assertEquals("application/x-turtle", s.getMimeType());
	}
	
	/**
	 * Test method for
	 * {@link org.ontoware.rdf2go.model.Syntax#unregister(org.ontoware.rdf2go.model.Syntax)}
	 * .
	 */
	public void testUnregister() {
		Syntax.resetFactoryDefaults();
		Syntax.unregister(Syntax.Ntriples);
		Syntax s = Syntax.forName("ntriples");
		assertNull(s);
	}
	
	/**
	 * Test method for {@link org.ontoware.rdf2go.model.Syntax#list()}.
	 */
	public void testList() {
		Syntax.resetFactoryDefaults();
		List<Syntax> list = Syntax.list();
		// check overall number
		assertEquals(6, list.size());
		ArrayList<Syntax> l = new ArrayList<Syntax>(list);
		// remove just a few
		l.remove(Syntax.Ntriples);
		l.remove(Syntax.RdfXml);
		l.remove(Syntax.Nquads);
		assertTrue(0 < l.size());
	}
	
	public void testCreateList() {
		List<Syntax> SYNTAXES = new ArrayList<Syntax>();
		SYNTAXES.size();
	}
	
}

@@ -1017,26 +1017,78 @@
 gister() %7B%0D%0A
-%09%09
+    %09int numSyntaxes = Syntax.list().size();%0D%0A        
 Syntax s = n
@@ -1141,26 +1141,32 @@
 spargel%22);%0D%0A
-%09%09
+        
 Syntax.regis
@@ -1170,26 +1170,32 @@
 gister(s);%0D%0A
-%09%09
+        
 Syntax s1 = 
@@ -1234,26 +1234,32 @@
 spargel%22);%0D%0A
-%09%09
+        
 assertEquals
@@ -1263,13 +1263,209 @@
 als(
-s, s1
+%22Check if the newly registered sytax can be properly retrieved.%22, s, s1);%0D%0A        assertEquals(%22After registering a new syntax, check the overall number again.%22, numSyntaxes + 1,  Syntax.list().size()
 );%0D%0A
@@ -2602,28 +2602,119 @@
 als(
-6, list.size());%0D%0A%09%09
+%22Check for the expected number of syntaxes%22, 6, list.size());%0D%0A        int numSyntaxes = list.size();%0D%0A        
 Arra
@@ -2761,18 +2761,24 @@
 list);%0D%0A
-%09%09
+        
 // remov
@@ -2795,40 +2795,16 @@
 ew%0D%0A
-%09%09l.remove(Syntax.Ntriples);%0D%0A%09%09
+        
 l.re
@@ -2825,18 +2825,24 @@
 fXml);%0D%0A
-%09%09
+        
 l.remove
@@ -2863,24 +2863,118 @@
 );%0D%0A
-%09%09assertTrue(0 %3C
+        assertEquals(%22After removing a number of syntaxes, check the overall number again.%22, numSyntaxes - 2, 
  l.s
@@ -2974,32 +2974,34 @@
 2,  l.size());%0D%0A
+%0D%0A
 %09%7D%0D%0A%09%0D%0A%09public v

Update issue #11 COMMENT-TEXT Added some beautification to the SyntaxTest