public static void checkNotNullAndNotEmpty(String arg, String argName) {
    checkNotNull(arg, argName);
    checkArgument(
        !arg.isEmpty(),
        "'%s' must not be empty.",
        argName);
  }
@Test
  public void testCheckNotNullAndNotEmpty() throws Exception {
    // Should not throw.
    Validate.checkNotNullAndNotEmpty(NON_EMPTY_ARRAY, "array");
    Validate.checkNotNullAndNotEmpty(NON_EMPTY_BYTE_ARRAY, "array");
    Validate.checkNotNullAndNotEmpty(NON_EMPTY_SHORT_ARRAY, "array");
    Validate.checkNotNullAndNotEmpty(NON_EMPTY_INT_ARRAY, "array");
    Validate.checkNotNullAndNotEmpty(NON_EMPTY_LONG_ARRAY, "array");

    // Verify it throws.

    intercept(IllegalArgumentException.class, "'string' must not be empty",
        () -> Validate.checkNotNullAndNotEmpty("", "string"));

    intercept(IllegalArgumentException.class, "'array' must not be null", () ->
        Validate.checkNotNullAndNotEmpty(SampleDataForTests.NULL_ARRAY,
            "array"));

    intercept(IllegalArgumentException.class,
        "'array' must have at least one element", () ->
            Validate.checkNotNullAndNotEmpty(SampleDataForTests.EMPTY_ARRAY,
                "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must not be null",
        () -> Validate.checkNotNullAndNotEmpty(NULL_BYTE_ARRAY, "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must have at least one element",
        () -> Validate.checkNotNullAndNotEmpty(EMPTY_BYTE_ARRAY, "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must not be null",
        () -> Validate.checkNotNullAndNotEmpty(NULL_SHORT_ARRAY, "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must have at least one element",
        () -> Validate.checkNotNullAndNotEmpty(EMPTY_SHORT_ARRAY, "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must not be null",
        () -> Validate.checkNotNullAndNotEmpty(NULL_INT_ARRAY, "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must have at least one element",
        () -> Validate.checkNotNullAndNotEmpty(EMPTY_INT_ARRAY, "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must not be null",
        () -> Validate.checkNotNullAndNotEmpty(NULL_LONG_ARRAY, "array"));

    ExceptionAsserts.assertThrows(
        IllegalArgumentException.class,
        "'array' must have at least one element",
        () -> Validate.checkNotNullAndNotEmpty(EMPTY_LONG_ARRAY, "array"));
  }