/*
 * Copyright (C) 2016 Nicolai Ehemann (en@enlightened.de).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.enlightened.maven.plugin.sqlenumgen.configuration;

import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Nicolai Ehemann
 */
public class GeneratorCfgTest {

  private GeneratorCfg generator;

  @Before
  public void setUp() {
    this.generator = new GeneratorCfg();
  }

  @Test
  public void testConstructor() {
    assertNotNull("target initialized", this.generator.getTarget());
  }

  @Test
  public void testGetterSetter() {
    final DatabaseCfg database = new DatabaseCfg();
    this.generator.setDatabase(database);
    assertSame("database is same", database, this.generator.getDatabase());

    final String databaseSchema = "schema";
    this.generator.setDatabaseSchema(databaseSchema);
    assertSame("databaseSchema is same", databaseSchema, this.generator.getDatabaseSchema());

    final TargetCfg target = new TargetCfg();
    this.generator.setTarget(target);
    assertSame("target is same", target, this.generator.getTarget());
  }
}

@@ -681,16 +681,50 @@
 ation;%0A%0A
+import static org.junit.Assert.*;%0A
 import o
@@ -757,20 +757,20 @@
 g.junit.
-Test
+Rule
 ;%0Aimport
@@ -774,33 +774,64 @@
 ort 
-static org.junit.Assert.*
+org.junit.Test;%0Aimport org.junit.rules.ExpectedException
 ;%0A%0A/
@@ -935,16 +935,96 @@
 rator;%0A%0A
+  @Rule%0A  public final ExpectedException exception = ExpectedException.none();%0A%0A
   @Befor
@@ -1767,19 +1767,759 @@
 etTarget());
+%0A%0A    this.generator.setAttributeVisibility(AttributeVisibility.PUBLIC);%0A    assertSame(%22attributeVisibility is same%22, AttributeVisibility.PUBLIC, this.generator.getAttributeVisibility());%0A%0A    this.generator.setAttributeVisibility(AttributeVisibility.PUBLIC.name());%0A    assertSame(%22attributeVisibility is same%22, AttributeVisibility.PUBLIC, this.generator.getAttributeVisibility());%0A%0A    this.generator.setAttributeVisibility(AttributeVisibility.PUBLIC.name().toLowerCase());%0A    assertSame(%22attributeVisibility is same%22, AttributeVisibility.PUBLIC, this.generator.getAttributeVisibility());%0A  %7D%0A%0A  @Test%0A  public void testSetterFails() %7B%0A    exception.expect(IllegalArgumentException.class);%0A    this.generator.setAttributeVisibility(%22%22);
 %0A  %7D%0A%7D%0A

Add tests for attributeVisibility config