View Javadoc

1   package com.jayway.maven.plugins.android.config;
2   
3   import static org.junit.Assert.*;
4   
5   import org.junit.Test;
6   
7   public class ConfigHandlerTest {
8   
9   	private DummyMojo mojo = new DummyMojo();
10  
11  	@Test
12  	public void testParseConfigurationDefault() throws Exception {
13  		ConfigHandler configHandler = new ConfigHandler(mojo);
14  		configHandler.parseConfiguration();
15  		assertTrue(mojo.getParsedBooleanValue());
16  	}
17  
18  	@Test
19  	public void testParseConfigurationFromConfigPojo() throws Exception {
20  		mojo.setConfigPojo(new DummyConfigPojo("from config pojo", null));
21  		ConfigHandler configHandler = new ConfigHandler(mojo);
22  		configHandler.parseConfiguration();
23  		assertEquals("from config pojo",mojo.getParsedStringValue());
24  	}
25  
26  	@Test
27  	public void testParseConfigurationFromMaven() throws Exception {
28  		mojo.setConfigPojoStringValue("maven value");
29  		ConfigHandler configHandler = new ConfigHandler(mojo);
30  		configHandler.parseConfiguration();
31  		assertEquals("maven value",mojo.getParsedStringValue());
32  	}
33  
34  	@Test
35  	public void testParseConfigurationDefaultMethodValue() throws Exception {
36  		ConfigHandler configHandler = new ConfigHandler(mojo);
37  		configHandler.parseConfiguration();
38  		assertArrayEquals(new String[] {"a","b"},mojo.getParsedMethodValue());
39  	}
40  }