// 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 static org.openmhealth.schema.domain.omh.PhysicalActivity.SelfReportedIntensity.MODERATE;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.time.LocalDate;
import static java.math.BigDecimal.ONE;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MINIMUM;
import static org.openmhealth.schema.domain.omh.KcalUnit.KILOCALORIE;
import static org.openmhealth.schema.domain.omh.LengthUnit.KILOMETER;
import static org.openmhealth.schema.domain.omh.LengthUnit.MILE;
import static org.openmhealth.schema.domain.omh.PartOfDay.MORNING;
import static org.openmhealth.schema.domain.omh.PhysicalActivity.SelfReportedIntensity.LIGHT;
/*
 * 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 PhysicalActivityUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/physical-activity-1.2.json";

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

        new PhysicalActivity.Builder(null);
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void constructorShouldThrowExceptionOnEmptyActivityName() {

        new PhysicalActivity.Builder("");
    }

    @Test
    public void buildShouldConstructMeasureUsingOnlyRequiredProperties() {

        PhysicalActivity physicalActivity = new PhysicalActivity.Builder("walking").build();

        assertThat(physicalActivity, notNullValue());
        assertThat(physicalActivity.getActivityName(), equalTo("walking"));
        assertThat(physicalActivity.getDistance(), nullValue());
        assertThat(physicalActivity.getReportedActivityIntensity(), nullValue());
        assertThat(physicalActivity.getEffectiveTimeFrame(), nullValue());
        assertThat(physicalActivity.getDescriptiveStatistic(), nullValue());
        assertThat(physicalActivity.getUserNotes(), nullValue());
        assertThat(physicalActivity.getCaloriesBurned(), nullValue());
    }

    @Test
    public void buildShouldConstructMeasureUsingOptionalProperties() {

        LengthUnitValue distance = new LengthUnitValue(KILOMETER, ONE);
        KcalUnitValue caloriesBurned = new KcalUnitValue(KILOCALORIE, 15.7);

        PhysicalActivity physicalActivity = new PhysicalActivity.Builder("walking")
                .setDistance(distance)
                .setReportedActivityIntensity(LIGHT)
// 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/PhysicalActivityUnitTests.java
import static org.openmhealth.schema.domain.omh.PhysicalActivity.SelfReportedIntensity.MODERATE;
import static org.openmhealth.schema.domain.omh.TimeFrameFactory.FIXED_MONTH;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.time.LocalDate;
import static java.math.BigDecimal.ONE;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openmhealth.schema.domain.omh.DescriptiveStatistic.MINIMUM;
import static org.openmhealth.schema.domain.omh.KcalUnit.KILOCALORIE;
import static org.openmhealth.schema.domain.omh.LengthUnit.KILOMETER;
import static org.openmhealth.schema.domain.omh.LengthUnit.MILE;
import static org.openmhealth.schema.domain.omh.PartOfDay.MORNING;
import static org.openmhealth.schema.domain.omh.PhysicalActivity.SelfReportedIntensity.LIGHT;

/*
 * 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 PhysicalActivityUnitTests extends SerializationUnitTests {

    public static final String SCHEMA_FILENAME = "schema/omh/physical-activity-1.2.json";

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

        new PhysicalActivity.Builder(null);
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void constructorShouldThrowExceptionOnEmptyActivityName() {

        new PhysicalActivity.Builder("");
    }

    @Test
    public void buildShouldConstructMeasureUsingOnlyRequiredProperties() {

        PhysicalActivity physicalActivity = new PhysicalActivity.Builder("walking").build();

        assertThat(physicalActivity, notNullValue());
        assertThat(physicalActivity.getActivityName(), equalTo("walking"));
        assertThat(physicalActivity.getDistance(), nullValue());
        assertThat(physicalActivity.getReportedActivityIntensity(), nullValue());
        assertThat(physicalActivity.getEffectiveTimeFrame(), nullValue());
        assertThat(physicalActivity.getDescriptiveStatistic(), nullValue());
        assertThat(physicalActivity.getUserNotes(), nullValue());
        assertThat(physicalActivity.getCaloriesBurned(), nullValue());
    }

    @Test
    public void buildShouldConstructMeasureUsingOptionalProperties() {

        LengthUnitValue distance = new LengthUnitValue(KILOMETER, ONE);
        KcalUnitValue caloriesBurned = new KcalUnitValue(KILOCALORIE, 15.7);

        PhysicalActivity physicalActivity = new PhysicalActivity.Builder("walking")
                .setDistance(distance)
                .setReportedActivityIntensity(LIGHT)
                .setEffectiveTimeFrame(FIXED_MONTH)