Skip to content
This repository was archived by the owner on Dec 12, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ import org.testng.annotations.BeforeClass
import org.testng.annotations.BeforeTest

import static com.stormpath.sdk.application.Applications.newCreateRequestFor
import static org.testng.Assert.assertEquals
import static org.testng.Assert.assertTrue
import static org.testng.Assert.*

abstract class ClientIT {

Expand Down Expand Up @@ -167,28 +166,22 @@ abstract class ClientIT {
}

protected void getDeletedResourceError(String href, Class resourceClass){
Throwable e = null;
try {
client.getResource(href, resourceClass)
fail("should have thrown ResourceException")
} catch (ResourceException re) {
e = re
assertEquals(re.status, 404)
assertEquals(re.getCode(), 404)
}

assertTrue(e instanceof ResourceException)
}

protected void updatedSaveableError(Saveable input, int expectedErrorCode){
Throwable e = null;
protected void updatedSaveableError(Saveable input, int expectedErrorCode) {
try {
input.save()
fail("should have thrown ResourceException")
} catch (ResourceException re) {
e = re
assertEquals(re.status, 400)
assertEquals(re.getCode(), expectedErrorCode)
}

assertTrue(e instanceof ResourceException)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ class RegisteredSamlServiceProviderIT extends AbstractSamlIT {

@Test
void testUniquenessOfRegisteredSamlServiceProviders() {
def registeredSamlServiceProvider = createRegisteredSamlServiceProvider()

def registeredSamlServiceProvider2 = createRegisteredSamlServiceProvider()

registeredSamlServiceProvider.setEntityId(registeredSamlServiceProvider2.getEntityId())

updatedSaveableError(registeredSamlServiceProvider, 10110)
}

RegisteredSamlServiceProvider createRegisteredSamlServiceProvider() {
def registeredSamlServiceProvider = client.instantiate(RegisteredSamlServiceProvider)
registeredSamlServiceProvider
.setName("testName")
Expand All @@ -83,8 +93,7 @@ class RegisteredSamlServiceProviderIT extends AbstractSamlIT {

assertRegisteredSAMLServiceProviderFields(registeredSamlServiceProviderReturned, registeredSamlServiceProvider)

registeredSamlServiceProvider.setEntityId(registeredSamlServiceProvider.getEntityId())
updatedSaveableError(registeredSamlServiceProvider, 10110)
return registeredSamlServiceProviderReturned
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class HttpHeaders implements MultiValueMap<String, String> {

public static final String STORMPATH_AGENT = "X-Stormpath-Agent";

public static final String STORMPATH_CLIENT_REQUEST_ID = "X-Stormapth-Client-Request-Id";
public static final String STORMPATH_CLIENT_REQUEST_ID = "X-Stormpath-Client-Request-Id";

private static final String[] DATE_FORMATS = new String[]{
"EEE, dd MMM yyyy HH:mm:ss zzz",
Expand Down