package metisto.digisim;

import org.junit.Test;

import static metisto.digisim.Components.and;
import static metisto.digisim.Components.fixed;
import static org.junit.Assert.assertEquals;

public class AndUnitTest {

    @Test
    public void should_return_true_when_all_input_are_true() {
        assertEquals(true, and(fixed(true), fixed(true)).value());
    }

    @Test
    public void should_return_false_when_at_least_one_input_is_false() {
        assertEquals(false, and(fixed(false), fixed(true)).value());
        assertEquals(false, and(fixed(true), fixed(false)).value());
        assertEquals(false, and(fixed(false), fixed(false)).value());
    }

}

@@ -250,202 +250,145 @@
 d_re
-turn_true_when_all_input_are_true() %7B%0A        assertEquals(true, and(fixed(
+spect_and_truth_table() %7B%0A        checkAnd(true, 
 true
-)
 , 
-fixed(true)).value()
+true
 );%0A    
-%7D%0A%0A
     
-@Test%0A    public void should_return_false_when_at_least_one_input_is_
+checkAnd(true, false, false);%0A        checkAnd(false, true, 
 false
-() %7B
+);
 %0A   
@@ -396,137 +396,113 @@
     
-assertEquals(false, and(fixed(
+checkAnd(false, 
 false
-)
 , f
-ixed(true)).value()
+alse
 );%0A    
+%7D%0A%0A
     
-assertEquals(false, and(fixed(true), fixed(false)).value());
+private void checkAnd(boolean a, boolean b, boolean expected) %7B
 %0A   
@@ -519,21 +519,24 @@
 tEquals(
-false
+expected
 , and(fi
@@ -539,21 +539,17 @@
 d(fixed(
-false
+a
 ), fixed
@@ -549,21 +549,17 @@
 , fixed(
-false
+b
 )).value
@@ -569,11 +569,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Refactor unit test