[Coldbox 4.3.0] CF2016 - Wirebox and model components mapping

I would like to know what are the best practices for calling model components in Testbox. I hoped they could simply be injected via Wirebox, but it does not seem to be the case:
I created some mappings in Wirebox as follows:

map(“Mail”).to(“models.utils.Mail”);
map(“Carrier”).to(“models.crd.Carrier”);
map(“Geozone”).to(“models.crd.Geozone”);
map(“GeozoneSVC”).to(“models.crd.GeozoneSVC”);

The mappings work fine when injecting those components in any of my services, meaning for example, I inject the mail component as “Mail” in a service component and it is properly loaded.

When it comes to Testbox, I can no longer rely on the Wirebox mappings. For example, when I mock components in Testbox, the component is successfully loaded only if I fully qualify the path to the component, like that:

/*********************************** LIFE CYCLE Methods ***********************************/

function beforeAll(){
super.beforeAll();

// Create the Geozone service to test, do not remove methods, just prepare for mocking
geozoneService = createMock(“models.crd.GeozoneSVC”);

// Mock the entity bean
mockBean = createEmptyMock(className=“models.crd.Geozone”);

// do your own stuff here
}

function afterAll(){
// do your own stuff here
super.afterAll();
}

/*********************************** BDD SUITES ***********************************/

If the path ever changes, it is bad news. Any suggestions before I start writing a whole lot more tests … Thanks

WireBox is available in ColdBox integration tests (extends from coldbox.system.testing.BaseTestCase). In a lot of cases that is overkill for unit tests.

If you are concerned about model paths changing, perhaps wrap the creation of your object in a function so the path is only ever referenced in that one place.

Cheers,
Eric