package examples.pokerhands.model;

import static org.junit.Assert.*;

import org.junit.Test;

public class CardTest {
	
	public Card card = null;

	@Test
	public void testConstructorC2() {
		card = new Card("C2");
		
		assertEquals(Suit.CLUBS, card.getSuit());
		assertEquals(Value.TWO, card.getValue());
	}

	@Test
	public void testConstructorD3() {
		card = new Card("D3");
		
		assertEquals(Suit.DIAMONDS, card.getSuit());
		assertEquals(Value.THREE, card.getValue());
	}
	
    @Test(expected=IllegalArgumentException.class)
	public void testConstructorArgTooShort() throws Exception {
		card = new Card("D");	
	}

    @Test(expected=IllegalArgumentException.class)
	public void testConstructorArgTooLong() throws Exception {
		card = new Card("D33");		
	}

    @Test(expected=IllegalArgumentException.class)
	public void testConstructorWrongSuit() throws Exception {
		card = new Card("X3");		
	}

    @Test(expected=IllegalArgumentException.class)
	public void testConstructorWrongValue() throws Exception {
		card = new Card("SX");		
	}
    
    @Test
	public void testComparableLower() throws Exception {
		Card card1 = new Card("C3");
		Card card2 = new Card("H4");
		
		assertTrue(card1.compareTo(card2) < 0);
	}

    @Test
	public void testComparableHigher() throws Exception {
		Card card1 = new Card("SA");
		Card card2 = new Card("CQ");
		
		assertTrue(card1.compareTo(card2) > 0);
	}

    @Test
	public void testComparableEquals() throws Exception {
		Card card1 = new Card("SK");
		Card card2 = new Card("HK");
		
		assertEquals(0, card1.compareTo(card2));
	}

    @Test
	public void testEquals() throws Exception {
		Card card1 = new Card("S3");
		Card card2 = new Card("S3");
		
		assertEquals(card1, card2);
		
	}
    
    @Test
	public void testNotEqualsValue() throws Exception {
		Card card1 = new Card("S3");
		Card card2 = new Card("S4");
		
		assertNotEquals(card1, card2);
		
	}

    @Test
	public void testNotEqualsSuit() throws Exception {
		Card card1 = new Card("S3");
		Card card2 = new Card("H3");
		
		assertNotEquals(card1, card2);
    }
		
}

@@ -1718,24 +1718,256 @@
 , card2);%0A%09%09
+assertEquals(card1.hashCode(), card2.hashCode());%0A%09%7D%0A%0A    @Test%0A%09public void testEqualsIdentity() throws Exception %7B%0A%09%09Card card1 = new Card(%22S3%22);%0A%09%09%0A%09%09assertEquals(card1, card1);%0A%09%09assertEquals(card1.hashCode(), card1.hashCode());
 %0A%09%7D%0A    %0A   
@@ -2126,16 +2126,68 @@
 rd2);%0A%09%09
+assertNotEquals(card1.hashCode(), card2.hashCode());
 %0A%09%7D%0A%0A   
@@ -2343,16 +2343,71 @@
 card2);%0A
+%09%09assertNotEquals(card1.hashCode(), card2.hashCode());%0A
     %7D%0A%09%09

Add test to increase coverage on hashcode()