package com.jasamedika.medifirst2000.logging;

/**Simple Logging Class Test
 */

import static org.junit.Assert.assertNotNull;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.jasamedika.medifirst2000.logging.dao.LoggingJdbcDaoImpl;
import com.jasamedika.medifirst2000.logging.entities.Logging;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath*:com/jasamedika/**/applicationContext.xml")
public class SimpleLoggingTest {

	@Autowired
	private LoggingJdbcDaoImpl loggingJdbcDaoImpl;

	@Test
	public void testCreate() {
		loggingJdbcDaoImpl.create("nama", "deskripsi");
	}

	@Test
	public void testUpdate() {
		loggingJdbcDaoImpl.update(1, "nama xxx", "deskripsi xxx");
	}

	@Test
	public void testDelete() {
		loggingJdbcDaoImpl.delete(1);
	}

	@Test
	public void testGetAll() {
		List<Logging> results = loggingJdbcDaoImpl.listLoggings();
		assertNotNull(results);
	}

	@Test
	public void testGetById() {
		Logging result = loggingJdbcDaoImpl.getLogging(2);
		assertNotNull(result);
	}
}
