View Javadoc
1   /*
2    * Copyright (C) 2014 simpligility technologies inc.,
3    * and individual contributors
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   * 
17   * Contributors : 
18   * JBoss, Home of Professional Open Source
19   */
20  package com.simpligility.maven.plugins.android.sample;
21  
22      
23  import io.takari.maven.testing.TestResources;
24  import io.takari.maven.testing.executor.MavenExecutionResult;
25  import io.takari.maven.testing.executor.MavenRuntime;
26  import io.takari.maven.testing.executor.MavenVersions;
27  import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
28  import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
29  
30  import java.io.File;
31  
32  import org.junit.Rule;
33  import org.junit.Test;
34  import org.junit.runner.RunWith;
35  
36  import com.simpligility.maven.plugins.android.PluginInfo;
37  
38  
39  
40  @RunWith(MavenJUnitTestRunner.class)
41  @MavenVersions({"3.3.9"})
42  public class Junit4TestBuildExampleIT {
43  
44    @Rule
45    public final TestResources resources = new TestResources();
46    
47    public final MavenRuntime mavenRuntime;
48    
49    public Junit4TestBuildExampleIT(MavenRuntimeBuilder builder) throws Exception {
50      this.mavenRuntime = builder.build();
51    }
52    
53    @Test
54    public void buildInstall() throws Exception {
55      File basedir = resources.getBasedir( "aar-child-junit-tests" );
56      MavenExecutionResult result = mavenRuntime
57            .forProject(basedir)
58            .withCliOptions("-Psupport_test")
59            .execute( "clean", PluginInfo.getQualifiedGoal( "undeploy" ), "install" );
60      result.assertErrorFreeLog();
61      result.assertLogText( "Tests run: 1,  Failures: 0,  Errors: 0" );
62    }
63  }