package com.jayway.maven.plugins.android.config;

import static org.junit.Assert.*;

import org.junit.Test;

public class ConfigHandlerTest {

	private DummyMojo mojo = new DummyMojo();

	@Test
	public void testParseConfigurationDefault() throws Exception {
		ConfigHandler configHandler = new ConfigHandler(mojo);
		configHandler.parseConfiguration();
		assertTrue(mojo.getParsedBooleanValue());
	}

	@Test
	public void testParseConfigurationFromConfigPojo() throws Exception {
		mojo.setConfigPojo(new DummyConfigPojo("from config pojo", null));
		ConfigHandler configHandler = new ConfigHandler(mojo);
		configHandler.parseConfiguration();
		assertEquals("from config pojo",mojo.getParsedStringValue());
	}

	@Test
	public void testParseConfigurationFromMaven() throws Exception {
		mojo.setConfigPojoStringValue("maven value");
		ConfigHandler configHandler = new ConfigHandler(mojo);
		configHandler.parseConfiguration();
		assertEquals("maven value",mojo.getParsedStringValue());
	}

	@Test
	public void testParseConfigurationDefaultMethodValue() throws Exception {
		ConfigHandler configHandler = new ConfigHandler(mojo);
		configHandler.parseConfiguration();
		assertArrayEquals(new String[] {"a","b"},mojo.getParsedMethodValue());
	}
}

@@ -41,19 +41,17 @@
 .config;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -76,19 +76,17 @@
 ssert.*;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -100,19 +100,17 @@
 it.Test;
-%0D%0A%0D
+%0A
 %0Apublic 
@@ -134,19 +134,17 @@
 erTest %7B
-%0D%0A%0D
+%0A
 %0A%09privat
@@ -178,27 +178,24 @@
 yMojo();
-%0D%0A%0D
+%0A
 %0A%09@Test
-%0D
 %0A%09public
@@ -242,33 +242,32 @@
 rows Exception %7B
-%0D
 %0A%09%09ConfigHandler
@@ -299,33 +299,32 @@
 igHandler(mojo);
-%0D
 %0A%09%09configHandler
@@ -337,33 +337,32 @@
 Configuration();
-%0D
 %0A%09%09assertTrue(mo
@@ -385,39 +385,35 @@
 eanValue());
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A
 %0A%09@Test
-%0D
 %0A%09public voi
@@ -463,33 +463,32 @@
 rows Exception %7B
-%0D
 %0A%09%09mojo.setConfi
@@ -540,17 +540,16 @@
  null));
-%0D
 %0A%09%09Confi
@@ -589,33 +589,32 @@
 igHandler(mojo);
-%0D
 %0A%09%09configHandler
@@ -627,33 +627,32 @@
 Configuration();
-%0D
 %0A%09%09assertEquals(
@@ -695,39 +695,35 @@
 ingValue());
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A
 %0A%09@Test
-%0D
 %0A%09public voi
@@ -776,17 +776,16 @@
 eption %7B
-%0D
 %0A%09%09mojo.
@@ -824,17 +824,16 @@
 value%22);
-%0D
 %0A%09%09Confi
@@ -873,33 +873,32 @@
 igHandler(mojo);
-%0D
 %0A%09%09configHandler
@@ -911,33 +911,32 @@
 Configuration();
-%0D
 %0A%09%09assertEquals(
@@ -982,23 +982,19 @@
 ());
-%0D
 %0A%09%7D
-%0D%0A%0D
+%0A
 %0A%09@Test
-%0D
 %0A%09pu
@@ -1064,17 +1064,16 @@
 eption %7B
-%0D
 %0A%09%09Confi
@@ -1121,17 +1121,16 @@
 r(mojo);
-%0D
 %0A%09%09confi
@@ -1159,17 +1159,16 @@
 ation();
-%0D
 %0A%09%09asser
@@ -1236,13 +1236,10 @@
 ());
-%0D
 %0A%09%7D
-%0D
 %0A%7D
-%0D
 %0A

Convert to LF line-endings.