package com.github.enanomapper;

import java.io.StringReader;

import org.junit.Assert;
import org.junit.Test;

public class ConfigurationTest {

	@Test
	public void testParsingUp() throws Exception {
		String test = "+U:http://www.ifomis.org/bfo/1.1/snap#DependentContinuant";
		Configuration conf = new Configuration();
		conf.read(new StringReader(test));
		Assert.assertEquals(1, conf.getTreePartsToSave().size());
	}

	@Test(expected=Exception.class)
	public void testMissingAdd() throws Exception {
		String test = "U:http://www.ifomis.org/bfo/1.1/snap#DependentContinuant";
		Configuration conf = new Configuration();
		conf.read(new StringReader(test));
	}

	@Test(expected=Exception.class)
	public void testMissingColon() throws Exception {
		String test = "+Uhttp://www.ifomis.org/bfo/1.1/snap#DependentContinuant";
		Configuration conf = new Configuration();
		conf.read(new StringReader(test));
	}

	@Test
	public void testSingularAdd() throws Exception {
		String test = "+:http://www.ifomis.org/bfo/1.1/snap#DependentContinuant";
		Configuration conf = new Configuration();
		conf.read(new StringReader(test));
		Assert.assertEquals(1, conf.getTreePartsToSave().size());
	}

	@Test
	public void testDown() throws Exception {
		String test = "+D:http://www.ifomis.org/bfo/1.1/snap#DependentContinuant";
		Configuration conf = new Configuration();
		conf.read(new StringReader(test));
		Assert.assertEquals(1, conf.getTreePartsToSave().size());
	}

	@Test
	public void testSingularemove() throws Exception {
		String test = "-:http://www.ifomis.org/bfo/1.1/snap#DependentContinuant";
		Configuration conf = new Configuration();
		conf.read(new StringReader(test));
		Assert.assertEquals(1, conf.getTreePartsToRemove().size());
	}
}

@@ -408,32 +408,370 @@
 ().size());%0A%09%7D%0A%0A
+%09@Test%0A%09public void testRemoveUp() throws Exception %7B%0A%09%09String test = %22-U:http://www.ifomis.org/bfo/1.1/snap#DependentContinuant%22;%0A%09%09Configuration conf = new Configuration();%0A%09%09conf.read(new StringReader(test));%0A%09%09Assert.assertEquals(0, conf.getTreePartsToSave().size());%0A%09%09Assert.assertEquals(1, conf.getTreePartsToRemove().size());%0A%09%7D%0A%0A
 %09@Test(expected=

Test parsing of remove-up instructions