APISonar


org.nakedobjects.application.valueholder.Date.Date

> org > nakedobjects > application > valueholder > Date > Date
org APIs nakedobjects APIs application APIs valueholder APIs Date APIs Date APIs

Example 1
public void testNew() {
        Date expected = new Date(2003, 8, 17);
        Date actual = new Date();
        assertEquals(expected, actual);
    }
Example 2
public void testSaveRestorOfNull() throws Exception {
        Date date1 = new Date();
        date1.clear();
        assertTrue("Date isEmpty", date1.isEmpty());

        Date date2 = new Date();
        date2.restoreFromEncodedString(date1.asEncodedString());
        assertEquals(date1.dateValue(), date2.dateValue());
        assertTrue(date2.isEmpty());
    }
Example 3
public Booking() {
        reference = new TextString();
        status = new TextString();
        date = new Date();
        time = new Time();
    }
Example 4
public void validDate(Validity validity) {
        validity.cannotBeEmpty();
        Date today = new Date();
        today.today();
        validity.invalidOnCondition(date.isLessThan(today), "Booking must be in the future");
    }
Example 5
public Payment() {
        paymentDate = new Date();
        paymentAmount = new Money();
    }
Example 6
protected void setUp() throws Exception {
        Logger.getRootLogger().setLevel(Level.OFF);
        new TestClock();
        actual = new Date(2000, 2, 1);
    }
Example 7
public void testValueParameterMethod() {
        TestObject customer = getTestClass(Customer.class.getName()).newInstance();
        TestObject location =  getTestClass(Location.class.getName()).newInstance();
        TextString textEntry = new TextString("002");
        TestValue value1 = createParameterTestValue(textEntry);
        Date dateEntry = new Date(2001, 1, 23);
        TestValue value2 = createParameterTestValue(dateEntry);
        
        TestObject booking = customer.invokeActionReturnObject("create booking", new TestNaked[] {location, location, value1, value2});
        customer.assertFieldContains("bookings", booking);
        booking.assertFieldContains("pick up", location);
        booking.assertFieldContains("reference", "002");
        booking.assertFieldContains("date", new Date(2001, 1, 23));
    }