import ge.edu.freeuni.sdp.iot.simulator.bath.model.LightSwitch;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Test;

import javax.validation.OverridesAttribute;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;

import static org.junit.Assert.*;

import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;

import static org.junit.Assert.assertEquals;

public class LightSwitchTest extends JerseyTest {

    @Override
    protected Application configure() {
        return new ResourceConfig(LightSwitch.class);
    }

    @Test
    public void testAddMeasurement(){
        LightSwitch switch1 = new LightSwitch("8");
        Entity<LightSwitch> switchEntity = Entity.entity(switch1, MediaType.APPLICATION_JSON);
        Response response = target("house/8").request(MediaType.APPLICATION_JSON).header("Origin", "http://localhost:8080")
                .post(switchEntity, Response.class);
        assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
    }
}

@@ -42,25 +42,169 @@
 ath.
-model.LightSwitch
+jaxb.LightSwitchPostRequest;%0Aimport ge.edu.freeuni.sdp.iot.simulator.bath.model.LightSwitch;%0Aimport ge.edu.freeuni.sdp.iot.simulator.bath.service.BathroomService
 ;%0Aim
@@ -727,27 +727,31 @@
 eConfig(
-LightSwitch
+BathroomService
 .class);
@@ -806,16 +806,17 @@
 ment()%7B%0A
+%0A
         
@@ -830,37 +830,119 @@
 itch
- switch1 = new LightSwitch(%228
+PostRequest lightSwitchPostRequest = new LightSwitchPostRequest();%0A        lightSwitchPostRequest.setStatus(%22ON
 %22);%0A
@@ -967,16 +967,27 @@
 htSwitch
+PostRequest
 %3E switch
@@ -1013,15 +1013,30 @@
 ity(
-switch1
+lightSwitchPostRequest
 , Me
@@ -1102,15 +1102,25 @@
 et(%22
-house/8
+bath/light-switch
 %22).r
@@ -1157,50 +1157,8 @@
 SON)
-.header(%22Origin%22, %22http://localhost:8080%22)
 %0A   

test added