Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/feast/core/validators/Matchers.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Matchers {
private static Pattern BIGQUERY_TABLE_REF_REGEX =
Pattern.compile("[a-zA-Z0-9-]+[:]+[a-zA-Z0-9_]+[.]+[a-zA-Z0-9_]*");
private static Pattern CLASS_PATH_REGEX =
Pattern.compile("[a-zA-Z_$][a-zA-Z0-9_$]*(\\.[a-zA-Z_$][a-zA-Z0-9_$]*)");
Pattern.compile("[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z_][a-zA-Z0-9_]*)*$");
private static Pattern UPPER_SNAKE_CASE_REGEX = Pattern.compile("^[A-Z0-9]+(_[A-Z0-9]+)*$");
private static Pattern LOWER_SNAKE_CASE_REGEX = Pattern.compile("^[a-z0-9]+(_[a-z0-9]+)*$");
private static Pattern VALID_CHARACTERS_REGEX = Pattern.compile("^[a-zA-Z_][a-zA-Z0-9_]*$");
Expand Down
19 changes: 19 additions & 0 deletions core/src/test/java/feast/core/validators/MatchersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static feast.core.validators.Matchers.checkLowerSnakeCase;
import static feast.core.validators.Matchers.checkUpperSnakeCase;
import static feast.core.validators.Matchers.checkValidClassPath;

import com.google.common.base.Strings;
import org.junit.Rule;
Expand Down Expand Up @@ -70,4 +71,22 @@ public void checkLowerSnakeCaseShouldThrowIllegalArgumentExceptionWithFieldForIn
String in = "Invalid_feature name";
checkLowerSnakeCase(in, "feature");
}

@Test
public void checkValidClassPathSuccess() {
checkValidClassPath("com.example.foo", "FeatureTable");
checkValidClassPath("com.example", "FeatureTable");
}

@Test
public void checkValidClassPathEmpty() {
exception.expect(IllegalArgumentException.class);
checkValidClassPath("", "FeatureTable");
}

@Test
public void checkValidClassPathDigits() {
exception.expect(IllegalArgumentException.class);
checkValidClassPath("123", "FeatureTable");
}
}