package com.platform.test;

import java.util.List;

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

import com.platform.entities.EncodedInfoEntity;
import com.platform.service.EncodeInfoService;

public class TestEncodeService extends SMBasedTest {

	private EncodeInfoService eis;
	private String testTableName;

	@Before
	public void initBeforeFunction() {
		eis = (EncodeInfoService) this.applicationContext
				.getBean("encodeInfoService");
		testTableName = "system_info";
	}

	@Test
	public void testGetEncodeNameByCode() {
		String result = eis.getEncodeNameByCode("2", testTableName);
		Assert.assertTrue(result.equals("部门预算"));
	}

	/**
	 * 事务测试
	 */
	@Test
	public void testDeleteEncodeByCode() {
		eis.deleteEncodeByCode("4", testTableName);
	}

	@Test
	public void testGetAllEncodeInfo() {
		List<EncodedInfoEntity> allEntities = eis
				.getAllEncodeInfo(testTableName);
		System.out.println(allEntities);
		Assert.assertTrue(allEntities.size() >= 1);
	}
}
