java - JUnit Test Cases for Config -
i have javaconfig file looks this:
@configuration public class serviceconfig { @autowired foobean somebean; @bean @scope(value="session", proxymode = scopedproxymode.target_class) public fooservice fooservice() { return new fooserviceimpl(somebean, foob()); } private foo foob() { return new foob(); } }
and have created junit test file based on this stack answer :
@runwith(springjunit4classrunner.class) @contextconfiguration(classes = serviceconfig.class) public class serviceconfigtest { }
but have couple questions:
should test config files 1 junit test file? have 4 config files in total including
serviceconfig
file, incontextconfiguration
should list them out or have junit test each 1 indivually?what supposed test here? tried reading spring guide i'm not understand behavior should test here....just if gets autowired successfully?
should test config files 1 junit test file? have 4 config files in total including serviceconfig file, in contextconfiguration should list them out or have junit test each 1 indivually?
in test class, @contextconfiguration must positioned on root of class. testing each configuration, have create test class configuration
.
what supposed test here? tried reading spring guide i'm not understand behavior should test here....just if gets autowired successfully?
testing if autowired successful seems not useful. unit test spring feature works. if want unit test these classes, should test own processing. moment, have not really. so, not sure testing them has great value.
Comments
Post a Comment