Package ns.foundation

Examples of ns.foundation.NSTimestamp


  }
 
  public void testTimestampByAddingGregorianUnits() {
    Date d = jan1();
   
    NSTimestamp timestamp = new NSTimestamp(d);
    NSTimestamp clone = new NSTimestamp(d);
    assertEquals(timestamp, clone);
   
    NSTimestamp temp = timestamp.timestampByAddingGregorianUnits(0, 0, 0, 0, 0, 0);
    assertEquals(timestamp.getNanos(), temp.getNanos());
  }
View Full Code Here


   
  @SuppressWarnings("deprecation")
  public void testTimestampByAddingGregorianUnitsYear() {
    Date d = jan1();
   
    NSTimestamp timestamp = new NSTimestamp(d);
   
    d.setYear(109);
    NSTimestamp expected = new NSTimestamp(d);
   
    NSTimestamp temp = timestamp.timestampByAddingGregorianUnits(1, 0, 0, 0, 0, 0);
    assertEquals(expected, temp);   
  }
View Full Code Here

  @SuppressWarnings("deprecation")
  public void testTimestampByAddingGregorianUnitsMonth() {
    Date d = jan1();
   
    NSTimestamp timestamp = new NSTimestamp(d);
   
    d.setMonth(1);
    NSTimestamp expected = new NSTimestamp(d);
   
    NSTimestamp temp = timestamp.timestampByAddingGregorianUnits(0, 1, 0, 0, 0, 0);
    assertEquals(expected, temp);   
  }
View Full Code Here

 
  @SuppressWarnings("deprecation")
  public void testTimestampByAddingGregorianUnitsDate() {
    Date d = jan1();
   
    NSTimestamp timestamp = new NSTimestamp(d);
   
    d.setDate(2);
    NSTimestamp expected = new NSTimestamp(d);
   
    NSTimestamp temp = timestamp.timestampByAddingGregorianUnits(0, 0, 1, 0, 0, 0);
    assertEquals(expected, temp);   
  }
View Full Code Here

 
  @SuppressWarnings("deprecation")
  public void testTimestampByAddingGregorianUnitsHour() {
    Date d = jan1();
   
    NSTimestamp timestamp = new NSTimestamp(d);
   
    d.setHours(1);
    NSTimestamp expected = new NSTimestamp(d);
   
    NSTimestamp temp = timestamp.timestampByAddingGregorianUnits(0, 0, 0, 1, 0, 0);
    assertEquals(expected, temp);   
  }
View Full Code Here

 
  @SuppressWarnings("deprecation")
  public void testTimestampByAddingGregorianUnitsMinute() {
    Date d = jan1();
   
    NSTimestamp timestamp = new NSTimestamp(d);
   
    d.setMinutes(1);
    NSTimestamp expected = new NSTimestamp(d);
   
    NSTimestamp temp = timestamp.timestampByAddingGregorianUnits(0, 0, 0, 0, 1, 0);
    assertEquals(expected, temp);   
  }
View Full Code Here

  @SuppressWarnings("deprecation")
  public void testTimestampByAddingGregorianUnitsSecond() {
    Date d = jan1();
   
    NSTimestamp timestamp = new NSTimestamp(d);
   
    d.setSeconds(1);
    NSTimestamp expected = new NSTimestamp(d);
   
    NSTimestamp temp = timestamp.timestampByAddingGregorianUnits(0, 0, 0, 0, 0, 1);
    assertEquals(expected.getNanos(), temp.getNanos());   
    assertEquals(expected.getTime(), temp.getTime());  
  }
View Full Code Here

  }
 
  @SuppressWarnings("deprecation")
  public void testSetYear() {
    try {
      new NSTimestamp().setYear(2000);
      fail("SetYear should throw UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
    } catch (IllegalStateException e) {
    }
  }
View Full Code Here

  }

  @SuppressWarnings("deprecation")
  public void testSetMonth() {
    try {
      new NSTimestamp().setMonth(1);
      fail("SetMonth should throw UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
    } catch (IllegalStateException e) {
    }
  }
View Full Code Here

  }

  @SuppressWarnings("deprecation")
  public void testSetDate() {
    try {
      new NSTimestamp().setDate((int)new Date().getTime());
      fail("SetDate should throw UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
    } catch (IllegalStateException e) {
    }
  }
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.