Skip to content

Commit

Permalink
added support for boolean parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ibalosh committed Jan 25, 2018
1 parent eb92f62 commit 06280a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</developers>

<properties>
<postmark.version>1.0.4</postmark.version>
<postmark.version>1.0.5</postmark.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<junit.jupiter.version>5.0.0-M4</junit.jupiter.version>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/wildbit/java/postmark/client/Parameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/integration/BounceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 06280a7

Please sign in to comment.