From 06280a7dfb860e16531b4d2437c658033dfaab81 Mon Sep 17 00:00:00 2001 From: Igor Balos Date: Thu, 25 Jan 2018 10:59:09 +0100 Subject: [PATCH] added support for boolean parameters --- pom.xml | 2 +- .../com/wildbit/java/postmark/client/Parameters.java | 11 +++++++++++ src/test/java/integration/BounceTest.java | 5 +++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index df0141e..5527912 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ - 1.0.4 + 1.0.5 UTF-8 1.8 5.0.0-M4 diff --git a/src/main/java/com/wildbit/java/postmark/client/Parameters.java b/src/main/java/com/wildbit/java/postmark/client/Parameters.java index 091ad29..6bb29db 100644 --- a/src/main/java/com/wildbit/java/postmark/client/Parameters.java +++ b/src/main/java/com/wildbit/java/postmark/client/Parameters.java @@ -31,6 +31,17 @@ public Parameters build(String name, String value) { return this; } + /** + * Add single parameter to HashMap of stored parameters + * @param name parameter name + * @param value parameter value + * @return object containing currently stored parameters + */ + public Parameters build(String name, Boolean value) { + parameters.put(name, value.toString()); + return this; + } + /** * * Add single parameter to the HashMap of stored parameters. diff --git a/src/test/java/integration/BounceTest.java b/src/test/java/integration/BounceTest.java index 17044eb..06ba1d7 100644 --- a/src/test/java/integration/BounceTest.java +++ b/src/test/java/integration/BounceTest.java @@ -13,6 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; import java.io.IOException; import java.util.ArrayList; @@ -52,12 +53,12 @@ void bounceById() throws PostmarkException, IOException { @Test void activateBounce() throws PostmarkException, IOException { - Bounces bounces = client.getBounces(Parameters.init().build("count", 1).build("offset", 0)); + Bounces bounces = client.getBounces(Parameters.init().build("count", 1).build("offset", 0).build("inactive",true)); Integer bounceId = bounces.getBounces().get(0).getId(); - Bounce bounce = client.getBounce(bounceId); String message = client.activateBounce(bounceId); assertNotNull(message); + assertFalse(client.getBounce(bounceId).getInactive()); } @Test