View Javadoc

1   package org.apache.maven.plugin.idea;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import junit.framework.TestCase;
23  
24  /**
25   * @author Edwin Punzalan
26   */
27  public class LibraryTest
28      extends TestCase
29  {
30      private Library library;
31  
32      protected void setUp()
33          throws Exception
34      {
35          library = new Library();
36      }
37  
38      public void testName()
39      {
40          library.setName( "library-name" );
41  
42          assertEquals( "Test name", "library-name", library.getName() );
43      }
44  
45      public void testSources()
46      {
47          assertEquals( "Test null sources", 0, library.getSplitSources().length );
48  
49          String testString = "library-sources, sources, javasources";
50  
51          library.setSources( testString );
52  
53          assertEquals( "Test sources", testString, library.getSources() );
54  
55          String sources[] = library.getSplitSources();
56  
57          assertEquals( "Test split sources cound", 3, sources.length );
58  
59          assertEquals( "Test split source 1", "library-sources", sources[0] );
60  
61          assertEquals( "Test split source 2", "sources", sources[1] );
62  
63          assertEquals( "Test split source 3", "javasources", sources[2] );
64      }
65  
66      public void testClasses()
67      {
68          assertEquals( "Test null classes", 0, library.getSplitClasses().length );
69  
70          String testString = "library-classes, classes, javaclasses";
71  
72          library.setClasses( testString );
73  
74          assertEquals( "Test classes", testString, library.getClasses() );
75  
76          String classes[] = library.getSplitClasses();
77  
78          assertEquals( "Test split sources cound", 3, classes.length );
79  
80          assertEquals( "Test split class 1", "library-classes", classes[0] );
81  
82          assertEquals( "Test split class 2", "classes", classes[1] );
83  
84          assertEquals( "Test split class 3", "javaclasses", classes[2] );
85      }
86  
87      public void testIsExclude()
88      {
89          library.setExclude( true );
90  
91          assertTrue( "Test exclude", library.isExclude() );
92      }
93  }