1   package org.apache.maven.javacc;
2   
3   /* ====================================================================
4    *   Copyright 2001-2004 The Apache Software Foundation.
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   You may obtain a copy of the License at
9    *
10   *       http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   * ====================================================================
18   */
19  
20  
21  import java.io.File;
22  
23  import junit.framework.TestCase;
24  
25  /**
26   * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
27   * @version $Id: BaseBeanTest.java 373246 2006-01-28 21:11:33Z ltheussl $
28   */
29  public class BaseBeanTest extends TestCase
30  {
31      public void testBaseBean()
32      {
33          final BaseBean bean = new BaseBean();
34  
35          final String grammar = "foo/baa/grammar.txt";
36  
37          bean.setGrammar( grammar );
38  
39          assertEquals( "Grammar file was not set correctly ", grammar,
40              bean.getGrammar() );
41  
42          bean.setJavaccPackageName( "com.wombat.javacc" );
43  
44          final String fs = File.separator;
45  
46          final String basedir = System.getProperty( "basedir" );
47  
48          final String gsd =
49              basedir + fs + "target" + fs + "generated-src" + fs + "main" + fs
50              + "java";
51  
52          bean.setGeneratedSourceDirectory( gsd );
53  
54          final String javaccPath =
55              gsd + fs + "com" + fs + "wombat" + fs + "javacc";
56  
57          assertEquals( "Output dir not was set correctly", javaccPath,
58              bean.getJavaccOutputDir().getPath() );
59  
60          bean.setJjtreePackageName( "com.wombat.jjtree" );
61  
62          final String jjtreePath =
63              gsd + fs + "com" + fs + "wombat" + fs + "jjtree";
64  
65          assertEquals( "Output dir not was set correctly", jjtreePath,
66              bean.getJJTreeOutputDir().getPath() );
67      }
68  }