Advertisement
Kvarz

TreeSetTest

Feb 6th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. public class TreeSetTest{
  2.  
  3.     @Test
  4.     public void someUnitTest() {
  5.         OrderTransaction orderTransaction = new OrderTransaction();
  6.         SortedSet<PriceTime> previousPrices = new TreeSet<>(Comparator.comparingLong(PriceTime::getTimestamp));
  7. //        Set<PriceTime> previousPrices = new TreeSet<>();
  8.         for (int i = 10000; i >= 0; i--) {
  9.             previousPrices.add(new PriceTime(new Price(i), i));
  10.         }
  11. /*        for (int i = 0; i <= 10000; i++) {
  12.             previousPrices.add(new PriceTime(new Price(i), i));
  13.         }*/
  14.         orderTransaction.setPreviousPrices(previousPrices);
  15.  
  16.         assertEquals(10000, orderTransaction.getPreviousPrices().last().getTimestamp());
  17.         assertEquals(0, orderTransaction.getPreviousPrices().first().getTimestamp());
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement