/*******************************************************************************
 * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.xtext.util;

import static org.junit.Assert.*;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.jar.Manifest;

import org.junit.Test;

/**
 * @author dhuebner - Initial contribution and API
 */
public class XtextVersionTests {

	@Test
	public void testVersionKinds() {

		XtextVersion version = new XtextVersion("2.9.0-SNAPSHOT");
		//snapshot
		assertTrue(version.isSnapshot());
		assertFalse(version.isStable());

		// stable version pre-release
		version = new XtextVersion("2.9.0.beta1");
		assertFalse(version.isSnapshot());
		assertTrue(version.isStable());
		
		version = new XtextVersion("2.9.0.rc1");
		assertFalse(version.isSnapshot());
		assertTrue(version.isStable());
		
		version = new XtextVersion("2.9.0.maybeSomthingElse");
		assertFalse(version.isSnapshot());
		assertTrue(version.isStable());
		
		// releases
		version = new XtextVersion("2.9.0");
		assertFalse(version.isSnapshot());
		assertFalse(version.isStable());
		
		version = new XtextVersion("2.9.0.1");
		assertFalse(version.isSnapshot());
		assertFalse(version.isStable());
		
	}
	
	@Test
	public void test_getCurrent () throws IOException {
		XtextVersion current = XtextVersion.getCurrent();
		try (FileInputStream fis = new FileInputStream("META-INF/MANIFEST.MF")) {
			assertNotNull(current);
			Manifest manifest = new Manifest(fis);
			String bundleVersion = manifest.getMainAttributes().getValue("Bundle-Version");
			assertNotNull(current);
			// in development Bundle-Version will have suffix .qualifier
			if (bundleVersion.endsWith(".qualifier")) {
				assertEquals(bundleVersion.replace(".qualifier", "-SNAPSHOT"), current.getVersion());
			}
		}
	}

}

@@ -541,100 +541,8 @@
 *;%0A%0A
-import java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.util.jar.Manifest;%0A%0A
 impo
@@ -1492,589 +1492,6 @@
 %0A%09%7D%0A
-%09%0A%09@Test%0A%09public void test_getCurrent () throws IOException %7B%0A%09%09XtextVersion current = XtextVersion.getCurrent();%0A%09%09try (FileInputStream fis = new FileInputStream(%22META-INF/MANIFEST.MF%22)) %7B%0A%09%09%09assertNotNull(current);%0A%09%09%09Manifest manifest = new Manifest(fis);%0A%09%09%09String bundleVersion = manifest.getMainAttributes().getValue(%22Bundle-Version%22);%0A%09%09%09assertNotNull(current);%0A%09%09%09// in development Bundle-Version will have suffix .qualifier%0A%09%09%09if (bundleVersion.endsWith(%22.qualifier%22)) %7B%0A%09%09%09%09assertEquals(bundleVersion.replace(%22.qualifier%22, %22-SNAPSHOT%22), current.getVersion());%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A
 %7D%0A

Remove test_getCurrent