Minor refactorings
This commit is contained in:
parent
0cbcf27da7
commit
f9ca3b8890
2
pom.xml
2
pom.xml
@ -202,7 +202,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<version>5.10.0-M1</version>
|
<version>5.10.0-RC1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -225,13 +225,15 @@ public class Message implements API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Adds a ttl to the Pushover message
|
||||||
*
|
*
|
||||||
* @param ttl Seconds until this message should be automatically removed from the device. Needs to be positive
|
* @param ttl Seconds until this message should be automatically removed from the device. Needs to be positive
|
||||||
* @see https://pushover.net/api#ttl
|
|
||||||
* @return Message instance
|
* @return Message instance
|
||||||
*/
|
*/
|
||||||
public Message withTTL(int ttl) {
|
public Message withTTL(int ttl) {
|
||||||
body.put(Param.TTL.toString(), Integer.toString(ttl));
|
Validate.checkArgument(ttl > 0, "TTL must be a positive value");
|
||||||
|
|
||||||
|
body.put(Param.TTL.toString(), String.valueOf(ttl));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,18 @@ public class MessageTests {
|
|||||||
assertTrue(message.getValue(Param.USER.toString()).equals(value));
|
assertTrue(message.getValue(Param.USER.toString()).equals(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWithTTL() {
|
||||||
|
//given
|
||||||
|
int ttl = 5;
|
||||||
|
|
||||||
|
//when
|
||||||
|
Message message = JPushover.messageAPI().withTTL(5);
|
||||||
|
|
||||||
|
//then
|
||||||
|
assertTrue(message.getValue(Param.TTL.toString()).equals(String.valueOf(ttl)));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testWithRetry() {
|
void testWithRetry() {
|
||||||
//given
|
//given
|
||||||
|
Loading…
x
Reference in New Issue
Block a user