-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Amanda D'Errico <[email protected]>
- Loading branch information
1 parent
60e1c67
commit 0fa4f7b
Showing
3 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../src/test/java/org/zowe/apiml/zaasclient/service/internal/ZaasClientApimlBaseUrlTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
*/ | ||
|
||
package org.zowe.apiml.zaasclient.service.internal; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.zowe.apiml.zaasclient.config.ConfigProperties; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
class ZaasClientApimlBaseUrlTest { | ||
|
||
private static final String ZOWE_V2_BASE_URL = "/gateway/api/v1/auth"; | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"/api/v1/gateway/auth", "api/v1/gateway/auth", "/gateway/api/v1/auth", "gateway/api/v1/auth"}) | ||
void givenBaseUrl_thenTransformToOrDontChangeZoweV2BaseUrl(String baseUrl) { | ||
ConfigProperties configProperties = new ConfigProperties(); | ||
configProperties.setApimlBaseUrl(baseUrl); | ||
assertThat(configProperties.getApimlBaseUrl(), is(ZOWE_V2_BASE_URL)); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"/api/v1/zaasClient/auth", "api.v1.zaasClient.auth"}) | ||
void givenBaseUrl_thenDontChangeBaseUrl(String baseUrl) { | ||
ConfigProperties configProperties = new ConfigProperties(); | ||
configProperties.setApimlBaseUrl(baseUrl); | ||
assertThat(configProperties.getApimlBaseUrl(), is(baseUrl)); | ||
} | ||
|
||
@Test | ||
void givenBaseUrlIsNull_thenTransformToZoweV2BaseUrl() { | ||
ConfigProperties configProperties = new ConfigProperties(); | ||
configProperties.setApimlBaseUrl(null); | ||
assertThat(configProperties.getApimlBaseUrl(), is(ZOWE_V2_BASE_URL)); | ||
} | ||
} |