// Path: java-schema-sdk/src/main/java/org/openmhealth/schema/domain/omh/RespiratoryRate.java
// public enum RespirationUnit implements Unit {
// 
//     BREATHS_PER_MINUTE("breaths/min");
// 
//     private final String schemaValue;
//     private static final Map<String, RespirationUnit> constantsBySchemaValue = Maps.newHashMap();
// 
//     static {
//         for (RespirationUnit unit : values()) {
//             constantsBySchemaValue.put(unit.getSchemaValue(), unit);
//         }
//     }
// 
//     RespirationUnit(String schemaValue) {
//         this.schemaValue = schemaValue;
//     }
// 
//     @Override
//     @JsonValue
//     public String getSchemaValue() {
//         return schemaValue;
//     }
// 
//     @JsonCreator
//     @Nullable
//     public RespirationUnit findBySchemaValue(String schemaValue) {
//         return constantsBySchemaValue.get(schemaValue);
//     }
// }
// 
// Path: java-schema-sdk/src/main/java/org/openmhealth/schema/domain/omh/TemporalRelationshipToPhysicalActivity.java
// public enum TemporalRelationshipToPhysicalActivity implements SchemaEnumValue, SchemaSupport {
// 
//     AT_REST,
//     ACTIVE,
//     BEFORE_EXERCISE,
//     AFTER_EXERCISE,
//     DURING_EXERCISE;
// 
//     public static final SchemaId SCHEMA_ID =
//             new SchemaId(OMH_NAMESPACE, "temporal-relationship-to-physical-activity", "1.0");
// 
//     private String schemaValue;
//     private static final Map<String, TemporalRelationshipToPhysicalActivity> constantsBySchemaValue = new HashMap<>();
// 
//     static {
//         for (TemporalRelationshipToPhysicalActivity constant : values()) {
//             constantsBySchemaValue.put(constant.getSchemaValue(), constant);
//         }
//     }
// 
//     TemporalRelationshipToPhysicalActivity() {
//         this.schemaValue = name().toLowerCase().replace('_', ' ');
//     }
// 
//     @Override
//     public SchemaId getSchemaId() {
//         return SCHEMA_ID;
//     }
// 
//     @Override
//     @JsonValue
//     public String getSchemaValue() {
//         return this.schemaValue;
//     }
// 
//     @Nullable
//     @JsonCreator
//     public static TemporalRelationshipToPhysicalActivity findBySchemaValue(String schemaValue) {
//         return constantsBySchemaValue.get(schemaValue);
//     }
// }
// 
// Path: java-schema-sdk/src/test/java/org/openmhealth/schema/domain/omh/TimeFrameFactory.java
// public static final TimeFrame FIXED_POINT_IN_TIME =
//         new TimeFrame(ZonedDateTime.of(2015, OCTOBER.getValue(), 21, 16, 29, 0, 0, PT).toOffsetDateTime());


import org.openmhealth.schema.domain.omh.RespiratoryRate.RespirationUnit;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MAXIMUM;
import static org.openmhealth.schema.domain.omh.RespiratoryRate.RespirationUnit.BREATHS_PER_MINUTE;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToPhysicalActivity.*;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_POINT_IN_TIME;
/*
 * Copyright 2015 Open mHealth
 *
 * 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 org.openmhealth.schema.domain.omh;





/**
 * @author Chris Schaefbauer
 */
