use of jodd.datetime.JDateTime in project jodd by oblac.
the class ParserTest method testParseWithoutDelimiters.
@Test
public void testParseWithoutDelimiters() {
Iso8601JdtFormatter formatter = new Iso8601JdtFormatter();
DateTimeStamp dateTimeStamp = formatter.parse("12341112", "YYYYMMDD");
assertEquals(new DateTimeStamp(1234, 11, 12), dateTimeStamp);
String timePattern = "YYYYMMDDhhmmssmss";
JDateTime jdt = new JDateTime();
String format = jdt.toString(timePattern);
JDateTime jdt1 = new JDateTime();
jdt1.parse(format, timePattern);
assertEquals(jdt, jdt1);
}
use of jodd.datetime.JDateTime in project jodd by oblac.
the class TimeAfterConstraintTest method testSetTime.
@Test
public void testSetTime() {
TimeAfterConstraint timeAfterConstraint = new TimeAfterConstraint();
JDateTime time = new JDateTime();
timeAfterConstraint.setTime(time);
assertEquals("method must return the same time as was given to set method", timeAfterConstraint.getTime(), time);
}
use of jodd.datetime.JDateTime in project jodd by oblac.
the class TimeAfterConstraintTest method testConfigure.
@Test
public void testConfigure() {
TimeAfterConstraint timeAfterConstraint = new TimeAfterConstraint();
JDateTime time = new JDateTime();
TimeAfter annotation = mock(TimeAfter.class);
stub(annotation.value()).toReturn(JDateTimeDefault.formatter.convert(time, JDateTimeDefault.format));
timeAfterConstraint.configure(annotation);
assertEquals("method must return the same time as was set to annotation when configure", timeAfterConstraint.getTime(), time);
}
use of jodd.datetime.JDateTime in project jodd by oblac.
the class TimeAfterConstraintTest method testConstructor2.
@Test
public void testConstructor2() {
JDateTime time = new JDateTime();
TimeAfterConstraint timeAfterConstraint = new TimeAfterConstraint(time);
assertEquals("time must be the same as was given to constructor", timeAfterConstraint.getTime(), time);
}
use of jodd.datetime.JDateTime in project jodd by oblac.
the class TimeBeforeConstraintTest method testConfigure.
@Test
public void testConfigure() {
TimeBeforeConstraint timeBeforeConstraint = new TimeBeforeConstraint();
JDateTime time = new JDateTime();
timeBeforeConstraint.setTime(time);
TimeBefore annotation = mock(TimeBefore.class);
stub(annotation.value()).toReturn(JDateTimeDefault.formatter.convert(time, JDateTimeDefault.format));
timeBeforeConstraint.configure(annotation);
assertEquals("method must return the same time as was set to annotation when configure", timeBeforeConstraint.getTime(), time);
}
Aggregations