/*
 * ADL2-core
 * Copyright (c) 2013-2014 Marand d.o.o. (www.marand.com)
 *
 * This file is part of ADL2-core.
 *
 * ADL2-core is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.openehr.adl.rm;

import org.openehr.jaxb.rm.DvAmount;
import org.openehr.jaxb.rm.DvText;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static org.fest.assertions.Assertions.assertThat;

/**
 * @author markopi
 */
public class OpenEhrRmModelTest {
    private RmModel rmModel;

    @BeforeClass
    public void init() {
        rmModel = OpenEhrRmModel.getInstance();
    }

    @Test
    public void testGetExisting() throws Exception {
        assertThat(rmModel.getRmType("DV_AMOUNT")).isNotNull();
    }

    @Test(expectedExceptions = RmModelException.class, expectedExceptionsMessageRegExp = "Unknown.*DV_NONE")
    public void testGetAbsent() throws Exception {
        rmModel.getRmType("DV_NONE");
    }
}

@@ -810,80 +810,8 @@
 m;%0A%0A
-import org.openehr.jaxb.rm.DvAmount;%0Aimport org.openehr.jaxb.rm.DvText;%0A
 impo
@@ -849,16 +849,16 @@
 eClass;%0A
+
 import o
@@ -1240,28 +1240,767 @@
 %22DV_
-AMOUNT%22)).isNotNull(
+TEXT%22)).isNotNull();%0A    %7D%0A%0A    @Test%0A    public void testGetHierarchy() throws Exception %7B%0A        assertThat(rmModel.getRmType(%22DV_AMOUNT%22).getChildren()).containsOnly(%0A                rmModel.getRmType(%22DV_COUNT%22),%0A                rmModel.getRmType(%22DV_DURATION%22),%0A                rmModel.getRmType(%22DV_QUANTITY%22),%0A                rmModel.getRmType(%22DV_PROPORTION%22)%0A        );%0A        assertThat(rmModel.getRmType(%22DV_AMOUNT%22).getParent()).isEqualTo(rmModel.getRmType(%22DV_QUANTIFIED%22));%0A    %7D%0A%0A    @Test%0A    public void testGetAttributes() throws Exception %7B%0A        assertThat(rmModel.getRmType(%22DV_CODED_TEXT%22).getAttributes().keySet()).containsOnly(%0A                %22defining_code%22, %22encoding%22, %22formatting%22, %22hyperlink%22, %22language%22, %22mappings%22, %22value%22
 );%0A 

Add OpenEhrRmModel tests