### Question:
Validator { public static void checkEquals( @Nullable String value, String propertyName, String expectedValue) { Preconditions.checkNotNull(value, "Property '" + propertyName + "' cannot be null"); Preconditions.checkArgument( value.equals(expectedValue), "Property '" + propertyName + "' must be '" + expectedValue + "' but is '" + value + "'"); }  static void checkNotNullAndNotEmpty(@Nullable String value, String propertyName); static void checkNullOrNotEmpty(@Nullable String value, String propertyName); static void checkNotNullAndNotEmpty(@Nullable Collection<?> value, String propertyName); static void checkNullOrNonNullNonEmptyEntries(
      @Nullable Collection<String> values, String propertyName); static void checkNullOrNonNullNonEmptyEntries(
      @Nullable Map<String, String> values, String propertyName); static void checkNullOrNonNullEntries(
      @Nullable Collection<?> values, String propertyName); static void checkEquals(
      @Nullable String value, String propertyName, String expectedValue);  }### Answer:
@Test public void testCheckEquals_pass() { Validator.checkEquals("value", "ignored", "value"); }
@Test public void testCheckEquals_failsNull() { try { Validator.checkEquals(null, "test", "something"); Assert.fail(); } catch (NullPointerException npe) { Assert.assertEquals("Property 'test' cannot be null", npe.getMessage()); } }
@Test public void testCheckEquals_failsNotEquals() { try { Validator.checkEquals("somethingElse", "test", "something"); Assert.fail(); } catch (IllegalArgumentException iae) { Assert.assertEquals( "Property 'test' must be 'something' but is 'somethingElse'", iae.getMessage()); } }