added unit tests

This commit is contained in:
skubiak 2015-01-26 11:52:50 +01:00
parent 3953de34ca
commit dd11393771
3 changed files with 124 additions and 0 deletions

View File

@ -119,6 +119,12 @@
<artifactId>logback-core</artifactId> <artifactId>logback-core</artifactId>
<version>${logback.version}</version> <version>${logback.version}</version>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>

View File

@ -295,4 +295,56 @@ public class JPushover {
return (jPushoverResponse == null) ? new JPushoverResponse().isSuccessful(false) : jPushoverResponse; return (jPushoverResponse == null) ? new JPushoverResponse().isSuccessful(false) : jPushoverResponse;
} }
public String getToken() {
return pushoverToken;
}
public String getUser() {
return pushoverUser;
}
public String getMessage() {
return pushoverMessage;
}
public String getDevice() {
return pushoverDevice;
}
public String getTitle() {
return pushoverTitle;
}
public String getUrl() {
return pushoverUrl;
}
public String getUrlTitle() {
return pushoverUrlTitle;
}
public String getTimestamp() {
return pushoverTimestamp;
}
public String getRetry() {
return pushoverRetry;
}
public String getExpire() {
return pushoverExpire;
}
public String getCallback() {
return pushoverCallback;
}
public Priority getPriority() {
return pushoverPriority;
}
public Sound getSound() {
return pushoverSound;
}
} }

View File

@ -0,0 +1,66 @@
package de.svenkubiak.jpushover;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import de.svenkubiak.jpushover.enums.Priority;
import de.svenkubiak.jpushover.enums.Sound;
public class TestJPushover {
private static final String USER = "user";
private static final String URL_TITLE = "urlTitle";
private static final String URL = "url";
private static final String TOKEN = "token";
private static final String TITLE = "title";
private static final String TIMESTAMP = "timestamp";
private static final String RETRY = "retry";
private static final String MESSAGE = "message";
private static final String EXPIRE = "expire";
private static final String DEVICE = "device";
private static final String CALLBACK = "callback";
@Test
public void TestValues(){
JPushover push = new JPushover();
push.callback(CALLBACK);
assertEquals(push.getCallback(), CALLBACK);
push.device(DEVICE);
assertEquals(push.getDevice(), DEVICE);
push.expire(EXPIRE);
assertEquals(push.getExpire(), EXPIRE);
push.message(MESSAGE);
assertEquals(push.getMessage(), MESSAGE);
push.priority(Priority.HIGH);
assertEquals(push.getPriority(), Priority.HIGH);
push.retry(RETRY);
assertEquals(push.getRetry(), RETRY);
push.sound(Sound.ALIEN);
assertEquals(push.getSound(), Sound.ALIEN);
push.timestamp(TIMESTAMP);
assertEquals(push.getTimestamp(), TIMESTAMP);
push.title(TITLE);
assertEquals(push.getTitle(), TITLE);
push.token(TOKEN);
assertEquals(push.getToken(), TOKEN);
push.url(URL);
assertEquals(push.getUrl(), URL);
push.urlTitle(URL_TITLE);
assertEquals(push.getUrlTitle(), URL_TITLE);
push.user(USER);
assertEquals(push.getUser(), USER);
}
}