Skip to content

Commit

Permalink
Merge pull request #32 from opengeospatial/improveFailureMassage-Land…
Browse files Browse the repository at this point in the history
…ingPageValidation-31

Improved failure massage
  • Loading branch information
dstenger authored Aug 20, 2018
2 parents 7f3b98c + 2382335 commit 3aec1a8
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 255 deletions.
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 @@ -13,7 +14,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.util.JsonUtils.findLinkByRel;
Expand All @@ -9,7 +10,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.

0 comments on commit 3aec1a8

Please sign in to comment.