Skip to content
Merged
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
41 changes: 39 additions & 2 deletions src/test/java/zowe/client/sdk/core/ZosConnectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
*/
package zowe.client.sdk.core;

import kong.unirest.core.Cookie;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
import kong.unirest.core.Cookie;

/**
* Unit tests for the equals() and hashCode() implementations of ZosConnection.
Expand Down Expand Up @@ -298,6 +301,40 @@ void tstEqualsIsReflexiveSymmetricAndConsistentSuccess() {
assertNotEquals(null, conn1, "object must not equal null");
}

@Test
void tstGetZosmfUrlWithoutBasePathSuccess() {
final ZosConnection conn = ZosConnectionFactory
.createBasicConnection("myhost", 443, "user", "pass");

assertEquals("https://myhost:443/zosmf", conn.getZosmfUrl());
}

@Test
void tstGetZosmfUrlWithBasePathSuccess() {
final ZosConnection conn = ZosConnectionFactory
.createBasicConnection("myhost", 443, "user", "pass", "/custom/api");

assertEquals("https://myhost:443/custom/api/zosmf", conn.getZosmfUrl());
}

@Test
void tstGetZosmfUrlBasePathNormalizationNoDoubleSlashSuccess() {
final ZosConnection conn = ZosConnectionFactory
.createBasicConnection("myhost", 443, "user", "pass", "custom/api/");

assertEquals("https://myhost:443/custom/api/zosmf", conn.getZosmfUrl());
}

@Test
void tstGetZosmfUrlWithNonStandardPortSuccess() {
final ZosConnection conn = ZosConnectionFactory
.createBasicConnection("zos.example.com", 1443, "user", "pass");

assertEquals("https://zos.example.com:1443/zosmf", conn.getZosmfUrl());
}



@Test
void tstInvalidPortNumbersFailure() {
// capture and verify port out of range
Expand Down
Loading