Yes you're right, that's because the ActionTest cases expect negative IDs
(-1, -2) to be in the database, which are used in sample-data.xml  but that
I didn't specify in default-data.xml (which is used when prod is activated).

Ok, to step back a bit. If I was not going to put any data for my tables in
default-data.xml, then the tests will still fail when activating the prod
profile and that's because the ActionTests always assume that there will be
records with negative IDs in the database.

This is from action-test.ftl:

public void testEdit() throws Exception {
        log.debug("testing edit...");
        action.${setIdMethodName}(-1L);
        assertNull(action.get${pojo.shortName}());
        assertEquals("success", action.edit());
        assertNotNull(action.get${pojo.shortName}());
        assertFalse(action.hasActionErrors());
    }


So in effect, the line of "action.${setIdMethodName}(-1L);" will always fail
in prod.

Now the question is whether this is a bug or whether it is there by design
(to prevent people from running tests in prod), in which case loading data
from default-data.xml becomes an unusable feature.

Laith

Reply via email to