added test

sensor
This commit is contained in:
snoop 2017-07-24 18:53:41 +09:00
parent 63ad2929d8
commit 277f4a147b

View File

@ -6,6 +6,8 @@ import com.loafle.overflow.module.sensor.model.Sensor;
import com.loafle.overflow.module.target.model.Target; import com.loafle.overflow.module.target.model.Target;
import com.loafle.overflow.spring.AppConfig; import com.loafle.overflow.spring.AppConfig;
import com.loafle.overflow.spring.JdbcConfiguration; 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.Assert;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
@ -15,13 +17,14 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* Created by insanity on 17. 6. 28. * Created by insanity on 17. 6. 28.
*/ */
@Ignore @Ignore
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) @ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
public class SensorServiceTest { public class SensorServiceTest {
@Autowired @Autowired
SensorService sensorService; SensorService sensorService;
@ -48,4 +51,17 @@ public class SensorServiceTest {
Sensor res = this.sensorService.read("1"); Sensor res = this.sensorService.read("1");
Assert.assertNotNull(res); Assert.assertNotNull(res);
} }
@Test
public void readAllByTarget() throws Exception {
Target target = new Target();
target.setId(1);
List<Sensor> sensors = this.sensorService.readAllByTarget(target);
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(sensors);
System.out.println(json);
}
} }