diff --git a/src/main/java/io/github/robwin/swagger/test/SwaggerAssert.java b/src/main/java/io/github/robwin/swagger/test/SwaggerAssert.java index 4da2ff1..7bf3f9f 100644 --- a/src/main/java/io/github/robwin/swagger/test/SwaggerAssert.java +++ b/src/main/java/io/github/robwin/swagger/test/SwaggerAssert.java @@ -19,11 +19,13 @@ package io.github.robwin.swagger.test; import io.swagger.models.Swagger; +import io.swagger.models.auth.AuthorizationValue; import io.swagger.parser.SwaggerParser; import org.assertj.core.api.AbstractAssert; import java.io.IOException; import java.io.InputStream; +import java.util.List; import java.util.Properties; @@ -85,6 +87,18 @@ public SwaggerAssert isEqualTo(String expectedLocation) { return isEqualTo(new SwaggerParser().read(expectedLocation)); } + /** + * Verifies that the actual value is equal to the given one. + * + * @param expectedLocation the location of the given value to compare the actual value to. + * @param auths List of io.swagger.models.auth.AuthorizationValue for access to protected locations. + * @return {@code this} assertion object. + * @throws AssertionError if the actual value is not equal to the given one or if the actual value is {@code null}.. + */ + public SwaggerAssert isEqualTo(String expectedLocation, List auths) { + return isEqualTo(new SwaggerParser().read(expectedLocation, auths, true)); + } + /** * Verifies that the actual value is equal to the given one. * @@ -109,6 +123,18 @@ public SwaggerAssert satisfiesContract(String expectedLocation) { return satisfiesContract(new SwaggerParser().read(expectedLocation)); } + /** + * Verifies that the actual value is equal to the given one. + * + * @param expectedLocation the location of the given value to compare the actual value to. + * @param auths List of io.swagger.models.auth.AuthorizationValue for access to protected locations. + * @return {@code this} assertion object. + * @throws AssertionError if the actual value is not equal to the given one or if the actual value is {@code null}.. + */ + public SwaggerAssert satisfiesContract(String expectedLocation, List auths) { + return satisfiesContract(new SwaggerParser().read(expectedLocation, auths, true)); + } + private SwaggerAssertionConfig loadSwaggerAssertionFlagsConfiguration(String configurationResourceLocation) { final Properties props = new Properties(); try (final InputStream is = this.getClass().getResourceAsStream(configurationResourceLocation)) {