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 testGetProjectNameFromWindowsPathURI()
	{
		URI u = URI.createURI("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);
	}
	

}

@@ -713,35 +713,32 @@
 ECT_SAMPLE_NAME,
- s,
  PROJECT_SAMPLE_
@@ -733,32 +733,35 @@
 JECT_SAMPLE_NAME
+, s
 );%0A%09%7D%0A%0A%09@Test%0A%09p
@@ -1066,35 +1066,32 @@
 ECT_SAMPLE_NAME,
- s,
  PROJECT_SAMPLE_
@@ -1086,32 +1086,35 @@
 JECT_SAMPLE_NAME
+, s
 );%0A%09%7D%0A%09%0A%09%0A%09@Test
@@ -1432,35 +1432,32 @@
 ECT_SAMPLE_NAME,
- s,
  PROJECT_SAMPLE_
@@ -1456,24 +1456,27 @@
 _SAMPLE_NAME
+, s
 );%0A%09%7D%0A%0A%09@Tes
@@ -1789,35 +1789,32 @@
 ECT_SAMPLE_NAME,
- s,
  PROJECT_SAMPLE_
@@ -1813,24 +1813,27 @@
 _SAMPLE_NAME
+, s
 );%0A%09%7D%0A%0A%0A%09@Te
@@ -2039,35 +2039,32 @@
 ECT_SAMPLE_NAME,
- s,
  PROJECT_SAMPLE_
@@ -2059,32 +2059,35 @@
 JECT_SAMPLE_NAME
+, s
 );%0A%09%7D%0A%09%0A%09@Test%0A%09
@@ -2303,11 +2303,8 @@
 AME,
- s,
  PRO
@@ -2319,16 +2319,19 @@
 PLE_NAME
+, s
 );%0A%09%7D%0A%09%0A

Change parameter order for error message