mraible wrote:
>
> If you change DepartamentDaoTest.properties to use "name" instead of
> "nome", does it populate the name property?
>
I'm sorry, Matt, for this misspelling because I'm translating my class from
portuguese to english before I post here.
The portuguese word 'nome' means 'name' in english and 'Departamento' means
'Department'.
In fact, the bean properties are id (Long), name (String) and timestamp
(Timestamp) and the setters are setId(), setName() and setTimestamp().
There are into .properties file this following definitions:
name=MARKETING
timestamp=2007-04-22 00:00:00.0
See a snip from test case class again:
--- cut here --
log.debug("Checking Resource Bundle for this test...");
String className = this.getClass().getName();
for (Enumeration<String> keys = rb.getKeys();
keys.hasMoreElements();) {
String key = keys.nextElement();
log.debug("RB: key:"+ key + " value: " + rb.getString(key));
}
// 1.
log.debug("Populate and Insert from src/test/resources/" + className
+ ".properties...");
Department department = new Department();
department = (Department) populate(department);
log.debug("Populated " + department.toString());
-- cut here--
The log shows the key/value pairs as you can see bellow:
-- cut here --
[tutorial] INFO [main] DepartmentDaoTest.startNewTransaction(314) | Began
tran
action (1): transaction manager
[org.springframework.orm.hibernate3.HibernateTr
[EMAIL PROTECTED]; default rollback = true
[tutorial] DEBUG [main] DepartmentDaoTest.testCrud(44) | Checking Resource
Bunle for this test...
[tutorial] DEBUG [main] DepartmentDaoTest.testCrud(59) | RB: key:name value:
MARKETING
[tutorial] DEBUG [main] DepartmentDaoTest.testCrud(59) | RB: key:timestamp
value: 2007-04-22 00:00:00.0
[tutorial] DEBUG [main] DepartmentDaoTest.testCrud(63) | Populate and Insert
from
src/test/resources/org.appfuse.tutorial.dao.DepartmentDaoTest.properties...
[tutorial] DEBUG [main] DepartmentDaoTest.testCrud(68) | Populated
[EMAIL PROTECTED]
id=<null>
nome=<null>
timestamp=2007-04-24 04:50:46.328
]
-- cut here--
But the populate method doesn't work as you can see in toString() output.
That's my fault I'm sure, but I'm blind! :(
Maybe this post will be usefull for other newbie.
Thanks a million for be patient, Matt!
--
celeraman+
--
View this message in context:
http://www.nabble.com/NullPointerException-when-trying-to-populate-in-test-case-tf3604674s2369.html#a10154499
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]