Package ns.foundation

Examples of ns.foundation.NSTimestamp


    assertEquals(Integer.valueOf(2), sorted.objectAtIndex(0));
    assertEquals(Integer.valueOf(1), sorted.objectAtIndex(1));
  }
 
  public void testSortedArrayUsingComparatorTimestamp() throws ComparisonException {
    NSTimestamp earlierTime = new NSTimestamp();
    NSTimestamp laterTime = earlierTime.timestampByAddingGregorianUnits(0, 1, 0, 0, 0, 0);
    NSArray<NSTimestamp> array = new NSArray<NSTimestamp>(new NSTimestamp[] { earlierTime, laterTime });
    NSArray<NSTimestamp> sorted = array.sortedArrayUsingComparator(NSComparator.AscendingTimestampComparator);
    assertEquals(earlierTime, sorted.objectAtIndex(0));
    assertEquals(laterTime, sorted.objectAtIndex(1));
View Full Code Here


    intarray.sortUsingComparator(NSComparator.DescendingNumberComparator);
    assertEquals(Integer.valueOf(2), intarray.get(0));
    assertEquals(Integer.valueOf(1), intarray.get(1));
   
   
    NSTimestamp earlierTime = new NSTimestamp();
    NSTimestamp laterTime = earlierTime.timestampByAddingGregorianUnits(0,1,0,0,0,0);
    NSMutableArray<NSTimestamp> timearray = new NSMutableArray<NSTimestamp>(new NSTimestamp[] { earlierTime, laterTime });
    timearray.sortUsingComparator(NSComparator.AscendingTimestampComparator);
    assertEquals(earlierTime, timearray.get(0));
    assertEquals(laterTime, timearray.get(1));
   
View Full Code Here

import ns.foundation.NSTimestamp;

public class TestNSTimestamp extends BaseTestCase {

  public void testNSTimestamp() {
    NSTimestamp time = new NSTimestamp();
    assertNotNull(time);
  }
View Full Code Here

    assertNotNull(time);
  }

  public void testNSTimestampDate() {
    Date date = new Date();
    NSTimestamp time = new NSTimestamp(date);
    assertEquals(date.getTime(), time.getTime());
  }
View Full Code Here

    assertEquals(date.getTime(), time.getTime());
  }

  public void testNSTimestampLong() {
    long date = new Date().getTime();
    NSTimestamp time = new NSTimestamp(date);
    assertEquals(date, time.getTime());
  }
View Full Code Here

  }

  public void testNSTimestampLongInt() {
    long d = new Date().getTime() / 1000;
    int nanos = 1234;
    NSTimestamp time = new NSTimestamp(d, nanos);
    assertEquals(d, time.getTime());
    assertEquals(1234, time.getNanos());
  }
View Full Code Here

    assertEquals(1234, time.getNanos());
  }

  public void testNSTimestampLongNSTimestamp() {
    long t = 1000;
    NSTimestamp earlierTime = new NSTimestamp();
    NSTimestamp time = new NSTimestamp(t, earlierTime);
    assertTrue(earlierTime.before(time));
  }
View Full Code Here

    assertTrue(earlierTime.before(time));
  }

  public void testNSTimestampTimestamp() {
    Timestamp ts = new Timestamp(new Date().getTime());
    NSTimestamp time = new NSTimestamp(ts);
    assertEquals(time.getTime(), ts.getTime());
  }
View Full Code Here

  }

  public void testGetNanos() {
    Timestamp ts = new Timestamp(new Date().getTime());
    ts.setNanos(100);
    NSTimestamp time = new NSTimestamp(ts);
    assertEquals(100, time.getNanos());
  }
View Full Code Here

    NSTimestamp time = new NSTimestamp(ts);
    assertEquals(100, time.getNanos());
  }
 
  public void testCompare() {
    NSTimestamp firstTime = new NSTimestamp();
    Date date = new Date(firstTime.getTime() + 1000);
    NSTimestamp nextTime = new NSTimestamp(date);
    assertEquals(-1, firstTime.compare(nextTime));
    assertEquals(0, firstTime.compare(firstTime));
    assertEquals(1, nextTime.compare(firstTime));
  }
View Full Code Here

TOP

Related Classes of ns.foundation.NSTimestamp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.