package com.szpg.db.test;

import static org.junit.Assert.assertEquals;

import java.util.Calendar;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.szpg.db.dao.PgCh4Dao;
import com.szpg.db.dao.impl.PgCh4DaoImpl;
import com.szpg.util.TimeFormat;

public class PgCH4DaoTest {
	
	private PgCh4Dao dao;

	@Before
	public void setUp() throws Exception {
		dao = new PgCh4DaoImpl();
	}

//	@Test
	public void testAddParamRecord() {
		assertEquals(1, dao.addPblzRecord((float) 35.5, TimeFormat.formatTimestamp(Calendar.getInstance().getTime()), 1));
	}

	@Test
	public void testFindAllParam() {
		assertEquals("20180115171555", dao.findAllPblz().get(0).getTmStrGB());
	}
	
	@Test
	public void testFindParamById() {
		Assert.assertEquals(dao.findPblzById(2).getTmStrGB(), "20180115171555");
	}
	
//	@Test
	public void testAddStatusRecord() {
		assertEquals(2, dao.addSbjzRecord(false, TimeFormat.formatTimestamp(Calendar.getInstance().getTime()), 1));
	}

	@Test
	public void testFindAllStatus() {
		assertEquals("20180115183307", dao.findAllSbjz().get(0).getTmStrGB());
	}
	
	@Test
	public void testFindStatusById() {
		Assert.assertEquals(dao.findSbjzById(1).getTmStrGB(), "20180115183307");
	}

}
