⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configrecordtest.java

📁 mp3的播放
💻 JAVA
字号:
/**************************************************************************
 *	(C) Copyright 2008 by  Tao Liuyuan and Zhang Shuitao.                       *
 *		All Rights Reserved.               								  *
 *     																      *
 *	Project					: KYPlayer     								  *
 *	File					: ConfigRecordTest.java 					  *	
 *	JDK version used        : jdk1.6.0_u4							      *
 * 	Version                 : 1.00				     					  *
 * 	Created				    : 2008.7.6 by we						  *
 *************************************************************************/
package MP3Player;

import static org.junit.Assert.assertEquals;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.URL;

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

/**
 * ConfigRecord测试类 
 * @author  we
 */
public class ConfigRecordTest {

	/**
	 * 默认构造函数生成的对象
	 */
	private ConfigRecord configRecord = new ConfigRecord();
	
	/**
	 * 从文件记录中初始化的对象
	 */
	private ConfigRecord configRecordFromFile;
	
	/**
	 * 初始化configRecordFromFile
	 * @throws Exception
	 */
	@Before
	public void setUp() throws Exception {
		URL url = getClass().getResource("support/ConfigFile");
		File configFile = new File(url.toString().substring(6));

		if (configFile.exists()) {
			try {
				ObjectInputStream input = new ObjectInputStream(
						new FileInputStream(configFile));

				try {
					configRecordFromFile = (ConfigRecord) input.readObject();

				} catch (ClassNotFoundException e) {
					e.printStackTrace();
				}
				input.close();

			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				configRecordFromFile = new ConfigRecord();
				e.printStackTrace();
			}
		} else {
			System.out.println("Config file not exist.");
		}
	}

	@Test
	public final void testGetMediaFile() {
		assertEquals(null, configRecord.getMediaFile());
	}

	@Test
	public final void testIsSoundDisabled() {
		assertEquals(false, configRecord.isSoundDisabled());
		assertEquals(false, configRecordFromFile.isSoundDisabled());
	}

	@Test
	public final void testGetGainLevel() {
		assertEquals(0l, configRecord.getGainLevel());
	}

	@Test
	public final void testIsShowPlayListFrame() {
		assertEquals(true, configRecord.isShowPlayListFrame());
		assertEquals(true, configRecordFromFile.isShowPlayListFrame());
		}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -