package com.opcoach.genmodeladdon.core.test;


import static org.junit.Assert.*;

import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.common.util.URI;
import org.junit.Test;

import com.opcoach.genmodeladdon.core.GenerateCommon;

public class TestGenerateCommon extends GenModelAddonTestCase
{
	private static final String PROJECT_SAMPLE_NAME = "com.opcoach.genmodeladdon.sample";

	@Test
	public void testGetProjectNameFromLinuxURI()
	{
		URI u = URI.createURI("/Users/olivier/Documents/OPCoach/workspaces/junit-genmodeladdon/com.opcoach.genmodeladdon.sample/model/project.genmodel");
		String s = GenerateCommon.getProjectNameFromURI(u);
		assertEquals("Project name must be " + PROJECT_SAMPLE_NAME, s, PROJECT_SAMPLE_NAME);
	}

	@Test
	public void testGetProjectNameFromFileURI()
	{
		URI u = URI.createURI("file:/Users/olivier/Documents/OPCoach/workspaces/junit-genmodeladdon/com.opcoach.genmodeladdon.sample/model/project.genmodel");
		String s = GenerateCommon.getProjectNameFromURI(u);
		assertEquals("Project name must be " + PROJECT_SAMPLE_NAME, s, PROJECT_SAMPLE_NAME);
	}
	
	
	@Test
	public void testGetProjectNameFromWindowsFileURI()
	{
		URI u = URI.createURI("file:/C:/Users/olivier/Documents/OPCoach/workspaces/junit-genmodeladdon/com.opcoach.genmodeladdon.sample/model/project.genmodel");
		String s = GenerateCommon.getProjectNameFromURI(u);
		assertEquals("Project name must be " + PROJECT_SAMPLE_NAME, s, PROJECT_SAMPLE_NAME);
	}


	@Test
	public void testGetProjectNameFromProjectGenModel()
	{
		GenModel gm = getGenModel(PROJECT_GENMODEL);
		String s = GenerateCommon.getProjectName(gm);
		assertEquals("Project name must be " + PROJECT_SAMPLE_NAME, s, PROJECT_SAMPLE_NAME);
	}
	
	@Test
	public void testGetProjectNameFromFannoiseGenModel()
	{
		GenModel gm = getGenModel(FANNOISE_GENMODEL);
		String s = GenerateCommon.getProjectName(gm);
		assertEquals("Project name must be " + PROJECT_SAMPLE_NAME, s, PROJECT_SAMPLE_NAME);
	}
	

}

@@ -1470,16 +1470,373 @@
 E);%0A%09%7D%0A%0A
+%09@Test%0A%09public void testGetProjectNameFromWindowsPathURI()%0A%09%7B%0A%09%09URI u = URI.createURI(%22C:/Users/olivier/Documents/OPCoach/workspaces/junit-genmodeladdon/com.opcoach.genmodeladdon.sample/model/project.genmodel%22);%0A%09%09String s = GenerateCommon.getProjectNameFromURI(u);%0A%09%09assertEquals(%22Project name must be %22 + PROJECT_SAMPLE_NAME, s, PROJECT_SAMPLE_NAME);%0A%09%7D%0A%0A
 %0A%09@Test%0A

Add another test without test