diff --git a/databricks-sdk-java/src/test/java/com/databricks/sdk/core/DatabricksConfigTest.java b/databricks-sdk-java/src/test/java/com/databricks/sdk/core/DatabricksConfigTest.java index 8a4e6663..844cc288 100644 --- a/databricks-sdk-java/src/test/java/com/databricks/sdk/core/DatabricksConfigTest.java +++ b/databricks-sdk-java/src/test/java/com/databricks/sdk/core/DatabricksConfigTest.java @@ -137,4 +137,24 @@ public void testDiscoveryEndpoint() throws IOException { assertEquals(oidcEndpoints.getTokenEndpoint(), "https://test.auth.endpoint/oidc/v1/token"); } } + + @Test + public void testNewWithWorkspaceHost() { + DatabricksConfig config = + new DatabricksConfig() + .setAuthType("oauth-m2m") + .setClientId("my-client-id") + .setClientSecret("my-client-secret") + .setAccountId("account-id") + .setHost("https://account.cloud.databricks.com"); + String workspaceHost = "https://workspace.cloud.databricks.com"; + + DatabricksConfig newWorkspaceConfig = config.newWithWorkspaceHost(workspaceHost); + + assert newWorkspaceConfig.getHost().equals(workspaceHost); + assert newWorkspaceConfig.getAuthType().equals("oauth-m2m"); + assert newWorkspaceConfig.getClientId().equals("my-client-id"); + assert newWorkspaceConfig.getClientSecret().equals("my-client-secret"); + assert newWorkspaceConfig.getAccountId() == null; + } }