示例#1
0
 @Test
 public void should_output_card_suit_and_face_value() throws Exception {
   // given
   final Card cardA3 = card(A, 3);
   // when
   // then
   assertThat(cardA3.toString(), is("A3"));
 }
示例#2
0
 @Test
 public void should_be_unequal_given_different_suit_but_same_face_value_card() throws Exception {
   // given
   final Card cardA3 = card(A, 3);
   final Card cardB3 = card(B, 3);
   // when
   // then
   assertThat(cardA3.equals(cardB3), is(false));
 }
示例#3
0
 @Test
 public void should_be_equal_given_same_suit_and_face_value_card() throws Exception {
   // given
   final Card cardA3 = card(A, 3);
   final Card anotherCardA3 = card(A, 3);
   // when
   // then
   assertThat(cardA3.equals(anotherCardA3), is(true));
 }
示例#4
0
 @Test
 public void should_equal_when_face_value_equal() throws Exception {
   // given
   final Card cardC5 = card(C, 5);
   final Card cardD5 = card(D, 5);
   // when
   final int compareResult = cardC5.compareTo(cardD5);
   // then
   assertThat(compareResult, is(0));
 }
示例#5
0
 @Test
 public void should_less_when_face_value_less() throws Exception {
   // given
   final Card cardC5 = card(C, 5);
   final Card cardC7 = card(C, 7);
   // when
   final int compareResult = cardC5.compareTo(cardC7);
   // then
   assertThat(compareResult, is(-1));
 }