// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.aad.msal4j;
import org.apache.commons.text.StringEscapeUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class WSTrustRequestTest {
@Test
void buildMessage_cloudAudienceUrnNotNull() throws Exception {
String msg = WSTrustRequest.buildMessage("address", "username",
"password", WSTrustVersion.WSTRUST2005, "cloudAudienceUrn").toString();
assertTrue(msg.contains("cloudAudienceUrn"));
}
@Test
void buildMessage_cloudAudienceUrnNull() throws Exception {
String msg = WSTrustRequest.buildMessage("address", "username",
"password", WSTrustVersion.WSTRUST2005, null).toString();
assertTrue(msg.contains("" + WSTrustRequest.DEFAULT_APPLIES_TO + ""));
}
@Test
void buildMessage_cloudAudienceUrnEmpty() throws Exception {
String msg = WSTrustRequest.buildMessage("address", "username",
"password", WSTrustVersion.WSTRUST2005, "").toString();
assertTrue(msg.contains("" + WSTrustRequest.DEFAULT_APPLIES_TO + ""));
}
@Test
void buildMessage_integrated() throws Exception {
String msg = WSTrustRequest.buildMessage("address", null,
null, WSTrustVersion.WSTRUST13, "cloudAudienceUrn").toString();
assertTrue(msg.contains("cloudAudienceUrn"));
assertTrue(!msg.contains("