2525 */
2626package xyz .meunier .wav2pzx .blocks ;
2727
28- import java .util .Arrays ;
29- import java .util .Collection ;
3028import org .junit .After ;
3129import org .junit .Before ;
3230import org .junit .Test ;
33-
3431import xyz .meunier .wav2pzx .PulseList ;
35- import xyz .meunier .wav2pzx .blocks .PZXPulseBlock ;
3632
37- import static org .junit .Assert .*;
33+ import java .util .Arrays ;
34+
35+ import static org .hamcrest .CoreMatchers .equalTo ;
36+ import static org .hamcrest .CoreMatchers .is ;
37+ import static org .junit .Assert .assertArrayEquals ;
38+ import static org .junit .Assert .assertThat ;
3839
3940/**
4041 *
@@ -45,9 +46,6 @@ public class PZXPulseBlockTest {
4546 private static final PulseList PULSES = new PulseList (Arrays .asList (200L , 200L , 300L ), 1 , 1 );
4647 private PZXPulseBlock pulseBlock ;
4748
48- public PZXPulseBlockTest () {
49- }
50-
5149 @ Before
5250 public void setUp () {
5351 this .pulseBlock = new PZXPulseBlock (PULSES );
@@ -63,18 +61,14 @@ public void tearDown() {
6361 */
6462 @ Test
6563 public void testGetPulses () {
66- System .out .println ("getPulses" );
67- Collection <Long > expResult = Arrays .asList (200L , 200L , 300L );
68- Collection <Long > result = pulseBlock .getPulses ();
69- assertEquals (expResult , result );
64+ assertThat (pulseBlock .getPulses (), equalTo (Arrays .asList (200L , 200L , 300L )));
7065 }
7166
7267 /**
7368 * Test of getPZXBlockDiskRepresentation method, of class PZXPulseBlock.
7469 */
7570 @ Test
7671 public void testGetPZXBlockDiskRepresentation () {
77- System .out .println ("getPZXBlockDiskRepresentation" );
7872 byte [] expResult = {(byte )80 , (byte )85 , (byte )76 , (byte )83 , /* PULS */
7973 (byte )0x08 , (byte )0x00 , (byte )0x00 , (byte )0x00 , /* Length: 8 bytes */
8074 (byte )0x00 , (byte )0x00 , /* Initial pulse high */
@@ -90,7 +84,6 @@ public void testGetPZXBlockDiskRepresentation() {
9084 */
9185 @ Test
9286 public void testGetPZXBlockDiskRepresentation_PulseList () {
93- System .out .println ("getPZXBlockDiskRepresentation" );
9487 byte [] expResult = {(byte )80 , (byte )85 , (byte )76 , (byte )83 , /* PULS */
9588 (byte )0x08 , (byte )0x00 , (byte )0x00 , (byte )0x00 , /* Length: 8 bytes */
9689 (byte )0x00 , (byte )0x00 , /* Initial pulse high */
@@ -106,32 +99,24 @@ public void testGetPZXBlockDiskRepresentation_PulseList() {
10699 */
107100 @ Test
108101 public void testGetSummary () {
109- System .out .println ("getSummary" );
110- String expResult = "PZXPulseBlock: first pulse level: 1 pulse count: 3" ;
111- String result = pulseBlock .getSummary ();
112- assertEquals (expResult , result );
102+ assertThat (pulseBlock .getSummary (), is ("PZXPulseBlock: first pulse level: 1 pulse count: 3" ));
113103 }
114104
115105 /**
116106 * Test of toString method, of class PZXPulseBlock.
117107 */
118108 @ Test
119109 public void testToString () {
120- System .out .println ("toString" );
121- String expResult = "PZXPulseBlock [pulseList=PulseList [pulseLengths.size()=3, firstPulseLevel=1, resolution=1]]" ;
122- String result = pulseBlock .toString ();
123- assertEquals (expResult , result );
110+ assertThat (pulseBlock .toString (),
111+ is ("PZXPulseBlock [pulseList=PulseList [pulseLengths.size()=3, firstPulseLevel=1, resolution=1]]" ));
124112 }
125113
126114 /**
127115 * Test of getFirstPulseLevel method, of class PZXPulseBlock.
128116 */
129117 @ Test
130118 public void testGetFirstPulseLevel () {
131- System .out .println ("getFirstPulseLevel" );
132- int expResult = 1 ;
133- int result = pulseBlock .getFirstPulseLevel ();
134- assertEquals (expResult , result );
119+ assertThat (pulseBlock .getFirstPulseLevel (), is (1 ));
135120 }
136121
137122}
0 commit comments