package hws.hw4;

import static org.junit.Assert.*;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class WhiteBoxTest {
    FencingEvent event;
    Bout bout;

    // Coverage of the FencingEvent enum
    @Test
    public void FencingEventCoverageTest(){
        event = FencingEvent.FOIL;

        assertTrue(hws.hw4.Test.forEqual(500, event.getMaximumWeight(), "getMaximumWeight()"));
        assertTrue(hws.hw4.Test.forTrue(event.isScoringTouch(BladePart.TIP, BodyPart.TORSO), "isScoringTouch()"));
        assertTrue(hws.hw4.Test.forFalse(event.isScoringTouch(BladePart.EDGE, BodyPart.TORSO), "isScoringTouch()"));
        assertTrue(hws.hw4.Test.forFalse(event.isScoringTouch(BladePart.EDGE, BodyPart.HANDS), "isScoringTouch()"));
        event = FencingEvent.SABRE;
        assertTrue(hws.hw4.Test.forTrue(event.isScoringTouch(BladePart.EDGE, BodyPart.TORSO), "isScoringTouch()"));

    }

    // Coverage of the Bout class
    @Test
    public void BoutCoverageTest(){
        // Coverage of the Bout class
        bout = new Bout(FencingEvent.FOIL, "Bayer", "Kellner");
        assertTrue(hws.hw4.Test.forEqual(FencingEvent.FOIL.toString(), bout.getEvent().toString(), "getEvent()"));
        assertTrue(hws.hw4.Test.forEqual("Bayer", bout.getLeftFencer(), "getLeftFencer()"));
        assertTrue(hws.hw4.Test.forEqual("Kellner", bout.getRightFencer(), "getRightFencer()"));
        assertTrue(hws.hw4.Test.forEqual("Bayer 0, Kellner 0", bout.toString(), "toString()"));
        bout.increaseLeftScore();
        bout.increaseRightScore();
    }

}
