1
2 package com.simpligility.maven.plugins.android.standalonemojos;
3
4 import org.junit.After;
5 import org.junit.Assert;
6 import org.junit.Before;
7 import org.junit.FixMethodOrder;
8 import org.junit.Ignore;
9 import org.junit.Test;
10 import org.junit.runner.RunWith;
11 import org.junit.runners.MethodSorters;
12 import org.junit.runners.Parameterized;
13 import org.junit.runners.Parameterized.Parameters;
14
15 import com.simpligility.maven.plugins.android.AbstractAndroidMojoTestCase;
16 import com.simpligility.maven.plugins.android.config.ConfigHandler;
17 import com.simpligility.maven.plugins.android.configuration.MetaInf;
18 import com.simpligility.maven.plugins.android.standalonemojos.UnpackMojo;
19
20 import java.util.ArrayList;
21 import java.util.List;
22
23
24
25
26 @Ignore("This test has to be migrated to be an IntegrationTest using AbstractAndroidMojoIntegrationTest")
27 @RunWith( Parameterized.class )
28 public class UnpackMojoLazyTest
29 extends AbstractAndroidMojoTestCase<UnpackMojo>
30 {
31
32 @Parameters
33 static public List<Object[]> suite()
34 {
35 final List<Object[]> suite = new ArrayList<Object[]>();
36
37 suite.add( new Object[] { "unpack-config-lazy" } );
38 suite.add( new Object[] { "unpack-config-lazy-deprecated" } );
39
40 return suite;
41 }
42
43 private final String projectName;
44
45 public UnpackMojoLazyTest( String projectName )
46 {
47 this.projectName = projectName;
48 }
49
50 @Override
51 public String getPluginGoalName()
52 {
53 return "unpack";
54 }
55
56 @Override
57 @Before
58 public void setUp()
59 throws Exception
60 {
61 super.setUp();
62 }
63
64 @Override
65 @After
66 public void tearDown()
67 throws Exception
68 {
69 super.tearDown();
70 }
71
72 @Override
73 public String getName()
74 {
75 return projectName;
76 }
77
78 @Test
79 public void testConfigHelper()
80 throws Exception
81 {
82 final UnpackMojo mojo = createMojo( this.projectName );
83 final ConfigHandler cfh = new ConfigHandler( mojo, this.session, this.execution );
84
85 cfh.parseConfiguration();
86
87 Boolean result = getFieldValue( mojo, "unpackLazy" );
88
89 Assert.assertNotNull(result);
90 Assert.assertTrue( result );
91 }
92
93 protected <T> T getFieldValue( Object object, String fieldName )
94 throws IllegalAccessException
95 {
96 return (T) super.getVariableValueFromObject( object, fieldName );
97 }
98
99 }