/*
 * Copyright 2013, The OpenNMS Group
 * 
 * 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 com.opennms.lucidity;


import org.junit.Test;

import com.opennms.lucidity.Schema;
import com.opennms.lucidity.annotations.Entity;
import com.opennms.lucidity.annotations.Id;


public class SchemaTest {

    @Entity private class InvalidConstructor {
        @SuppressWarnings("unused")
        InvalidConstructor(String argument) {

        }
    }

    @Entity private class InvalidID {
        @Id private String id;
    }

    @Test(expected = IllegalArgumentException.class)
    public void testNoArgConstructor() {
        Schema.fromClass(InvalidConstructor.class);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testIDType() {
        Schema.fromClass(InvalidID.class);
    }

}

@@ -634,16 +634,68 @@
 dity;%0A%0A%0A
+import java.io.PrintStream;%0Aimport java.util.UUID;%0A%0A
 import o
@@ -746,16 +746,64 @@
 Schema;%0A
+import com.opennms.lucidity.annotations.Column;%0A
 import c
@@ -1130,32 +1130,146 @@
 ring id;%0A    %7D%0A%0A
+    @Entity private class InvalidColumn %7B%0A        @Id private UUID id;%0A        @Column PrintStream stream;%0A    %7D%0A%0A
     @Test(expect
@@ -1539,10 +1539,149 @@
 %0A    %7D%0A%0A
+    @Test(expected = IllegalArgumentException.class)%0A    public void testBadType() %7B%0A        Schema.fromClass(InvalidColumn.class);%0A    %7D%0A%0A
 %7D%0A

raise exception when entities contain unsupported types