Skip to content
Snippets Groups Projects
Select Git revision
  • ac3e362037a1b31c36a2dc49eb38320cf4906e79
  • main default protected
  • correction_video
  • going_further
  • ImprovedMouseInteraction
  • final2023
  • template
  • ModifGUI
8 results

Controller.java

Blame
  • Forked from LABOUREL Arnaud / Game of life Template
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ByteGrayColorTest.java 772 B
    import org.junit.jupiter.api.Test;
    
    import static org.hamcrest.MatcherAssert.assertThat;
    import static org.hamcrest.Matchers.*;
    
    public class ByteGrayColorTest {
      @Test
      public void testGetLuminosity_whenColorCreatedWithGrayLevel(){
        ByteGrayColor black = new ByteGrayColor(0);
        ByteGrayColor white = new ByteGrayColor(255);
        assertThat(black.getLuminosity(), is(closeTo(0.,.0001)));
        assertThat(white.getLuminosity(), is(closeTo(1.,.0001)));
      }
    
      @Test
      public void testGetLuminosity_whenColorCreatedWithLuminosity(){
        ByteGrayColor color1 = new ByteGrayColor(.25);
        ByteGrayColor color2 = new ByteGrayColor(.75);
        assertThat(color1.getLuminosity(), is(closeTo(.25,.0001)));
        assertThat(color2.getLuminosity(), is(closeTo(.75,.0001)));
      }
    }