1   /*
2    * Copyright (c) 2004 International Decision Systems, Inc.  All Rights Reserved.
3    *
4    * By using this Software, You acknowledge that the Software is a valuable asset
5    * and trade secret of either International Decision Systems, Inc. ("IDSI") or a
6    * third party supplier of IDSI and constitutes confidential and proprietary
7    * information.
8    *
9    * NEITHER IDSI NOR ANY AGENT OR PERSON ACTING FOR OR WITH IDSI HAS MADE OR DOES
10   * MAKE ANY STATEMENTS, AFFIRMATIONS, REPRESENTATIONS OR WARRANTIES WHATSOEVER
11   * TO YOU, WHETHER EXPRESS OR IMPLIED, AS TO THE SOFTWARE, THE QUALITY OR
12   * CONDITION OF THE SOFTWARE, OR THE OPERATING CHARACTERISTICS OR RELIABILITY OF
13   * THE SOFTWARE, OR ITS SUITABILITY FOR ANY GENERAL OR PARTICULAR PURPOSE, OR AS
14   * TO ANY OTHER MATTER WHATSOEVER; ANY AND ALL OTHER WARRANTIES INCLUDING
15   * WITHOUT LIMITATION ANY WARRANTIES IMPLIED BY LAW, SUCH AS THE IMPLIED
16   * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND TITLE,
17   * USE AND NON-INFRINGEMENT; ARE HEREBY EXPRESSLY DISCLAIMED AND EXCLUDED.
18  */
19  package net.sourceforge.addam.ddlgen;
20  
21  import net.sourceforge.addam.ddlgen.GeneratorSpec;
22  import junit.framework.TestCase;
23  
24  /**
25   * @author TIM3
26   * @since Mar 30, 2005 12:33:36 PM
27   */
28  public class GeneratorSpecUTEST extends TestCase {
29  
30      public void testGetFile() {
31          GeneratorSpec spec = new GeneratorSpec();
32          spec.setDir(".");
33          spec.setPrefix("foo");
34          spec.setExtension("baz");
35          assertEquals("fooBar.baz", spec.getFile("Bar").getName());
36      }
37  
38      public void testNPE() {
39          GeneratorSpec spec = new GeneratorSpec();
40          spec.setDir(null);
41          spec.setPrefix("foo");
42          spec.setExtension("baz");
43          assertEquals("fooBar.baz", spec.getFile("Bar").getName());
44          spec.setDir(".");
45          spec.setPrefix(null);
46          spec.setExtension("baz");
47          assertEquals("Bar.baz", spec.getFile("Bar").getName());
48          spec.setDir(".");
49          spec.setPrefix("foo");
50          spec.setExtension(null);
51          assertEquals("fooBar", spec.getFile("Bar").getName());
52          spec.setDir(".");
53          spec.setPrefix("foo");
54          spec.setExtension("baz");
55          assertEquals("foo.baz", spec.getFile(null).getName());
56      }
57  }