StringCondition extends BasicCondition<CharSequence, StringCondition> implements StringChecks<StringCondition> { @Override public StringCondition isValidUUID() { require(this.subject).isNotNull(); if (!this.subject.toString().matches(StringChecks.UUID_PATTERN)) { DbcAssertionError.throwNew(new IllegalArgumentException("The provided String is not a valid UUID: " + this.subject), this.message); } return result(); } StringCondition(CharSequence subject); @Override StringCondition isValid(); @Override StringCondition isValidUUID();  }
@Test public void isValidUUID() throws Exception { StringCondition condition = new StringCondition(UUID.randomUUID().toString()); condition.isValidUUID(); StringCondition upperCasedCondition = new StringCondition(UUID.randomUUID().toString().toUpperCase()); upperCasedCondition.isValidUUID(); StringCondition badCondition = new StringCondition(""); Assertions.assertThatThrownBy(badCondition::isValidUUID) .isInstanceOf(DbcAssertionError.class) .hasCauseInstanceOf(IllegalArgumentException.class); }