diff --git a/src/test/java/com/loafle/overflow/module/sensor/service/SensorItemServiceTest.java b/src/test/java/com/loafle/overflow/module/sensor/service/SensorItemServiceTest.java index f1023e3..f824428 100644 --- a/src/test/java/com/loafle/overflow/module/sensor/service/SensorItemServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/sensor/service/SensorItemServiceTest.java @@ -5,6 +5,8 @@ import com.loafle.overflow.module.sensor.model.Sensor; import com.loafle.overflow.module.sensor.model.SensorItem; import com.loafle.overflow.spring.AppConfig; import com.loafle.overflow.spring.JdbcConfiguration; +import com.loafle.overflow.spring.MailConfiguration; +import org.codehaus.jackson.map.ObjectMapper; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -13,14 +15,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import java.io.IOException; import java.util.Date; +import java.util.List; /** * Created by insanity on 17. 6. 28. */ @Ignore @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class}) public class SensorItemServiceTest { @Autowired SensorItemService sensorItemService; @@ -45,4 +49,15 @@ public class SensorItemServiceTest { SensorItem res = this.sensorItemService.read("1"); Assert.assertNotNull(res); } + + @Test + public void readAllBySensor() throws IOException { + Sensor sensor = new Sensor(); + sensor.setId(1); + List sensorItems = this.sensorItemService.readAllBySensor(sensor); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(sensorItems); + System.out.println(json); + } } diff --git a/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java b/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java index 9e8ba5e..69da21a 100644 --- a/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/sensor/service/SensorServiceTest.java @@ -50,6 +50,12 @@ public class SensorServiceTest { public void read() throws Exception { Sensor res = this.sensorService.read("1"); Assert.assertNotNull(res); + + ObjectMapper objectMapper = new ObjectMapper(); + + String json = objectMapper.writeValueAsString(res); + + System.out.println(json); } @Test