/**
 * Copyright (C) 2013 Motown.IO (info@motown.io)
 *
 * 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 io.motown.domain.api.chargingstation;

import org.junit.Test;

import static io.motown.domain.api.chargingstation.test.ChargingStationTestUtils.CHARGING_STATION_ID;

public class RequestDiagnosticsCommandTest {

    @Test(expected = NullPointerException.class)
    public void nullPointerExceptionThrownWhenCreatingCommandWithChargingStationIdNull() {
        new RequestDiagnosticsCommand(null, null, null, null, null, null);
    }

    @Test(expected = NullPointerException.class)
    public void illegalArgumentExceptionThrownWhenCreatingCommandWithoutUploadLocation() {
        new RequestDiagnosticsCommand(CHARGING_STATION_ID, null, null, null, null, null);
    }
}

@@ -683,16 +683,40 @@
 .Test;%0A%0A
+import java.util.Date;%0A%0A
 import s
@@ -813,53 +813,679 @@
 ID;%0A
-%0Apublic class RequestDiagnosticsCommandTest %7B
+import static io.motown.domain.api.chargingstation.test.ChargingStationTestUtils.FIVE_MINUTES_AGO;%0Aimport static io.motown.domain.api.chargingstation.test.ChargingStationTestUtils.TWO_MINUTES_AGO;%0Aimport static junit.framework.Assert.assertNull;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0A%0Apublic class RequestDiagnosticsCommandTest %7B%0A%0A    private static final String UPLOAD_LOCATION = %22http://localhost/%22;%0A%0A    private static final int NUM_RETRIES = 3;%0A%0A    private static final int RETRY_INTERVAL = 60;%0A%0A    private static final Date START_TIME = FIVE_MINUTES_AGO;%0A%0A    private static final Date END_TIME = TWO_MINUTES_AGO;
 %0A%0A  
@@ -1662,28 +1662,39 @@
 mmand(null, 
-null
+UPLOAD_LOCATION
 , null, null
@@ -1951,10 +1951,2066 @@
 ;%0A    %7D%0A
+%0A    @Test%0A    public void datesShouldNotBeModifiable() %7B%0A        Date startTime = new Date();%0A        Date endTime = new Date();%0A        RequestDiagnosticsCommand command = new RequestDiagnosticsCommand(CHARGING_STATION_ID, UPLOAD_LOCATION, NUM_RETRIES, RETRY_INTERVAL, startTime, endTime);%0A%0A        startTime.setTime(0);%0A        endTime.setTime(0);%0A%0A        assertFalse(startTime.equals(command.getPeriodStartTime()));%0A        assertFalse(endTime.equals(command.getPeriodEndTime()));%0A    %7D%0A%0A    @SuppressWarnings(%22ConstantConditions%22)%0A    @Test%0A    public void exposedDatesShouldNotAffectInternalRepresentation() %7B%0A        RequestDiagnosticsCommand command = new RequestDiagnosticsCommand(CHARGING_STATION_ID, UPLOAD_LOCATION, NUM_RETRIES, RETRY_INTERVAL, START_TIME, END_TIME);%0A%0A        Date startTime = command.getPeriodStartTime();%0A        startTime.setTime(0);%0A        Date endTime = command.getPeriodEndTime();%0A        endTime.setTime(0);%0A%0A        assertFalse(startTime.equals(command.getPeriodStartTime()));%0A        assertFalse(endTime.equals(command.getPeriodEndTime()));%0A    %7D%0A%0A    @Test%0A    public void constructorSetsFields() %7B%0A        RequestDiagnosticsCommand command = new RequestDiagnosticsCommand(CHARGING_STATION_ID, UPLOAD_LOCATION, NUM_RETRIES, RETRY_INTERVAL, START_TIME, END_TIME);%0A%0A        assertEquals(CHARGING_STATION_ID, command.getChargingStationId());%0A        assertEquals(UPLOAD_LOCATION, command.getUploadLocation());%0A        assertEquals(Integer.valueOf(NUM_RETRIES), command.getNumRetries());%0A        assertEquals(Integer.valueOf(RETRY_INTERVAL), command.getRetryInterval());%0A        assertEquals(START_TIME, command.getPeriodStartTime());%0A        assertEquals(END_TIME, command.getPeriodEndTime());%0A    %7D%0A%0A    @Test%0A    public void testNullStartAndEndPeriods() %7B%0A        RequestDiagnosticsCommand command = new RequestDiagnosticsCommand(CHARGING_STATION_ID, UPLOAD_LOCATION, NUM_RETRIES, RETRY_INTERVAL, null, null);%0A%0A        assertNull(command.getPeriodStartTime());%0A        assertNull(command.getPeriodEndTime());%0A    %7D%0A%0A
 %7D%0A

Test for RequestDiagnostics command