<commit_before>package com.skraylabs.poker.model;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class PocketTest {

  @Rule public ExpectedException exception = ExpectedException.none();

  Pocket fixedPocket;
  Card card1;
  Card card2;

  /**
   * Set up shared test fixture.
   * 
   * <p>Use common Pocket object with predictable Card objects populated.
   *
   * @throws Exception shouldn't happen.
   */
  @Before
  public void setUp() throws Exception {
    card1 = new Card(Rank.Ace, Suit.Hearts);
    card2 = new Card(Rank.Ace, Suit.Diamonds);
    fixedPocket = new Pocket(card1, card2);
  }

  @Test
  public void testCopyConstructor_success() {
    // Exercise
    Pocket pocket = new Pocket(fixedPocket);
    // Verify
    assertThat(pocket, equalTo(fixedPocket));
  }

  @Test
  public void testCopyConstructor_null() {
    // Verify
    exception.expect(NullPointerException.class);
    // Exercise
    @SuppressWarnings("unused")
    Pocket pocket = new Pocket(null);
  }

  @Test
  public void testEquals_same() {
    // Set up
    Pocket equivalentPocket = new Pocket(card1, card2);
    // Exercise
    boolean equals = fixedPocket.equals(equivalentPocket);
    // Verify
    assertThat(equals, is(true));
  }

  @Test
  public void testEquals_null() {
    // Exercise
    boolean equals = fixedPocket.equals(null);
    // Verify
    assertThat(equals, is(false));
  }

  @Test
  public void testEquals_different1() {
    // Set up
    Pocket differentPocket = new Pocket();
    // Exercise
    boolean equals = fixedPocket.equals(differentPocket);
    // Verify
    assertThat(equals, is(false));
  }

  @Test
  public void testEquals_different2() {
    // Set up
    Pocket differentPocket =
        new Pocket(new Card(Rank.Ace, Suit.Spades), new Card(Rank.Ace, Suit.Clubs));
    // Exercise
    boolean equals = fixedPocket.equals(differentPocket);
    // Verify
    assertThat(equals, is(false));
  }

  @Test
  public void testEquals_different3() {
    // Set up
    Pocket differentPocket = new Pocket(card2, card1);
    // Exercise
    boolean equals = fixedPocket.equals(differentPocket);
    // Verify
    assertThat(equals, is(false));
  }

}<commit_msg>PocketTest: add extensive testing for helper method.<commit_after>package com.skraylabs.poker.model;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class PocketTest {

  @Rule public ExpectedException exception = ExpectedException.none();

  Pocket fixedPocket;
  Card card1;
  Card card2;

  /**
   * Set up shared test fixture.
   * 
   * <p>Use common Pocket object with predictable Card objects populated.
   *
   * @throws Exception shouldn't happen.
   */
  @Before
  public void setUp() throws Exception {
    card1 = new Card(Rank.Ace, Suit.Hearts);
    card2 = new Card(Rank.Ace, Suit.Diamonds);
    fixedPocket = new Pocket(card1, card2);
  }

  @Test
  public void testCopyConstructor_success() {
    // Exercise
    Pocket pocket = new Pocket(fixedPocket);
    // Verify
    assertThat(pocket, equalTo(fixedPocket));
  }

  @Test
  public void testCopyConstructor_null() {
    // Verify
    exception.expect(NullPointerException.class);
    // Exercise
    @SuppressWarnings("unused")
    Pocket pocket = new Pocket(null);
  }

  @Test
  public void testEquals_same() {
    // Set up
    Pocket equivalentPocket = new Pocket(card1, card2);
    // Exercise
    boolean equals = fixedPocket.equals(equivalentPocket);
    // Verify
    assertThat(equals, is(true));
  }

  @Test
  public void testEquals_null() {
    // Exercise
    boolean equals = fixedPocket.equals(null);
    // Verify
    assertThat(equals, is(false));
  }

  @Test
  public void testEquals_different1() {
    // Set up
    Pocket differentPocket = new Pocket();
    // Exercise
    boolean equals = fixedPocket.equals(differentPocket);
    // Verify
    assertThat(equals, is(false));
  }

  @Test
  public void testEquals_different2() {
    // Set up
    Pocket differentPocket =
        new Pocket(new Card(Rank.Ace, Suit.Spades), new Card(Rank.Ace, Suit.Clubs));
    // Exercise
    boolean equals = fixedPocket.equals(differentPocket);
    // Verify
    assertThat(equals, is(false));
  }

  @Test
  public void testEquals_different3() {
    // Set up
    Pocket differentPocket = new Pocket(card2, card1);
    // Exercise
    boolean equals = fixedPocket.equals(differentPocket);
    // Verify
    assertThat(equals, is(false));
  }

  @Test
  public void testCardsAreEqual_bothNull() {
    // Exercise
    boolean equal = Pocket.cardsAreEqual(null, null);
    // Verify
    assertThat(equal, is(true));
  }

  @Test
  public void testCardsAreEqual_firstNullSecondNonNull() {
    // Exercise
    boolean equal = Pocket.cardsAreEqual(null, card2);
    // Verify
    assertThat(equal, is(false));
  }

  @Test
  public void testCardsAreEqual_firstNonNullSecondNull() {
    // Exercise
    boolean equal = Pocket.cardsAreEqual(card1, null);
    // Verify
    assertThat(equal, is(false));
  }

  @Test
  public void testCardsAreEqual_equal() {
    // Exercise
    boolean equal = Pocket.cardsAreEqual(new Card(card1), new Card(card1));
    // Verify
    assertThat(equal, is(true));
  }

  @Test
  public void testCardsAreEqual_notEqual() {
    // Exercise
    boolean equal = Pocket.cardsAreEqual(card1, card2);
    // Verify
    assertThat(equal, is(false));
  }
}
{'fraction_non_alphanumeric': 0.11026484334429634, 'fraction_numerical': 0.005539207200969361, 'mean_word_length': 3.1869565217391305, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2492409', 'n_tokens_mistral': 1855, 'n_tokens_neox': 1819, 'n_words': 426}