@ParameterizedTest @ArgumentsSource(TestCaseArgumentsProvider.class) @NullValue("NULL") @TestCase({"A.B.C.D", "A", "B", "C", "D"}) @TestCase({"B.C.D", "NULL", "B", "C", "D"}) @TestCase({"C.D", "NULL", "NULL", "C", "D"}) @TestCase({"D", "NULL", "NULL", "NULL", "D"}) void parseString(String input, String expectedCatalog, String expectedSchema, String expectedTable, String expectedName) { ForeignKeyName result = ForeignKeyName.parseString(input); assertThat(result.catalog(), is(Optional.ofNullable(expectedCatalog))); assertThat(result.schema(), is(Optional.ofNullable(expectedSchema))); assertThat(result.tableName(), is(Optional.ofNullable(expectedTable))); assertThat(result.name(), is(expectedName)); }
public static ForeignKeyName parseString(String stringRepresentation) { Matcher matcher = NAME_PATTERN.matcher(stringRepresentation); if (!matcher.matches()) { throw new IllegalArgumentException(stringRepresentation + " is not a valid QualifiedName"); } QualifiedName table = StringUtils.isBlank(matcher.group(1)) ? new QualifiedName("", "", "") : QualifiedName.parseString(matcher.group(1)); return new ForeignKeyName(table, matcher.group(2)); }
ForeignKeyName { public static ForeignKeyName parseString(String stringRepresentation) { Matcher matcher = NAME_PATTERN.matcher(stringRepresentation); if (!matcher.matches()) { throw new IllegalArgumentException(stringRepresentation + " is not a valid QualifiedName"); } QualifiedName table = StringUtils.isBlank(matcher.group(1)) ? new QualifiedName("", "", "") : QualifiedName.parseString(matcher.group(1)); return new ForeignKeyName(table, matcher.group(2)); } }
ForeignKeyName { public static ForeignKeyName parseString(String stringRepresentation) { Matcher matcher = NAME_PATTERN.matcher(stringRepresentation); if (!matcher.matches()) { throw new IllegalArgumentException(stringRepresentation + " is not a valid QualifiedName"); } QualifiedName table = StringUtils.isBlank(matcher.group(1)) ? new QualifiedName("", "", "") : QualifiedName.parseString(matcher.group(1)); return new ForeignKeyName(table, matcher.group(2)); } ForeignKeyName(QualifiedName table, String name); }
ForeignKeyName { public static ForeignKeyName parseString(String stringRepresentation) { Matcher matcher = NAME_PATTERN.matcher(stringRepresentation); if (!matcher.matches()) { throw new IllegalArgumentException(stringRepresentation + " is not a valid QualifiedName"); } QualifiedName table = StringUtils.isBlank(matcher.group(1)) ? new QualifiedName("", "", "") : QualifiedName.parseString(matcher.group(1)); return new ForeignKeyName(table, matcher.group(2)); } ForeignKeyName(QualifiedName table, String name); String toString(); @Override boolean equals(Object o); @Override int hashCode(); QualifiedName table(); String name(); Optional<String> catalog(); Optional<String> schema(); Optional<String> tableName(); static ForeignKeyName parseString(String stringRepresentation); }
ForeignKeyName { public static ForeignKeyName parseString(String stringRepresentation) { Matcher matcher = NAME_PATTERN.matcher(stringRepresentation); if (!matcher.matches()) { throw new IllegalArgumentException(stringRepresentation + " is not a valid QualifiedName"); } QualifiedName table = StringUtils.isBlank(matcher.group(1)) ? new QualifiedName("", "", "") : QualifiedName.parseString(matcher.group(1)); return new ForeignKeyName(table, matcher.group(2)); } ForeignKeyName(QualifiedName table, String name); String toString(); @Override boolean equals(Object o); @Override int hashCode(); QualifiedName table(); String name(); Optional<String> catalog(); Optional<String> schema(); Optional<String> tableName(); static ForeignKeyName parseString(String stringRepresentation);  }