Changeset a226d25


Ignore:
Timestamp:
Feb 29, 2012 5:01:21 AM (8 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
786a261
Parents:
d436c84
Message:

Test getters etc. in RateStat?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/test/net/i2p/stat/RateStatTest.java

    rd436c84 ra226d25  
    77
    88public class RateStatTest extends TestCase {
     9    public void testGettersEtc() throws Exception{
     10        long emptyArray[] = new long[0];
     11        RateStat rs = new RateStat("test", "test RateStat getters etc", "tests", emptyArray);
     12
     13        // Test basic getters
     14        assertEquals("test", rs.getName());
     15        assertEquals("tests", rs.getGroupName());
     16        assertEquals("test RateStat getters etc", rs.getDescription());
     17
     18        // There should be no periods, so other getters should return defaults
     19        // TODO: Fix this so it checks that the array is empty rather than comparing objects
     20        //assertEquals(rs.getPeriods(), emptyArray);
     21        assertEquals(0.0, rs.getLifetimeAverageValue());
     22        assertEquals(0, rs.getLifetimeEventCount());
     23        assertNull(rs.getRate(2000));
     24
     25        // Test adding and removing a period
     26        assertFalse(rs.containsRate(1000));
     27        rs.addRate(1000);
     28        assertTrue(rs.containsRate(1000));
     29        rs.removeRate(1000);
     30        assertFalse(rs.containsRate(1000));
     31    }
     32
    933    public void testRateStat() throws Exception{
    1034        RateStat rs = new RateStat("moo", "moo moo moo", "cow trueisms", new long[] { 60 * 1000, 60 * 60 * 1000,
Note: See TracChangeset for help on using the changeset viewer.