@Test
public void testHasExactThrowsExceptionWhenNIsNegative() {

  try {
    Patterns.hasExact(-1);
    fail();
  } catch (IllegalArgumentException e) {
    assertEquals("n < 0", e.getMessage());
  }
}