View Javadoc
1   /*
2    * Copyright (C) 2009 Jayway AB
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.simpligility.maven.plugins.android.asm;
17  
18  import org.apache.maven.plugin.MojoExecutionException;
19  import org.junit.Assert;
20  import org.junit.Test;
21  
22  import com.simpligility.maven.plugins.android.asm.AndroidTestFinder;
23  
24  import java.io.File;
25  
26  /**
27   * Exercises the {@link com.simpligility.maven.plugins.android.asm.AndroidTestFinder} class.
28   *
29   * @author hugo.josefson@jayway.com
30   */
31  public class AndroidTestFinderTest {
32      @Test
33      public void givenDirectoryWithoutTestsThenNoTests() throws MojoExecutionException {
34          final boolean result = AndroidTestFinder.containsAndroidTests(new File("target/test-classes/com/simpligility/maven/plugins/android/asm/withouttests"));
35          Assert.assertFalse("'withouttests' should not contain any tests.", result);
36      }
37      @Test
38      public void givenDirectoryWithTestsThenItContainsTests() throws MojoExecutionException {
39          final boolean result = AndroidTestFinder.containsAndroidTests(new File("target/test-classes/com/simpligility/maven/plugins/android/asm/withtests"));
40          Assert.assertTrue("'withtests' should contain tests.", result);
41      }
42  
43  }