Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved failure message #32

Merged
merged 2 commits into from
Aug 20, 2018
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
175 changes: 0 additions & 175 deletions src/main/java/org/opengis/cite/wfs30/ETSAssert.java

This file was deleted.

32 changes: 32 additions & 0 deletions src/main/java/org/opengis/cite/wfs30/EtsAssert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.opengis.cite.wfs30;

/**
* Provides a set of custom assertion methods.
*
* @author <a href="mailto:[email protected]">Lyn Goltz </a>
*/
public class EtsAssert {

/**
* @param valueToAssert
* the boolean to assert to be <code>true</code>
* @param failureMsg
* the message to throw in case of a failure, should not be <code>null</code>
*/
public static void assertTrue( boolean valueToAssert, String failureMsg ) {
if ( !valueToAssert )
throw new AssertionError( failureMsg );
}

/**
* @param valueToAssert
* the boolean to assert to be <code>false</code>
* @param failureMsg
* the message to throw in case of a failure, should not be <code>null</code>
*/
public static void assertFalse( boolean valueToAssert, String failureMsg ) {
if ( valueToAssert )
throw new AssertionError( failureMsg );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static io.restassured.http.ContentType.JSON;
import static io.restassured.http.Method.GET;
import static org.testng.Assert.assertTrue;
import static org.opengis.cite.wfs30.EtsAssert.assertTrue;

import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -82,7 +82,7 @@ public void landingPageValidation() {
&& linkTypes.contains( "data" );
assertTrue( expectedLinkTypesExists,
"The landing page must include at least links with relation type 'service', 'conformance' and 'data', but contains "
+ linkTypes );
+ String.join( ", ", linkTypes ) );

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import static io.restassured.http.ContentType.JSON;
import static io.restassured.http.Method.GET;
import static org.opengis.cite.wfs30.EtsAssert.assertTrue;
import static org.opengis.cite.wfs30.SuiteAttribute.API_MODEL;
import static org.opengis.cite.wfs30.WFS3.OPEN_API_MIME_TYPE;
import static org.testng.Assert.assertTrue;

import java.net.MalformedURLException;
import java.net.URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.restassured.http.ContentType.JSON;
import static io.restassured.http.Method.GET;
import static org.opengis.cite.wfs30.EtsAssert.assertTrue;
import static org.opengis.cite.wfs30.SuiteAttribute.API_MODEL;
import static org.opengis.cite.wfs30.WFS3.PATH.COLLECTIONS;
import static org.opengis.cite.wfs30.openapi3.OpenApiUtils.retrieveTestPoints;
Expand All @@ -12,7 +13,6 @@
import static org.opengis.cite.wfs30.util.JsonUtils.linkIncludesRelAndType;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.opengis.cite.wfs30.collections;

import static io.restassured.http.Method.GET;
import static org.opengis.cite.wfs30.EtsAssert.assertTrue;
import static org.opengis.cite.wfs30.SuiteAttribute.API_MODEL;
import static org.opengis.cite.wfs30.WFS3.GEOJSON_MIME_TYPE;
import static org.opengis.cite.wfs30.WFS3.PATH.COLLECTIONS;
Expand All @@ -11,7 +12,6 @@
import static org.opengis.cite.wfs30.util.JsonUtils.findUnsupportedTypes;
import static org.opengis.cite.wfs30.util.JsonUtils.linkIncludesRelAndType;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.opengis.cite.wfs30.collections;

import static io.restassured.http.Method.GET;
import static org.opengis.cite.wfs30.EtsAssert.assertFalse;
import static org.opengis.cite.wfs30.EtsAssert.assertTrue;
import static org.opengis.cite.wfs30.SuiteAttribute.API_MODEL;
import static org.opengis.cite.wfs30.WFS3.GEOJSON_MIME_TYPE;
import static org.opengis.cite.wfs30.WFS3.PATH.COLLECTIONS;
Expand All @@ -18,9 +20,7 @@
import static org.opengis.cite.wfs30.util.JsonUtils.parseSpatialExtent;
import static org.opengis.cite.wfs30.util.JsonUtils.parseTemporalExtent;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;

import java.net.URISyntaxException;
import java.time.Duration;
Expand Down
30 changes: 30 additions & 0 deletions src/test/java/EtsAssertTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import org.junit.Test;
import org.opengis.cite.wfs30.EtsAssert;

/**
* @author <a href="mailto:[email protected]">Lyn Goltz </a>
*/
public class EtsAssertTest {

@Test
public void testAssertTrue() {
EtsAssert.assertTrue( true, "OK" );
}

@Test
public void testAssertFalse() {
EtsAssert.assertFalse( false, "OK" );
}

@Test(expected = AssertionError.class)
public void testAssertTrue_false() {
EtsAssert.assertTrue( false, "FAIlURE" );
}

@Test(expected = AssertionError.class)
public void testAssertFalse_true() {
EtsAssert.assertFalse( true, "FAIlURE" );

}

}
73 changes: 0 additions & 73 deletions src/test/java/org/opengis/cite/wfs30/VerifyETSAssert.java

This file was deleted.