I am working on BDD using TestBox in my ColdBox-based application. The app. has the following handler:
`
// /handlers/Product.cfc
component {
property name=“productService” inject=“ProductService”;
function index(event, rc, prc) {
prc.showSearchBar = true;
}
}
`
And, this is the test code:
`
// /specs/integration/MainBDDTest.cfc
component extends=“coldbox.system.testing.BaseTestCase” appMapping="/root" {
function run(){
describe( “Product Handler”, function(){
it( “test index page”, function(){
var event = execute( “product.index” );
expect( event.getPrivateValue( “showSearchBar” ) ).toBeTrue();
});
});
}
}
`
When I ran the test, I received an error:
`
Error building: ProductService -> No entity (persistent component) with name [Product] found, available entities are [] with constructor arguments: {}
`
If I commented out the DSL (property name=“productService” inject=“ProductService”;), the test works fine.
What am I missing in the test code? Please advise. Thank you.