package fr.umlv.util;

import org.junit.Test;

import static org.junit.Assert.*;

public class Hash3Test {
  @Test(expected=RuntimeException.class)
  public void testHash3() {
    new Hash3(-2);
  }
  
  @Test
  public void testSize() {
    Hash3 hash = new Hash3(4);
    hash.add("foo");
    hash.add("bar");
    assertEquals(hash.size(), 2);
  }
  
  @Test(expected=NullPointerException.class)
  public void testAddNull() {
    Hash3 hash = new Hash3(4);
    hash.add(null);
  }
  
  @Test(expected=NullPointerException.class)
  public void testContainsNull() {
    Hash3 hash = new Hash3(4);
    hash.contains(null);
  }
  
  @Test
  public void testContainsFalse() {
    Hash3 hash = new Hash3(4);
    assertFalse(hash.contains("foobar"));
  }
  
  @Test
  public void testContainsTrue() {
    Hash3 hash = new Hash3(4);
    hash.add("baz");
    assertTrue(hash.contains("baz"));
  }
}
