db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <craig.russ...@oracle.com>
Subject Problem with query method getDay
Date Fri, 29 Mar 2013 22:03:33 GMT
I notice that a TCK test fails (1)

I hadn't noticed before, but the getDay method is not only deprecated  
but also returns the day of the week, not the day of the month. So the  
test case is bogus.

If we really want to give users the ability to get the day of the  
month, the proper method is getDate (2).

WDYT?

Craig

1)  
testGetDay 
(org 
.apache 
.jdo 
.tck 
.query 
.jdoql 
.methods.SupportedDateMethods)junit.framework.AssertionFailedError:  
Assertion A14.6.2-60 (SupportedDateMethods) failed:
Wrong query result:
query: SELECT FROM org.apache.jdo.tck.pc.company.Person WHERE  
birthdate.getDay() == 10
expected: java.util.ArrayList of size 1
[FullTimeEmployee(1, emp1Last, emp1First, born 9/Jun/1970, phone  
{work=123456-1, home=1111}, hired 31/Dec/1998, weeklyhours 40.0,  
$20000.0)]
got:      java.util.ArrayList of size 0
[]
	at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:719)
	at org.apache.jdo.tck.query.QueryTest.queryFailed(QueryTest.java:518)
	at  
org 
.apache 
.jdo.tck.query.QueryTest.checkQueryResultWithoutOrder(QueryTest.java: 
548)
	at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1293)
	at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1133)
	at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java: 
1069)
	at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java: 
1049)
	at  
org 
.apache 
.jdo 
.tck 
.query 
.jdoql 
.methods.SupportedDateMethods.executeQuery(SupportedDateMethods.java: 
143)
	at  
org 
.apache 
.jdo 
.tck 
.query 
.jdoql 
.methods.SupportedDateMethods.testGetDay(SupportedDateMethods.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)
	at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:284)
	at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java: 
108)
	at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java: 
148)
	at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java: 
123)
FAILURES!!!

2) public int getDate()
Deprecated. As of JDK version 1.1, replaced by  
Calendar.get(Calendar.DAY_OF_MONTH).

Returns the day of the month represented by this Date object. The  
value returned is between 1 and 31 representing the day of the month  
that contains or begins with the instant in time represented by this  
Date object, as interpreted in the local time zone.




Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@oracle.com
P.S. A good JDO? O, Gasp!


Mime
View raw message