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

📄 intqueuetest.java

📁 xstream是一个把java object序列化成xml文件的开源库,轻便好用
💻 JAVA
字号:
package com.thoughtworks.xstream.core.util;import junit.framework.TestCase;public class IntQueueTest extends TestCase {    public void testReadsInSameOrderItemsWereWritten() {        IntQueue q = new IntQueue(4);        assertTrue(q.isEmpty());        q.write(10);        q.write(20);        q.write(30);        assertFalse(q.isEmpty());        assertEquals(10, q.read());        assertEquals(20, q.read());        assertFalse(q.isEmpty());        q.write(40);        q.write(50);        q.write(60);        assertFalse(q.isEmpty());        assertEquals(30, q.read());        assertEquals(40, q.read());        assertEquals(50, q.read());        assertFalse(q.isEmpty());        assertEquals(60, q.read());        assertTrue(q.isEmpty());    }    public void testThrowsExceptionIfSizeExceeded() {        IntQueue q = new IntQueue(4);        q.write(1);        q.write(2);        q.write(3);        q.write(4);        try {            q.write(5);            fail("Expected exeption");        } catch (IntQueue.OverflowException expectedException) {            // good        }    }    public void testThrowsExceptionWhenReadingNothing() {        IntQueue q = new IntQueue(4);        try {            q.read();            fail("Expected exeption");        } catch (IntQueue.NothingToReadException expectedException) {            // good        }        q.write(1);        q.write(2);        q.read();        q.read();        try {            q.read();            fail("Expected exeption");        } catch (IntQueue.NothingToReadException expectedException) {            // good        }    }}

⌨️ 快捷键说明

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