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());
    }
}
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, M2);
        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(M2, 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());
    }

    @Test
    public void testEquals() throws Exception {
        assertTrue(one.equals(four));
        assertFalse(one.equals(fls));
    }

    @Test
    public void testHashCode() throws Exception {
        assertEquals(one.hashCode(), four.hashCode());
        assertNotEquals(one.hashCode(), fls.hashCode());
    }
}
add Kantsu equals and hashCode test