// 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 org.testng.annotations.Test;
import java.time.OffsetDateTime;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MEDIAN;
import static org.openmhealth.schema.domain.omh.TemperatureUnit.CELSIUS;
import static org.openmhealth.schema.domain.omh.TemperatureUnit.FAHRENHEIT;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;
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 AmbientTemperatureUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/ambient-temperature-1.0.json";

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

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

        new AmbientTemperature.Builder(null);
    }

    @Test
    public void buildShouldConstructCorrectMeasureUsingOnlyRequiredProperties() {

        AmbientTemperature ambientTemperature = new AmbientTemperature.Builder(new TemperatureUnitValue(CELSIUS, 50.3))
                .build();

        assertThat(ambientTemperature, notNullValue());
        assertThat(ambientTemperature.getAmbientTemperature().getTypedUnit(), equalTo(CELSIUS));
        assertThat(ambientTemperature.getAmbientTemperature().getValue().doubleValue(), equalTo(50.3));

        assertThat(ambientTemperature.getUserNotes(), nullValue());
        assertThat(ambientTemperature.getEffectiveTimeFrame(), nullValue());
        assertThat(ambientTemperature.getDescriptiveStatistic(), nullValue());
    }

    @Test
// 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/AmbientTemperatureUnitTests.java
import org.testng.annotations.Test;
import java.time.OffsetDateTime;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MEDIAN;
import static org.openmhealth.schema.domain.omh.TemperatureUnit.CELSIUS;
import static org.openmhealth.schema.domain.omh.TemperatureUnit.FAHRENHEIT;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;
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 AmbientTemperatureUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/ambient-temperature-1.0.json";

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

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

        new AmbientTemperature.Builder(null);
    }

    @Test
    public void buildShouldConstructCorrectMeasureUsingOnlyRequiredProperties() {

        AmbientTemperature ambientTemperature = new AmbientTemperature.Builder(new TemperatureUnitValue(CELSIUS, 50.3))
                .build();

        assertThat(ambientTemperature, notNullValue());
        assertThat(ambientTemperature.getAmbientTemperature().getTypedUnit(), equalTo(CELSIUS));
        assertThat(ambientTemperature.getAmbientTemperature().getValue().doubleValue(), equalTo(50.3));

        assertThat(ambientTemperature.getUserNotes(), nullValue());
        assertThat(ambientTemperature.getEffectiveTimeFrame(), nullValue());
        assertThat(ambientTemperature.getDescriptiveStatistic(), nullValue());
    }

    @Test
    public void buildShouldConstructCorrectMeasureIncludingOptionalProperties() {