3 import static org
.junit
.Assert
.assertEquals
;
5 import java
.io
.ByteArrayInputStream
;
6 import java
.io
.ByteArrayOutputStream
;
7 import java
.util
.Iterator
;
9 import org
.junit
.Before
;
10 import org
.junit
.Test
;
14 import dacp
.DACPReader
;
15 import dacp
.DACPWriter
;
17 public class CtrlIntTest
{
20 public CtrlInt output
;
23 public void setUp() throws Exception
{
25 input
= new CtrlInt(1);
27 ByteArrayOutputStream out
= new ByteArrayOutputStream();
28 Writer w
= new DACPWriter(out
);
31 ByteArrayInputStream in
= new ByteArrayInputStream(out
.toByteArray());
32 Reader r
= new DACPReader(in
, in
.available());
34 output
= CtrlInt
.read(r
.nextComposite(r
.iterator().next()));
38 public void testIds() {
39 Iterator
<Integer
> a
= input
.ids().iterator();
40 Iterator
<Integer
> b
= output
.ids().iterator();
41 while (a
.hasNext() && b
.hasNext()) {
42 assertEquals(a
.next(), b
.next());
44 assertEquals(a
.hasNext(), b
.hasNext());