Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TreeSetTest{
- @Test
- public void someUnitTest() {
- OrderTransaction orderTransaction = new OrderTransaction();
- SortedSet<PriceTime> previousPrices = new TreeSet<>(Comparator.comparingLong(PriceTime::getTimestamp));
- // Set<PriceTime> previousPrices = new TreeSet<>();
- for (int i = 10000; i >= 0; i--) {
- previousPrices.add(new PriceTime(new Price(i), i));
- }
- /* for (int i = 0; i <= 10000; i++) {
- previousPrices.add(new PriceTime(new Price(i), i));
- }*/
- orderTransaction.setPreviousPrices(previousPrices);
- assertEquals(10000, orderTransaction.getPreviousPrices().last().getTimestamp());
- assertEquals(0, orderTransaction.getPreviousPrices().first().getTimestamp());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement