I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit a226d25d authored by str4d's avatar str4d
Browse files

Test getters etc. in RateStat

parent d436c846
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,30 @@ import junit.framework.TestCase; ...@@ -6,6 +6,30 @@ import junit.framework.TestCase;
public class RateStatTest extends TestCase { public class RateStatTest extends TestCase {
public void testGettersEtc() throws Exception{
long emptyArray[] = new long[0];
RateStat rs = new RateStat("test", "test RateStat getters etc", "tests", emptyArray);
// Test basic getters
assertEquals("test", rs.getName());
assertEquals("tests", rs.getGroupName());
assertEquals("test RateStat getters etc", rs.getDescription());
// There should be no periods, so other getters should return defaults
// TODO: Fix this so it checks that the array is empty rather than comparing objects
//assertEquals(rs.getPeriods(), emptyArray);
assertEquals(0.0, rs.getLifetimeAverageValue());
assertEquals(0, rs.getLifetimeEventCount());
assertNull(rs.getRate(2000));
// Test adding and removing a period
assertFalse(rs.containsRate(1000));
rs.addRate(1000);
assertTrue(rs.containsRate(1000));
rs.removeRate(1000);
assertFalse(rs.containsRate(1000));
}
public void testRateStat() throws Exception{ public void testRateStat() throws Exception{
RateStat rs = new RateStat("moo", "moo moo moo", "cow trueisms", new long[] { 60 * 1000, 60 * 60 * 1000, RateStat rs = new RateStat("moo", "moo moo moo", "cow trueisms", new long[] { 60 * 1000, 60 * 60 * 1000,
24 * 60 * 60 * 1000}); 24 * 60 * 60 * 1000});
...@@ -30,4 +54,4 @@ public class RateStatTest extends TestCase { ...@@ -30,4 +54,4 @@ public class RateStatTest extends TestCase {
assertEquals(rs, loadedRs); assertEquals(rs, loadedRs);
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment