package org.mahjong4j.hands;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.mahjong4j.tile.MahjongTile.*;

/**
 * @author yu1ro
 */
public class KantsuOpenTest {
    boolean open = true;
    private Kantsu one;
    private Kantsu four;
    private Kantsu fls;

    @Before
    public void setUp() throws Exception {
        one = new Kantsu(open, M1);
        four = new Kantsu(open, M2, M2, M2, M2);
        fls = new Kantsu(open, S1, S1, S1, S2);
    }

    @Test
    public void testCheckTrue() throws Exception {
        assertTrue(Kantsu.check(S2, S2, S2, S2));
    }

    @Test
    public void testCheckFour() throws Exception {
        assertFalse(Kantsu.check(S2, S2, M4, S2));
    }

    @Test
    public void testCheckFls() throws Exception {

    }

    @Test
    public void testGetTileOne() throws Exception {
        assertEquals(M1, one.getTile());
    }

    @Test
    public void testGetTileFour() throws Exception {
        assertEquals(M2, four.getTile());
    }

    @Test
    public void testGetTileFls() throws Exception {
        assertNull(fls.getTile());
    }

    @Test
    public void testGetIsMentsuOne() throws Exception {
        assertTrue(one.getIsMentsu());
    }

    @Test
    public void testGetIsMentsuFour() throws Exception {
        assertTrue(four.getIsMentsu());
    }

    @Test
    public void testGetIsMentsuFls() throws Exception {
        assertFalse(fls.getIsMentsu());
    }

    @Test
    public void testGetIsOpenOne() throws Exception {
        assertTrue(one.getIsOpen());
    }

    @Test
    public void testGetIsOpen4() throws Exception {
        assertTrue(four.getIsOpen());
    }

    @Test
    public void testGetIsOpenF() throws Exception {
        assertTrue(fls.getIsOpen());
    }
}
@@ -396,17 +396,17 @@
 (open, M
-1
+2
 );%0A     
@@ -893,17 +893,17 @@
 Equals(M
-1
+2
 , one.ge
@@ -1793,10 +1793,330 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testEquals() throws Exception %7B%0A        assertTrue(one.equals(four));%0A        assertFalse(one.equals(fls));%0A    %7D%0A%0A    @Test%0A    public void testHashCode() throws Exception %7B%0A        assertEquals(one.hashCode(), four.hashCode());%0A        assertNotEquals(one.hashCode(), fls.hashCode());%0A    %7D
 %0A%7D

add Kantsu equals and hashCode test