diff --git a/.travis.yml b/.travis.yml index 48807070..4fc4dbee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,16 @@ matrix: jdk: oraclejdk7 - os: linux jdk: oraclejdk8 +before_script: +- "./scripts/startPrism.sh &" +- sleep 10 +before_install: +- cat /etc/hosts # optionally check the content *before* +- sudo hostname "$(hostname | cut -c1-63)" +- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts +- cat /etc/hosts # optionally check the content *after* after_script: +- lsof -i :4010 -S # adds some debugging statements - "./gradlew build" - "./scripts/upload.sh" env: diff --git a/build.gradle b/build.gradle index 52c07eb5..8db48489 100644 --- a/build.gradle +++ b/build.gradle @@ -94,6 +94,11 @@ task renameSendGridVersionJarToSendGridJar { } } +task startPrism(type: Exec) { + workingDir 'scripts' + commandLine './startPrism.sh' +} + task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from 'build/docs/javadoc' diff --git a/scripts/startPrism.sh b/scripts/startPrism.sh new file mode 100755 index 00000000..53923593 --- /dev/null +++ b/scripts/startPrism.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -eu + +install () { + +echo "Installing Prism..." + +UNAME=$(uname) +ARCH=$(uname -m) +if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then + echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases" + exit 1 +fi + +if [ "$UNAME" = "Darwin" ] ; then + OSX_ARCH=$(uname -m) + if [ "${OSX_ARCH}" = "x86_64" ] ; then + PLATFORM="darwin_amd64" + fi +elif [ "$UNAME" = "Linux" ] ; then + LINUX_ARCH=$(uname -m) + if [ "${LINUX_ARCH}" = "i686" ] ; then + PLATFORM="linux_386" + elif [ "${LINUX_ARCH}" = "x86_64" ] ; then + PLATFORM="linux_amd64" + fi +fi + +mkdir -p ../prism/bin +#LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2) +LATEST="v0.6.21" +URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM" +DEST=../prism/bin/prism + +if [ -z $LATEST ] ; then + echo "Error requesting. Download binary from ${URL}" + exit 1 +else + curl -L $URL -o $DEST + chmod +x $DEST +fi +} + +run () { + echo "Running prism..." + cd ../prism/bin + ./prism run --mock --spec https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json +} + +if [ -f ../prism/bin/prism ]; then + echo "Prism is already installed." + run +else + echo "Prism is not installed." + install + run +fi diff --git a/src/test/java/com/sendgrid/SendGridTest.java b/src/test/java/com/sendgrid/SendGridTest.java index 5ec45eab..c633554b 100644 --- a/src/test/java/com/sendgrid/SendGridTest.java +++ b/src/test/java/com/sendgrid/SendGridTest.java @@ -77,14 +77,8 @@ public void testHost() { @Test public void test_access_settings_activity_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -97,14 +91,8 @@ public void test_access_settings_activity_get() throws IOException { @Test public void test_access_settings_whitelist_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -117,14 +105,8 @@ public void test_access_settings_whitelist_post() throws IOException { @Test public void test_access_settings_whitelist_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -136,14 +118,8 @@ public void test_access_settings_whitelist_get() throws IOException { @Test public void test_access_settings_whitelist_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -156,14 +132,8 @@ public void test_access_settings_whitelist_delete() throws IOException { @Test public void test_access_settings_whitelist__rule_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -175,14 +145,8 @@ public void test_access_settings_whitelist__rule_id__get() throws IOException { @Test public void test_access_settings_whitelist__rule_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -194,14 +158,8 @@ public void test_access_settings_whitelist__rule_id__delete() throws IOException @Test public void test_alerts_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -214,14 +172,8 @@ public void test_alerts_post() throws IOException { @Test public void test_alerts_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -233,14 +185,8 @@ public void test_alerts_get() throws IOException { @Test public void test_alerts__alert_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -253,14 +199,8 @@ public void test_alerts__alert_id__patch() throws IOException { @Test public void test_alerts__alert_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -272,14 +212,8 @@ public void test_alerts__alert_id__get() throws IOException { @Test public void test_alerts__alert_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -291,14 +225,8 @@ public void test_alerts__alert_id__delete() throws IOException { @Test public void test_api_keys_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -311,14 +239,8 @@ public void test_api_keys_post() throws IOException { @Test public void test_api_keys_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -331,14 +253,8 @@ public void test_api_keys_get() throws IOException { @Test public void test_api_keys__api_key_id__put() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -351,14 +267,8 @@ public void test_api_keys__api_key_id__put() throws IOException { @Test public void test_api_keys__api_key_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -371,14 +281,8 @@ public void test_api_keys__api_key_id__patch() throws IOException { @Test public void test_api_keys__api_key_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -390,14 +294,8 @@ public void test_api_keys__api_key_id__get() throws IOException { @Test public void test_api_keys__api_key_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -409,14 +307,8 @@ public void test_api_keys__api_key_id__delete() throws IOException { @Test public void test_asm_groups_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -429,14 +321,8 @@ public void test_asm_groups_post() throws IOException { @Test public void test_asm_groups_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -449,14 +335,8 @@ public void test_asm_groups_get() throws IOException { @Test public void test_asm_groups__group_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -469,14 +349,8 @@ public void test_asm_groups__group_id__patch() throws IOException { @Test public void test_asm_groups__group_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -488,14 +362,8 @@ public void test_asm_groups__group_id__get() throws IOException { @Test public void test_asm_groups__group_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -507,14 +375,8 @@ public void test_asm_groups__group_id__delete() throws IOException { @Test public void test_asm_groups__group_id__suppressions_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -527,14 +389,8 @@ public void test_asm_groups__group_id__suppressions_post() throws IOException { @Test public void test_asm_groups__group_id__suppressions_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -546,14 +402,8 @@ public void test_asm_groups__group_id__suppressions_get() throws IOException { @Test public void test_asm_groups__group_id__suppressions_search_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -566,14 +416,8 @@ public void test_asm_groups__group_id__suppressions_search_post() throws IOExcep @Test public void test_asm_groups__group_id__suppressions__email__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -585,14 +429,8 @@ public void test_asm_groups__group_id__suppressions__email__delete() throws IOEx @Test public void test_asm_suppressions_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -604,14 +442,8 @@ public void test_asm_suppressions_get() throws IOException { @Test public void test_asm_suppressions_global_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -624,14 +456,8 @@ public void test_asm_suppressions_global_post() throws IOException { @Test public void test_asm_suppressions_global__email__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -643,14 +469,8 @@ public void test_asm_suppressions_global__email__get() throws IOException { @Test public void test_asm_suppressions_global__email__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -662,14 +482,8 @@ public void test_asm_suppressions_global__email__delete() throws IOException { @Test public void test_asm_suppressions__email__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -681,14 +495,8 @@ public void test_asm_suppressions__email__get() throws IOException { @Test public void test_browsers_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -706,14 +514,8 @@ public void test_browsers_stats_get() throws IOException { @Test public void test_campaigns_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -726,14 +528,8 @@ public void test_campaigns_post() throws IOException { @Test public void test_campaigns_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -747,14 +543,8 @@ public void test_campaigns_get() throws IOException { @Test public void test_campaigns__campaign_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -767,14 +557,8 @@ public void test_campaigns__campaign_id__patch() throws IOException { @Test public void test_campaigns__campaign_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -786,14 +570,8 @@ public void test_campaigns__campaign_id__get() throws IOException { @Test public void test_campaigns__campaign_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -805,14 +583,8 @@ public void test_campaigns__campaign_id__delete() throws IOException { @Test public void test_campaigns__campaign_id__schedules_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -825,14 +597,8 @@ public void test_campaigns__campaign_id__schedules_patch() throws IOException { @Test public void test_campaigns__campaign_id__schedules_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -845,14 +611,8 @@ public void test_campaigns__campaign_id__schedules_post() throws IOException { @Test public void test_campaigns__campaign_id__schedules_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -864,14 +624,8 @@ public void test_campaigns__campaign_id__schedules_get() throws IOException { @Test public void test_campaigns__campaign_id__schedules_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -883,14 +637,8 @@ public void test_campaigns__campaign_id__schedules_delete() throws IOException { @Test public void test_campaigns__campaign_id__schedules_now_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -902,14 +650,8 @@ public void test_campaigns__campaign_id__schedules_now_post() throws IOException @Test public void test_campaigns__campaign_id__schedules_test_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -922,14 +664,8 @@ public void test_campaigns__campaign_id__schedules_test_post() throws IOExceptio @Test public void test_categories_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -944,14 +680,8 @@ public void test_categories_get() throws IOException { @Test public void test_categories_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -969,14 +699,8 @@ public void test_categories_stats_get() throws IOException { @Test public void test_categories_stats_sums_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -995,14 +719,8 @@ public void test_categories_stats_sums_get() throws IOException { @Test public void test_clients_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1017,14 +735,8 @@ public void test_clients_stats_get() throws IOException { @Test public void test_clients__client_type__stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1039,14 +751,8 @@ public void test_clients__client_type__stats_get() throws IOException { @Test public void test_contactdb_custom_fields_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1059,14 +765,8 @@ public void test_contactdb_custom_fields_post() throws IOException { @Test public void test_contactdb_custom_fields_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1078,14 +778,8 @@ public void test_contactdb_custom_fields_get() throws IOException { @Test public void test_contactdb_custom_fields__custom_field_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1097,14 +791,8 @@ public void test_contactdb_custom_fields__custom_field_id__get() throws IOExcept @Test public void test_contactdb_custom_fields__custom_field_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "202"); Request request = new Request(); @@ -1116,14 +804,8 @@ public void test_contactdb_custom_fields__custom_field_id__delete() throws IOExc @Test public void test_contactdb_lists_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1136,14 +818,8 @@ public void test_contactdb_lists_post() throws IOException { @Test public void test_contactdb_lists_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1155,14 +831,8 @@ public void test_contactdb_lists_get() throws IOException { @Test public void test_contactdb_lists_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -1175,14 +845,8 @@ public void test_contactdb_lists_delete() throws IOException { @Test public void test_contactdb_lists__list_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1196,14 +860,8 @@ public void test_contactdb_lists__list_id__patch() throws IOException { @Test public void test_contactdb_lists__list_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1216,14 +874,8 @@ public void test_contactdb_lists__list_id__get() throws IOException { @Test public void test_contactdb_lists__list_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "202"); Request request = new Request(); @@ -1236,14 +888,8 @@ public void test_contactdb_lists__list_id__delete() throws IOException { @Test public void test_contactdb_lists__list_id__recipients_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1256,14 +902,8 @@ public void test_contactdb_lists__list_id__recipients_post() throws IOException @Test public void test_contactdb_lists__list_id__recipients_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1278,14 +918,8 @@ public void test_contactdb_lists__list_id__recipients_get() throws IOException { @Test public void test_contactdb_lists__list_id__recipients__recipient_id__post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1297,14 +931,8 @@ public void test_contactdb_lists__list_id__recipients__recipient_id__post() thro @Test public void test_contactdb_lists__list_id__recipients__recipient_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -1318,14 +946,8 @@ public void test_contactdb_lists__list_id__recipients__recipient_id__delete() th @Test public void test_contactdb_recipients_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1338,14 +960,8 @@ public void test_contactdb_recipients_patch() throws IOException { @Test public void test_contactdb_recipients_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1358,14 +974,8 @@ public void test_contactdb_recipients_post() throws IOException { @Test public void test_contactdb_recipients_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1379,14 +989,8 @@ public void test_contactdb_recipients_get() throws IOException { @Test public void test_contactdb_recipients_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1399,14 +1003,8 @@ public void test_contactdb_recipients_delete() throws IOException { @Test public void test_contactdb_recipients_billable_count_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1418,14 +1016,8 @@ public void test_contactdb_recipients_billable_count_get() throws IOException { @Test public void test_contactdb_recipients_count_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1437,14 +1029,8 @@ public void test_contactdb_recipients_count_get() throws IOException { @Test public void test_contactdb_recipients_search_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1457,14 +1043,8 @@ public void test_contactdb_recipients_search_get() throws IOException { @Test public void test_contactdb_recipients__recipient_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1476,14 +1056,8 @@ public void test_contactdb_recipients__recipient_id__get() throws IOException { @Test public void test_contactdb_recipients__recipient_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -1495,14 +1069,8 @@ public void test_contactdb_recipients__recipient_id__delete() throws IOException @Test public void test_contactdb_recipients__recipient_id__lists_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1514,14 +1082,8 @@ public void test_contactdb_recipients__recipient_id__lists_get() throws IOExcept @Test public void test_contactdb_reserved_fields_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1533,14 +1095,8 @@ public void test_contactdb_reserved_fields_get() throws IOException { @Test public void test_contactdb_segments_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1553,14 +1109,8 @@ public void test_contactdb_segments_post() throws IOException { @Test public void test_contactdb_segments_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1572,14 +1122,8 @@ public void test_contactdb_segments_get() throws IOException { @Test public void test_contactdb_segments__segment_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1593,14 +1137,8 @@ public void test_contactdb_segments__segment_id__patch() throws IOException { @Test public void test_contactdb_segments__segment_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1613,14 +1151,8 @@ public void test_contactdb_segments__segment_id__get() throws IOException { @Test public void test_contactdb_segments__segment_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -1633,14 +1165,8 @@ public void test_contactdb_segments__segment_id__delete() throws IOException { @Test public void test_contactdb_segments__segment_id__recipients_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1654,14 +1180,8 @@ public void test_contactdb_segments__segment_id__recipients_get() throws IOExcep @Test public void test_devices_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1678,14 +1198,8 @@ public void test_devices_stats_get() throws IOException { @Test public void test_geo_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1703,14 +1217,8 @@ public void test_geo_stats_get() throws IOException { @Test public void test_ips_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1727,14 +1235,8 @@ public void test_ips_get() throws IOException { @Test public void test_ips_assigned_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1746,14 +1248,8 @@ public void test_ips_assigned_get() throws IOException { @Test public void test_ips_pools_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1766,14 +1262,8 @@ public void test_ips_pools_post() throws IOException { @Test public void test_ips_pools_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1785,14 +1275,8 @@ public void test_ips_pools_get() throws IOException { @Test public void test_ips_pools__pool_name__put() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1805,14 +1289,8 @@ public void test_ips_pools__pool_name__put() throws IOException { @Test public void test_ips_pools__pool_name__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1824,14 +1302,8 @@ public void test_ips_pools__pool_name__get() throws IOException { @Test public void test_ips_pools__pool_name__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -1843,14 +1315,8 @@ public void test_ips_pools__pool_name__delete() throws IOException { @Test public void test_ips_pools__pool_name__ips_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1863,14 +1329,8 @@ public void test_ips_pools__pool_name__ips_post() throws IOException { @Test public void test_ips_pools__pool_name__ips__ip__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -1882,14 +1342,8 @@ public void test_ips_pools__pool_name__ips__ip__delete() throws IOException { @Test public void test_ips_warmup_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1902,14 +1356,8 @@ public void test_ips_warmup_post() throws IOException { @Test public void test_ips_warmup_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1921,14 +1369,8 @@ public void test_ips_warmup_get() throws IOException { @Test public void test_ips_warmup__ip_address__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1940,14 +1382,8 @@ public void test_ips_warmup__ip_address__get() throws IOException { @Test public void test_ips_warmup__ip_address__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -1959,14 +1395,8 @@ public void test_ips_warmup__ip_address__delete() throws IOException { @Test public void test_ips__ip_address__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -1978,14 +1408,8 @@ public void test_ips__ip_address__get() throws IOException { @Test public void test_mail_batch_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -1997,14 +1421,8 @@ public void test_mail_batch_post() throws IOException { @Test public void test_mail_batch__batch_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2016,14 +1434,8 @@ public void test_mail_batch__batch_id__get() throws IOException { @Test public void test_mail_send_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "202"); Request request = new Request(); @@ -2036,14 +1448,8 @@ public void test_mail_send_post() throws IOException { @Test public void test_mail_settings_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2057,14 +1463,8 @@ public void test_mail_settings_get() throws IOException { @Test public void test_mail_settings_address_whitelist_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2077,14 +1477,8 @@ public void test_mail_settings_address_whitelist_patch() throws IOException { @Test public void test_mail_settings_address_whitelist_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2096,14 +1490,8 @@ public void test_mail_settings_address_whitelist_get() throws IOException { @Test public void test_mail_settings_bcc_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2116,14 +1504,8 @@ public void test_mail_settings_bcc_patch() throws IOException { @Test public void test_mail_settings_bcc_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2135,14 +1517,8 @@ public void test_mail_settings_bcc_get() throws IOException { @Test public void test_mail_settings_bounce_purge_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2155,14 +1531,8 @@ public void test_mail_settings_bounce_purge_patch() throws IOException { @Test public void test_mail_settings_bounce_purge_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2174,14 +1544,8 @@ public void test_mail_settings_bounce_purge_get() throws IOException { @Test public void test_mail_settings_footer_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2194,14 +1558,8 @@ public void test_mail_settings_footer_patch() throws IOException { @Test public void test_mail_settings_footer_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2213,14 +1571,8 @@ public void test_mail_settings_footer_get() throws IOException { @Test public void test_mail_settings_forward_bounce_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2233,14 +1585,8 @@ public void test_mail_settings_forward_bounce_patch() throws IOException { @Test public void test_mail_settings_forward_bounce_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2252,14 +1598,8 @@ public void test_mail_settings_forward_bounce_get() throws IOException { @Test public void test_mail_settings_forward_spam_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2272,14 +1612,8 @@ public void test_mail_settings_forward_spam_patch() throws IOException { @Test public void test_mail_settings_forward_spam_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2291,14 +1625,8 @@ public void test_mail_settings_forward_spam_get() throws IOException { @Test public void test_mail_settings_plain_content_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2311,14 +1639,8 @@ public void test_mail_settings_plain_content_patch() throws IOException { @Test public void test_mail_settings_plain_content_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2330,14 +1652,8 @@ public void test_mail_settings_plain_content_get() throws IOException { @Test public void test_mail_settings_spam_check_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2350,14 +1666,8 @@ public void test_mail_settings_spam_check_patch() throws IOException { @Test public void test_mail_settings_spam_check_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2369,14 +1679,8 @@ public void test_mail_settings_spam_check_get() throws IOException { @Test public void test_mail_settings_template_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2389,14 +1693,8 @@ public void test_mail_settings_template_patch() throws IOException { @Test public void test_mail_settings_template_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2408,14 +1706,8 @@ public void test_mail_settings_template_get() throws IOException { @Test public void test_mailbox_providers_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2433,14 +1725,8 @@ public void test_mailbox_providers_stats_get() throws IOException { @Test public void test_partner_settings_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2454,14 +1740,8 @@ public void test_partner_settings_get() throws IOException { @Test public void test_partner_settings_new_relic_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2474,14 +1754,8 @@ public void test_partner_settings_new_relic_patch() throws IOException { @Test public void test_partner_settings_new_relic_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2493,14 +1767,8 @@ public void test_partner_settings_new_relic_get() throws IOException { @Test public void test_scopes_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2512,14 +1780,8 @@ public void test_scopes_get() throws IOException { @Test public void test_senders_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -2532,14 +1794,8 @@ public void test_senders_post() throws IOException { @Test public void test_senders_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2551,14 +1807,8 @@ public void test_senders_get() throws IOException { @Test public void test_senders__sender_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2571,14 +1821,8 @@ public void test_senders__sender_id__patch() throws IOException { @Test public void test_senders__sender_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2590,14 +1834,8 @@ public void test_senders__sender_id__get() throws IOException { @Test public void test_senders__sender_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -2609,14 +1847,8 @@ public void test_senders__sender_id__delete() throws IOException { @Test public void test_senders__sender_id__resend_verification_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -2628,14 +1860,8 @@ public void test_senders__sender_id__resend_verification_post() throws IOExcepti @Test public void test_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2652,14 +1878,8 @@ public void test_stats_get() throws IOException { @Test public void test_subusers_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2672,14 +1892,8 @@ public void test_subusers_post() throws IOException { @Test public void test_subusers_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2694,14 +1908,8 @@ public void test_subusers_get() throws IOException { @Test public void test_subusers_reputations_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2714,14 +1922,8 @@ public void test_subusers_reputations_get() throws IOException { @Test public void test_subusers_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2739,14 +1941,8 @@ public void test_subusers_stats_get() throws IOException { @Test public void test_subusers_stats_monthly_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2764,14 +1960,8 @@ public void test_subusers_stats_monthly_get() throws IOException { @Test public void test_subusers_stats_sums_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2790,14 +1980,8 @@ public void test_subusers_stats_sums_get() throws IOException { @Test public void test_subusers__subuser_name__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -2810,14 +1994,8 @@ public void test_subusers__subuser_name__patch() throws IOException { @Test public void test_subusers__subuser_name__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -2829,14 +2007,8 @@ public void test_subusers__subuser_name__delete() throws IOException { @Test public void test_subusers__subuser_name__ips_put() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2849,14 +2021,8 @@ public void test_subusers__subuser_name__ips_put() throws IOException { @Test public void test_subusers__subuser_name__monitor_put() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2869,14 +2035,8 @@ public void test_subusers__subuser_name__monitor_put() throws IOException { @Test public void test_subusers__subuser_name__monitor_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2889,14 +2049,8 @@ public void test_subusers__subuser_name__monitor_post() throws IOException { @Test public void test_subusers__subuser_name__monitor_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2908,14 +2062,8 @@ public void test_subusers__subuser_name__monitor_get() throws IOException { @Test public void test_subusers__subuser_name__monitor_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -2927,14 +2075,8 @@ public void test_subusers__subuser_name__monitor_delete() throws IOException { @Test public void test_subusers__subuser_name__stats_monthly_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2951,14 +2093,8 @@ public void test_subusers__subuser_name__stats_monthly_get() throws IOException @Test public void test_suppression_blocks_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -2974,14 +2110,8 @@ public void test_suppression_blocks_get() throws IOException { @Test public void test_suppression_blocks_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -2994,14 +2124,8 @@ public void test_suppression_blocks_delete() throws IOException { @Test public void test_suppression_blocks__email__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3013,14 +2137,8 @@ public void test_suppression_blocks__email__get() throws IOException { @Test public void test_suppression_blocks__email__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3032,14 +2150,8 @@ public void test_suppression_blocks__email__delete() throws IOException { @Test public void test_suppression_bounces_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3053,14 +2165,8 @@ public void test_suppression_bounces_get() throws IOException { @Test public void test_suppression_bounces_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3073,14 +2179,8 @@ public void test_suppression_bounces_delete() throws IOException { @Test public void test_suppression_bounces__email__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3092,14 +2192,8 @@ public void test_suppression_bounces__email__get() throws IOException { @Test public void test_suppression_bounces__email__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3112,14 +2206,8 @@ public void test_suppression_bounces__email__delete() throws IOException { @Test public void test_suppression_invalid_emails_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3135,14 +2223,8 @@ public void test_suppression_invalid_emails_get() throws IOException { @Test public void test_suppression_invalid_emails_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3155,14 +2237,8 @@ public void test_suppression_invalid_emails_delete() throws IOException { @Test public void test_suppression_invalid_emails__email__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3174,14 +2250,8 @@ public void test_suppression_invalid_emails__email__get() throws IOException { @Test public void test_suppression_invalid_emails__email__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3193,14 +2263,8 @@ public void test_suppression_invalid_emails__email__delete() throws IOException @Test public void test_suppression_spam_report__email__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3212,14 +2276,8 @@ public void test_suppression_spam_report__email__get() throws IOException { @Test public void test_suppression_spam_report__email__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3231,14 +2289,8 @@ public void test_suppression_spam_report__email__delete() throws IOException { @Test public void test_suppression_spam_reports_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3254,14 +2306,8 @@ public void test_suppression_spam_reports_get() throws IOException { @Test public void test_suppression_spam_reports_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3274,14 +2320,8 @@ public void test_suppression_spam_reports_delete() throws IOException { @Test public void test_suppression_unsubscribes_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3297,14 +2337,8 @@ public void test_suppression_unsubscribes_get() throws IOException { @Test public void test_templates_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -3317,14 +2351,8 @@ public void test_templates_post() throws IOException { @Test public void test_templates_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3336,14 +2364,8 @@ public void test_templates_get() throws IOException { @Test public void test_templates__template_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3356,14 +2378,8 @@ public void test_templates__template_id__patch() throws IOException { @Test public void test_templates__template_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3375,14 +2391,8 @@ public void test_templates__template_id__get() throws IOException { @Test public void test_templates__template_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3394,14 +2404,8 @@ public void test_templates__template_id__delete() throws IOException { @Test public void test_templates__template_id__versions_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -3414,14 +2418,8 @@ public void test_templates__template_id__versions_post() throws IOException { @Test public void test_templates__template_id__versions__version_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3434,14 +2432,8 @@ public void test_templates__template_id__versions__version_id__patch() throws IO @Test public void test_templates__template_id__versions__version_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3453,14 +2445,8 @@ public void test_templates__template_id__versions__version_id__get() throws IOEx @Test public void test_templates__template_id__versions__version_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3472,14 +2458,8 @@ public void test_templates__template_id__versions__version_id__delete() throws I @Test public void test_templates__template_id__versions__version_id__activate_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3491,14 +2471,8 @@ public void test_templates__template_id__versions__version_id__activate_post() t @Test public void test_tracking_settings_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3512,14 +2486,8 @@ public void test_tracking_settings_get() throws IOException { @Test public void test_tracking_settings_click_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3532,14 +2500,8 @@ public void test_tracking_settings_click_patch() throws IOException { @Test public void test_tracking_settings_click_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3551,14 +2513,8 @@ public void test_tracking_settings_click_get() throws IOException { @Test public void test_tracking_settings_google_analytics_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3571,14 +2527,8 @@ public void test_tracking_settings_google_analytics_patch() throws IOException { @Test public void test_tracking_settings_google_analytics_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3590,14 +2540,8 @@ public void test_tracking_settings_google_analytics_get() throws IOException { @Test public void test_tracking_settings_open_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3610,14 +2554,8 @@ public void test_tracking_settings_open_patch() throws IOException { @Test public void test_tracking_settings_open_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3629,14 +2567,8 @@ public void test_tracking_settings_open_get() throws IOException { @Test public void test_tracking_settings_subscription_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3649,14 +2581,8 @@ public void test_tracking_settings_subscription_patch() throws IOException { @Test public void test_tracking_settings_subscription_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3668,14 +2594,8 @@ public void test_tracking_settings_subscription_get() throws IOException { @Test public void test_user_account_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3687,14 +2607,8 @@ public void test_user_account_get() throws IOException { @Test public void test_user_credits_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3706,14 +2620,8 @@ public void test_user_credits_get() throws IOException { @Test public void test_user_email_put() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3726,14 +2634,8 @@ public void test_user_email_put() throws IOException { @Test public void test_user_email_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3745,14 +2647,8 @@ public void test_user_email_get() throws IOException { @Test public void test_user_password_put() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3765,14 +2661,8 @@ public void test_user_password_put() throws IOException { @Test public void test_user_profile_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3785,14 +2675,8 @@ public void test_user_profile_patch() throws IOException { @Test public void test_user_profile_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3804,14 +2688,8 @@ public void test_user_profile_get() throws IOException { @Test public void test_user_scheduled_sends_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -3824,14 +2702,8 @@ public void test_user_scheduled_sends_post() throws IOException { @Test public void test_user_scheduled_sends_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3843,14 +2715,8 @@ public void test_user_scheduled_sends_get() throws IOException { @Test public void test_user_scheduled_sends__batch_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3863,14 +2729,8 @@ public void test_user_scheduled_sends__batch_id__patch() throws IOException { @Test public void test_user_scheduled_sends__batch_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3882,14 +2742,8 @@ public void test_user_scheduled_sends__batch_id__get() throws IOException { @Test public void test_user_scheduled_sends__batch_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -3901,14 +2755,8 @@ public void test_user_scheduled_sends__batch_id__delete() throws IOException { @Test public void test_user_settings_enforced_tls_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3921,14 +2769,8 @@ public void test_user_settings_enforced_tls_patch() throws IOException { @Test public void test_user_settings_enforced_tls_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3940,14 +2782,8 @@ public void test_user_settings_enforced_tls_get() throws IOException { @Test public void test_user_username_put() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3960,14 +2796,8 @@ public void test_user_username_put() throws IOException { @Test public void test_user_username_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3979,14 +2809,8 @@ public void test_user_username_get() throws IOException { @Test public void test_user_webhooks_event_settings_patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -3999,14 +2823,8 @@ public void test_user_webhooks_event_settings_patch() throws IOException { @Test public void test_user_webhooks_event_settings_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4018,14 +2836,8 @@ public void test_user_webhooks_event_settings_get() throws IOException { @Test public void test_user_webhooks_event_test_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -4038,14 +2850,8 @@ public void test_user_webhooks_event_test_post() throws IOException { @Test public void test_user_webhooks_parse_settings_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -4058,14 +2864,8 @@ public void test_user_webhooks_parse_settings_post() throws IOException { @Test public void test_user_webhooks_parse_settings_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4077,14 +2877,8 @@ public void test_user_webhooks_parse_settings_get() throws IOException { @Test public void test_user_webhooks_parse_settings__hostname__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4097,14 +2891,8 @@ public void test_user_webhooks_parse_settings__hostname__patch() throws IOExcept @Test public void test_user_webhooks_parse_settings__hostname__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4116,14 +2904,8 @@ public void test_user_webhooks_parse_settings__hostname__get() throws IOExceptio @Test public void test_user_webhooks_parse_settings__hostname__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -4135,14 +2917,8 @@ public void test_user_webhooks_parse_settings__hostname__delete() throws IOExcep @Test public void test_user_webhooks_parse_stats_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4159,14 +2935,8 @@ public void test_user_webhooks_parse_stats_get() throws IOException { @Test public void test_whitelabel_domains_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -4179,14 +2949,8 @@ public void test_whitelabel_domains_post() throws IOException { @Test public void test_whitelabel_domains_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4203,14 +2967,8 @@ public void test_whitelabel_domains_get() throws IOException { @Test public void test_whitelabel_domains_default_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4222,14 +2980,8 @@ public void test_whitelabel_domains_default_get() throws IOException { @Test public void test_whitelabel_domains_subuser_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4241,14 +2993,8 @@ public void test_whitelabel_domains_subuser_get() throws IOException { @Test public void test_whitelabel_domains_subuser_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -4260,14 +3006,8 @@ public void test_whitelabel_domains_subuser_delete() throws IOException { @Test public void test_whitelabel_domains__domain_id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4280,14 +3020,8 @@ public void test_whitelabel_domains__domain_id__patch() throws IOException { @Test public void test_whitelabel_domains__domain_id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4299,14 +3033,8 @@ public void test_whitelabel_domains__domain_id__get() throws IOException { @Test public void test_whitelabel_domains__domain_id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -4318,14 +3046,8 @@ public void test_whitelabel_domains__domain_id__delete() throws IOException { @Test public void test_whitelabel_domains__domain_id__subuser_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -4338,14 +3060,8 @@ public void test_whitelabel_domains__domain_id__subuser_post() throws IOExceptio @Test public void test_whitelabel_domains__id__ips_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4358,14 +3074,8 @@ public void test_whitelabel_domains__id__ips_post() throws IOException { @Test public void test_whitelabel_domains__id__ips__ip__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4377,14 +3087,8 @@ public void test_whitelabel_domains__id__ips__ip__delete() throws IOException { @Test public void test_whitelabel_domains__id__validate_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4396,14 +3100,8 @@ public void test_whitelabel_domains__id__validate_post() throws IOException { @Test public void test_whitelabel_ips_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -4416,14 +3114,8 @@ public void test_whitelabel_ips_post() throws IOException { @Test public void test_whitelabel_ips_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4438,14 +3130,8 @@ public void test_whitelabel_ips_get() throws IOException { @Test public void test_whitelabel_ips__id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4457,14 +3143,8 @@ public void test_whitelabel_ips__id__get() throws IOException { @Test public void test_whitelabel_ips__id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -4476,14 +3156,8 @@ public void test_whitelabel_ips__id__delete() throws IOException { @Test public void test_whitelabel_ips__id__validate_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4495,14 +3169,8 @@ public void test_whitelabel_ips__id__validate_post() throws IOException { @Test public void test_whitelabel_links_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "201"); Request request = new Request(); @@ -4517,14 +3185,8 @@ public void test_whitelabel_links_post() throws IOException { @Test public void test_whitelabel_links_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4537,14 +3199,8 @@ public void test_whitelabel_links_get() throws IOException { @Test public void test_whitelabel_links_default_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4557,14 +3213,8 @@ public void test_whitelabel_links_default_get() throws IOException { @Test public void test_whitelabel_links_subuser_get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4577,14 +3227,8 @@ public void test_whitelabel_links_subuser_get() throws IOException { @Test public void test_whitelabel_links_subuser_delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -4597,14 +3241,8 @@ public void test_whitelabel_links_subuser_delete() throws IOException { @Test public void test_whitelabel_links__id__patch() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4617,14 +3255,8 @@ public void test_whitelabel_links__id__patch() throws IOException { @Test public void test_whitelabel_links__id__get() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4636,14 +3268,8 @@ public void test_whitelabel_links__id__get() throws IOException { @Test public void test_whitelabel_links__id__delete() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "204"); Request request = new Request(); @@ -4655,14 +3281,8 @@ public void test_whitelabel_links__id__delete() throws IOException { @Test public void test_whitelabel_links__id__validate_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); @@ -4674,14 +3294,8 @@ public void test_whitelabel_links__id__validate_post() throws IOException { @Test public void test_whitelabel_links__link_id__subuser_post() throws IOException { - SendGrid sg = null; - if(System.getenv("TRAVIS") != null && Boolean.parseBoolean(System.getenv("TRAVIS"))) { - sg = new SendGrid("SENDGRID_API_KEY"); - sg.setHost(System.getenv("MOCK_HOST")); - } else { - sg = new SendGrid("SENDGRID_API_KEY", true); - sg.setHost("localhost:4010"); - } + SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); + sg.setHost("localhost:4010"); sg.addRequestHeader("X-Mock", "200"); Request request = new Request(); diff --git a/test/prism.sh b/test/prism.sh new file mode 100755 index 00000000..d6e0f251 --- /dev/null +++ b/test/prism.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +install () { + +set -eu + +UNAME=$(uname) +ARCH=$(uname -m) +if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then + echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases" + exit 1 +fi + +if [ "$UNAME" = "Darwin" ] ; then + OSX_ARCH=$(uname -m) + if [ "${OSX_ARCH}" = "x86_64" ] ; then + PLATFORM="darwin_amd64" + fi +elif [ "$UNAME" = "Linux" ] ; then + LINUX_ARCH=$(uname -m) + if [ "${LINUX_ARCH}" = "i686" ] ; then + PLATFORM="linux_386" + elif [ "${LINUX_ARCH}" = "x86_64" ] ; then + PLATFORM="linux_amd64" + fi +fi + +#LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2) +LATEST="v0.1.5" +URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM" +DEST=./prism/bin/prism + +if [ -z $LATEST ] ; then + echo "Error requesting. Download binary from ${URL}" + exit 1 +else + curl -L $URL -o $DEST + chmod +x $DEST +fi +} + +install