001 package org.hackystat.utilities.tstamp; 002 003 import static org.junit.Assert.assertEquals; 004 import org.junit.Test; 005 006 /** 007 * Tests the TstampSet class. 008 * @author Philip Johnson 009 */ 010 public class TestTstampSet { 011 /** 012 * Tests the tstampset. 013 * Instantiates the set, adds some stuff,and checks to see if it's copacetic. 014 */ 015 @Test public void testSet () { 016 long tstamp = 0; 017 TstampSet tstampSet = new TstampSet(); 018 assertEquals("Test empty set", tstamp, tstampSet.getUniqueTstamp(tstamp)); 019 assertEquals("Test addition", tstamp + 1, tstampSet.getUniqueTstamp(tstamp)); 020 tstamp = 50; 021 assertEquals("Test missing entry", tstamp, tstampSet.getUniqueTstamp(tstamp)); 022 assertEquals("Test addition", tstamp + 1, tstampSet.getUniqueTstamp(tstamp)); 023 tstamp = 0; 024 assertEquals("Test out of order entry", tstamp + 2, tstampSet.getUniqueTstamp(tstamp)); 025 assertEquals("Test addition", tstamp + 3, tstampSet.getUniqueTstamp(tstamp)); 026 027 } 028 }