// Path: java-schema-sdk/src/test/java/org/openmhealth/schema/domain/omh/TimeFrameFactory.java
// public static final TimeFrame FIXED_MONTH =
//         new TimeFrame(ofStartDateTimeAndEndDateTime(
//                 LocalDate.of(2015, OCTOBER, 1).atStartOfDay(PT).toOffsetDateTime(),
//                 LocalDate.of(2015, NOVEMBER, 1).atStartOfDay(PT).toOffsetDateTime()
//         ));
// 
// 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 static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_POINT_IN_TIME;
import org.testng.annotations.Test;
import java.time.OffsetDateTime;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MAXIMUM;
import static org.openmhealth.schema.domain.omh.OxygenFlowRateUnit.LITERS_PER_MINUTE;
import static org.openmhealth.schema.domain.omh.OxygenSaturation.MeasurementMethod.PULSE_OXIMETRY;
import static org.openmhealth.schema.domain.omh.OxygenSaturation.MeasurementSystem.PERIPHERAL_CAPILLARY;
import static org.openmhealth.schema.domain.omh.OxygenSaturation.SupplementalOxygenAdministrationMode.NASAL_CANNULA;
import static org.openmhealth.schema.domain.omh.PercentUnit.PERCENT;
import static org.openmhealth.schema.domain.omh.SchemaSupport.OMH_NAMESPACE;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;

    @Test
    public void buildShouldConstructMeasureUsingOptionalProperties() {

        OxygenSaturation oxygenSaturation = new OxygenSaturation.Builder(new TypedUnitValue<>(PERCENT, 93.5))
                .setEffectiveTimeFrame(FIXED_MONTH)
                .setUserNotes("a note about oxygen sat")
                .setDescriptiveStatistic(MAXIMUM)
                .setMeasurementSystem(PERIPHERAL_CAPILLARY)
                .setSupplementalOxygenFlowRate(new TypedUnitValue<>(LITERS_PER_MINUTE, 3.2))
                .setSupplementalOxygenAdministrationMode(NASAL_CANNULA)
                .setMeasurementMethod(PULSE_OXIMETRY)
                .build();

        assertThat(oxygenSaturation, notNullValue());
        assertThat(oxygenSaturation.getOxygenSaturation(), equalTo(new TypedUnitValue<>(PERCENT, 93.5)));
        assertThat(oxygenSaturation.getUserNotes(), equalTo("a note about oxygen sat"));
        assertThat(oxygenSaturation.getEffectiveTimeFrame(), equalTo(FIXED_MONTH));
        assertThat(oxygenSaturation.getDescriptiveStatistic(), equalTo(MAXIMUM));
        assertThat(oxygenSaturation.getMeasurementSystem(), equalTo(PERIPHERAL_CAPILLARY));
        assertThat(oxygenSaturation.getSupplementalOxygenFlowRate(),
                equalTo(new TypedUnitValue<>(LITERS_PER_MINUTE, 3.2)));
        assertThat(oxygenSaturation.getSupplementalOxygenAdministrationMode(), equalTo(NASAL_CANNULA));
        assertThat(oxygenSaturation.getMeasurementMethod(), equalTo(PULSE_OXIMETRY));
    }

    @Test
    public void measureShouldSerializeCorrectly() throws Exception {

        OxygenSaturation oxygenSaturation = new OxygenSaturation.Builder(new TypedUnitValue<>(PERCENT, 96.5))
// Path: java-schema-sdk/src/test/java/org/openmhealth/schema/domain/omh/TimeFrameFactory.java
// public static final TimeFrame FIXED_MONTH =
//         new TimeFrame(ofStartDateTimeAndEndDateTime(
//                 LocalDate.of(2015, OCTOBER, 1).atStartOfDay(PT).toOffsetDateTime(),
//                 LocalDate.of(2015, NOVEMBER, 1).atStartOfDay(PT).toOffsetDateTime()
//         ));
// 
// 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/OxygenSaturationUnitTests.java
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_POINT_IN_TIME;
import org.testng.annotations.Test;
import java.time.OffsetDateTime;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MAXIMUM;
import static org.openmhealth.schema.domain.omh.OxygenFlowRateUnit.LITERS_PER_MINUTE;
import static org.openmhealth.schema.domain.omh.OxygenSaturation.MeasurementMethod.PULSE_OXIMETRY;
import static org.openmhealth.schema.domain.omh.OxygenSaturation.MeasurementSystem.PERIPHERAL_CAPILLARY;
import static org.openmhealth.schema.domain.omh.OxygenSaturation.SupplementalOxygenAdministrationMode.NASAL_CANNULA;
import static org.openmhealth.schema.domain.omh.PercentUnit.PERCENT;
import static org.openmhealth.schema.domain.omh.SchemaSupport.OMH_NAMESPACE;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;


    @Test
    public void buildShouldConstructMeasureUsingOptionalProperties() {

        OxygenSaturation oxygenSaturation = new OxygenSaturation.Builder(new TypedUnitValue<>(PERCENT, 93.5))
                .setEffectiveTimeFrame(FIXED_MONTH)
                .setUserNotes("a note about oxygen sat")
                .setDescriptiveStatistic(MAXIMUM)
                .setMeasurementSystem(PERIPHERAL_CAPILLARY)
                .setSupplementalOxygenFlowRate(new TypedUnitValue<>(LITERS_PER_MINUTE, 3.2))
                .setSupplementalOxygenAdministrationMode(NASAL_CANNULA)
                .setMeasurementMethod(PULSE_OXIMETRY)
                .build();

        assertThat(oxygenSaturation, notNullValue());
        assertThat(oxygenSaturation.getOxygenSaturation(), equalTo(new TypedUnitValue<>(PERCENT, 93.5)));
        assertThat(oxygenSaturation.getUserNotes(), equalTo("a note about oxygen sat"));
        assertThat(oxygenSaturation.getEffectiveTimeFrame(), equalTo(FIXED_MONTH));
        assertThat(oxygenSaturation.getDescriptiveStatistic(), equalTo(MAXIMUM));
        assertThat(oxygenSaturation.getMeasurementSystem(), equalTo(PERIPHERAL_CAPILLARY));
        assertThat(oxygenSaturation.getSupplementalOxygenFlowRate(),
                equalTo(new TypedUnitValue<>(LITERS_PER_MINUTE, 3.2)));
        assertThat(oxygenSaturation.getSupplementalOxygenAdministrationMode(), equalTo(NASAL_CANNULA));
        assertThat(oxygenSaturation.getMeasurementMethod(), equalTo(PULSE_OXIMETRY));
    }

    @Test
    public void measureShouldSerializeCorrectly() throws Exception {

        OxygenSaturation oxygenSaturation = new OxygenSaturation.Builder(new TypedUnitValue<>(PERCENT, 96.5))
                .setEffectiveTimeFrame(FIXED_POINT_IN_TIME)