Refactor Integration Tests

This commit is contained in:
Torsten Grote
2016-11-22 11:22:09 -02:00
parent 20de6f1aa5
commit 2850763ec6
16 changed files with 1669 additions and 3386 deletions

View File

@@ -1,7 +1,12 @@
package org.briarproject;
import org.briarproject.api.clients.MessageTracker;
import org.briarproject.api.db.DbException;
import org.briarproject.api.sync.GroupId;
import java.lang.Thread.UncaughtExceptionHandler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
public abstract class BriarTestCase {
@@ -16,4 +21,22 @@ public abstract class BriarTestCase {
};
Thread.setDefaultUncaughtExceptionHandler(fail);
}
protected static void assertGroupCount(MessageTracker tracker, GroupId g,
long msgCount, long unreadCount, long latestMsg)
throws DbException {
MessageTracker.GroupCount groupCount = tracker.getGroupCount(g);
assertEquals(msgCount, groupCount.getMsgCount());
assertEquals(unreadCount, groupCount.getUnreadCount());
assertEquals(latestMsg, groupCount.getLatestMsgTime());
}
protected static void assertGroupCount(MessageTracker tracker, GroupId g,
long msgCount, long unreadCount) throws DbException {
MessageTracker.GroupCount c1 = tracker.getGroupCount(g);
assertEquals(msgCount, c1.getMsgCount());
assertEquals(unreadCount, c1.getUnreadCount());
}
}