Skip to content

Commit

Permalink
qa: refactor catalog conformance tests with clear exception type expe…
Browse files Browse the repository at this point in the history
…ctations
  • Loading branch information
groldan committed Dec 7, 2023
1 parent 4fcd6c6 commit fe24c66
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ void default_admin_bad_credentials() {
context -> {
assertThat(context).hasNotFailed();
Authentication token = userNamePasswordToken("admin", "badPWD");
EnvironmentAdminAuthenticationProvider envAuthProvider = envAuthProvider(context);
EnvironmentAdminAuthenticationProvider envAuthProvider =
envAuthProvider(context);

assertThrows(
InternalAuthenticationServiceException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ public void validate(StoreInfo store, boolean isNew) {
if (isNew) {
newObjectPropertiesResolver.resolve(store);
}
checkNotEmpty(store.getName(), "Store name must not be null");
checkNotNull(store.getWorkspace(), "Store must be part of a workspace");
// note: throwing IAE if null to match CatalogImpl's behavior, though it should be NPE
checkArgument(null != store.getName(), "Store name must not be null");
checkNotEmpty(store.getName(), "Store name must not be empty");
checkArgument(null != store.getWorkspace(), "Store must be part of a workspace");

WorkspaceInfo workspace = store.getWorkspace();
StoreInfo existing = catalog.getStoreByName(workspace, store.getName(), StoreInfo.class);
Expand All @@ -154,8 +156,8 @@ public void validate(ResourceInfo resource, boolean isNew) {
&& coverage.getNativeCoverageName() != null)) {
throw new NullPointerException("Resource native name must not be null");
}
checkNotNull(resource.getStore(), "Resource must be part of a store");
checkNotNull(resource.getNamespace(), "Resource must be part of a namespace");
checkArgument(null != resource.getStore(), "Resource must be part of a store");
checkArgument(null != resource.getNamespace(), "Resource must be part of a namespace");

StoreInfo store = resource.getStore();
ResourceInfo existing =
Expand Down
Loading

0 comments on commit fe24c66

Please sign in to comment.