public class RespiratoryRateUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/respiratory-rate-1.0.json";

    @Override
    public String getSchemaFilename() {
        return SCHEMA_FILENAME;
    }

    @Test(expectedExceptions = NullPointerException.class)
    public void constructorShouldThrowExceptionOnUndefinedRespiratoryRate() {

        new RespiratoryRate.Builder(null);
    }

    @Test
    public void buildShouldConstructMeasureCorrectlyUsingOnlyRequiredProperties() {

        RespiratoryRate respiratoryRate = new RespiratoryRate.Builder(new TypedUnitValue<>(BREATHS_PER_MINUTE, 20))
                .build();

        assertThat(respiratoryRate, notNullValue());
        assertThat(respiratoryRate.getRespiratoryRate(), notNullValue());
        assertThat(respiratoryRate.getRespiratoryRate().getTypedUnit(), equalTo(BREATHS_PER_MINUTE));
        assertThat(respiratoryRate.getRespiratoryRate().getValue(), equalTo(BigDecimal.valueOf(20)));

        assertThat(respiratoryRate.getEffectiveTimeFrame(), nullValue());
        assertThat(respiratoryRate.getUserNotes(), nullValue());
        assertThat(respiratoryRate.getDescriptiveStatistic(), nullValue());
        assertThat(respiratoryRate.getTemporalRelationshipToPhysicalActivity(), nullValue());
    }

    @Test
    public void buildShouldConstructMeasureCorrectlyUsingOptionalProperties() {

        RespiratoryRate respiratoryRate = new RespiratoryRate.Builder(new TypedUnitValue<>(BREATHS_PER_MINUTE, 15.5))
                .setDescriptiveStatistic(MAXIMUM)
// Path: java-schema-sdk/src/main/java/org/openmhealth/schema/domain/omh/RespiratoryRate.java
// public enum RespirationUnit implements Unit {
// 
//     BREATHS_PER_MINUTE("breaths/min");
// 
//     private final String schemaValue;
//     private static final Map<String, RespirationUnit> constantsBySchemaValue = Maps.newHashMap();
// 
//     static {
//         for (RespirationUnit unit : values()) {
//             constantsBySchemaValue.put(unit.getSchemaValue(), unit);
//         }
//     }
// 
//     RespirationUnit(String schemaValue) {
//         this.schemaValue = schemaValue;
//     }
// 
//     @Override
//     @JsonValue
//     public String getSchemaValue() {
//         return schemaValue;
//     }
// 
//     @JsonCreator
//     @Nullable
//     public RespirationUnit findBySchemaValue(String schemaValue) {
//         return constantsBySchemaValue.get(schemaValue);
//     }
// }
// 
// Path: java-schema-sdk/src/main/java/org/openmhealth/schema/domain/omh/TemporalRelationshipToPhysicalActivity.java
// public enum TemporalRelationshipToPhysicalActivity implements SchemaEnumValue, SchemaSupport {
// 
//     AT_REST,
//     ACTIVE,
//     BEFORE_EXERCISE,
//     AFTER_EXERCISE,
//     DURING_EXERCISE;
// 
//     public static final SchemaId SCHEMA_ID =
//             new SchemaId(OMH_NAMESPACE, "temporal-relationship-to-physical-activity", "1.0");
// 
//     private String schemaValue;
//     private static final Map<String, TemporalRelationshipToPhysicalActivity> constantsBySchemaValue = new HashMap<>();
// 
//     static {
//         for (TemporalRelationshipToPhysicalActivity constant : values()) {
//             constantsBySchemaValue.put(constant.getSchemaValue(), constant);
//         }
//     }
// 
//     TemporalRelationshipToPhysicalActivity() {
//         this.schemaValue = name().toLowerCase().replace('_', ' ');
//     }
// 
//     @Override
//     public SchemaId getSchemaId() {
//         return SCHEMA_ID;
//     }
// 
//     @Override
//     @JsonValue
//     public String getSchemaValue() {
//         return this.schemaValue;
//     }
// 
//     @Nullable
//     @JsonCreator
//     public static TemporalRelationshipToPhysicalActivity findBySchemaValue(String schemaValue) {
//         return constantsBySchemaValue.get(schemaValue);
//     }
// }
// 
// Path: java-schema-sdk/src/test/java/org/openmhealth/schema/domain/omh/TimeFrameFactory.java
// public static final TimeFrame FIXED_POINT_IN_TIME =
//         new TimeFrame(ZonedDateTime.of(2015, OCTOBER.getValue(), 21, 16, 29, 0, 0, PT).toOffsetDateTime());


// Path: java-schema-sdk/src/test/java/org/openmhealth/schema/domain/omh/RespiratoryRateUnitTests.java
import org.openmhealth.schema.domain.omh.RespiratoryRate.RespirationUnit;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MAXIMUM;
import static org.openmhealth.schema.domain.omh.RespiratoryRate.RespirationUnit.BREATHS_PER_MINUTE;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToPhysicalActivity.*;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_POINT_IN_TIME;

/*
 * Copyright 2015 Open mHealth
 *
 * 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 org.openmhealth.schema.domain.omh;





/**
 * @author Chris Schaefbauer
 */
public class RespiratoryRateUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/respiratory-rate-1.0.json";

    @Override
    public String getSchemaFilename() {
        return SCHEMA_FILENAME;
    }

    @Test(expectedExceptions = NullPointerException.class)
    public void constructorShouldThrowExceptionOnUndefinedRespiratoryRate() {

        new RespiratoryRate.Builder(null);
    }

    @Test
    public void buildShouldConstructMeasureCorrectlyUsingOnlyRequiredProperties() {

        RespiratoryRate respiratoryRate = new RespiratoryRate.Builder(new TypedUnitValue<>(BREATHS_PER_MINUTE, 20))
                .build();

        assertThat(respiratoryRate, notNullValue());
        assertThat(respiratoryRate.getRespiratoryRate(), notNullValue());
        assertThat(respiratoryRate.getRespiratoryRate().getTypedUnit(), equalTo(BREATHS_PER_MINUTE));
        assertThat(respiratoryRate.getRespiratoryRate().getValue(), equalTo(BigDecimal.valueOf(20)));

        assertThat(respiratoryRate.getEffectiveTimeFrame(), nullValue());
        assertThat(respiratoryRate.getUserNotes(), nullValue());
        assertThat(respiratoryRate.getDescriptiveStatistic(), nullValue());
        assertThat(respiratoryRate.getTemporalRelationshipToPhysicalActivity(), nullValue());
    }

    @Test
    public void buildShouldConstructMeasureCorrectlyUsingOptionalProperties() {

        RespiratoryRate respiratoryRate = new RespiratoryRate.Builder(new TypedUnitValue<>(BREATHS_PER_MINUTE, 15.5))
                .setDescriptiveStatistic(MAXIMUM)
                .setEffectiveTimeFrame(FIXED_POINT_IN_TIME)