// 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()
//         ));


import org.testng.annotations.Test;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openmhealth.schema.domain.omh.BloodGlucoseUnit.MILLIGRAMS_PER_DECILITER;
import static org.openmhealth.schema.domain.omh.BloodSpecimenType.PLASMA;
import static org.openmhealth.schema.domain.omh.BloodSpecimenType.WHOLE_BLOOD;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MEDIAN;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MINIMUM;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToMeal.FASTING;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToSleep.BEFORE_SLEEPING;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToSleep.ON_WAKING;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;
/*
 * 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 Emerson Farrugia
 */
public class BloodGlucoseUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/blood-glucose-1.0.json";


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

        new BloodGlucose.Builder(null);
    }

    @Test
    public void buildShouldConstructMeasureUsingOnlyRequiredProperties() {

        TypedUnitValue<BloodGlucoseUnit> bloodGlucoseLevel = new TypedUnitValue<>(MILLIGRAMS_PER_DECILITER, 110);

        BloodGlucose bloodGlucose = new BloodGlucose.Builder(bloodGlucoseLevel).build();

        assertThat(bloodGlucose, notNullValue());
        assertThat(bloodGlucose.getBloodGlucose(), equalTo(bloodGlucoseLevel));
        assertThat(bloodGlucose.getBloodSpecimenType(), nullValue());
        assertThat(bloodGlucose.getTemporalRelationshipToMeal(), nullValue());
        assertThat(bloodGlucose.getTemporalRelationshipToSleep(), nullValue());
        assertThat(bloodGlucose.getEffectiveTimeFrame(), nullValue());
        assertThat(bloodGlucose.getDescriptiveStatistic(), nullValue());
        assertThat(bloodGlucose.getUserNotes(), nullValue());
    }

    @Test
    public void buildShouldConstructMeasureUsingOptionalProperties() {

        TypedUnitValue<BloodGlucoseUnit> bloodGlucoseLevel = new TypedUnitValue<>(MILLIGRAMS_PER_DECILITER, 110);

        BloodGlucose bloodGlucose = new BloodGlucose.Builder(bloodGlucoseLevel)
                .setBloodSpecimenType(WHOLE_BLOOD)
                .setTemporalRelationshipToMeal(FASTING)
                .setTemporalRelationshipToSleep(BEFORE_SLEEPING)
// 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/BloodGlucoseUnitTests.java
import org.testng.annotations.Test;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openmhealth.schema.domain.omh.BloodGlucoseUnit.MILLIGRAMS_PER_DECILITER;
import static org.openmhealth.schema.domain.omh.BloodSpecimenType.PLASMA;
import static org.openmhealth.schema.domain.omh.BloodSpecimenType.WHOLE_BLOOD;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MEDIAN;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MINIMUM;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToMeal.FASTING;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToSleep.BEFORE_SLEEPING;
import static org.openmhealth.schema.domain.omh.TemporalRelationshipToSleep.ON_WAKING;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;

/*
 * 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 Emerson Farrugia
 */
public class BloodGlucoseUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/blood-glucose-1.0.json";


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

        new BloodGlucose.Builder(null);
    }

    @Test
    public void buildShouldConstructMeasureUsingOnlyRequiredProperties() {

        TypedUnitValue<BloodGlucoseUnit> bloodGlucoseLevel = new TypedUnitValue<>(MILLIGRAMS_PER_DECILITER, 110);

        BloodGlucose bloodGlucose = new BloodGlucose.Builder(bloodGlucoseLevel).build();

        assertThat(bloodGlucose, notNullValue());
        assertThat(bloodGlucose.getBloodGlucose(), equalTo(bloodGlucoseLevel));
        assertThat(bloodGlucose.getBloodSpecimenType(), nullValue());
        assertThat(bloodGlucose.getTemporalRelationshipToMeal(), nullValue());
        assertThat(bloodGlucose.getTemporalRelationshipToSleep(), nullValue());
        assertThat(bloodGlucose.getEffectiveTimeFrame(), nullValue());
        assertThat(bloodGlucose.getDescriptiveStatistic(), nullValue());
        assertThat(bloodGlucose.getUserNotes(), nullValue());
    }

    @Test
    public void buildShouldConstructMeasureUsingOptionalProperties() {

        TypedUnitValue<BloodGlucoseUnit> bloodGlucoseLevel = new TypedUnitValue<>(MILLIGRAMS_PER_DECILITER, 110);

        BloodGlucose bloodGlucose = new BloodGlucose.Builder(bloodGlucoseLevel)
                .setBloodSpecimenType(WHOLE_BLOOD)
                .setTemporalRelationshipToMeal(FASTING)
                .setTemporalRelationshipToSleep(BEFORE_SLEEPING)
                .setEffectiveTimeFrame(FIXED_MONTH)