package jp.agentec.sinaburocast.common.util;

import java.util.Properties;

import junit.framework.TestCase;
import junit.framework.TestSuite;

public class PropertyUtilTest extends TestCase {

	public PropertyUtilTest(String string) {
		super(string);
	}

	public static TestSuite suite() {
		TestSuite suite = new TestSuite("PropertyUtilTest");
		suite.addTest(new PropertyUtilTest("testGetProperty"));
		suite.addTest(new PropertyUtilTest("testGetList"));
		suite.addTest(new PropertyUtilTest("testGetProperties"));
		return suite;
	}

	public void testGetProperty() {
		assertEquals("This property is only for junit test.", PropertyUtil.getProperty("TestForJUnit"));
		assertEquals("This property is only for junit test.", PropertyUtil.getProperty("TestForJUnit"));
		assertEquals("", PropertyUtil.getProperty("notExist", "TestForJUnit", true));
		assertEquals("", PropertyUtil.getProperty("test", "NotExist", true));
	}

	public void testGetList() {
		assertEquals("[flv, wmv]", PropertyUtil.getList("TestForJUnits").toString());
		assertEquals("[]", PropertyUtil.getList("TestForJUnitA").toString());
	}

	public void testGetProperties() {
		Properties p = PropertyUtil.getProperties("sinaburocast", true);
		assertEquals("This property is only for junit test.", p.get("TestForJUnit"));
	}

}