public abstract class AbstractSchemaAwareTest {
- private Iterable<YangModuleInfo> moduleInfos;
- private SchemaContext schemaContext;
-
-
- protected Iterable<YangModuleInfo> getModuleInfos() {
+ protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
return BindingReflections.loadModuleInfos();
}
-
- @Before
- public final void setup() {
- moduleInfos = getModuleInfos();
+ protected SchemaContext getSchemaContext() throws Exception {
+ Iterable<YangModuleInfo> moduleInfos = getModuleInfos();
ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
moduleContext.addModuleInfos(moduleInfos);
- schemaContext = moduleContext.tryToCreateSchemaContext().get();
- setupWithSchema(schemaContext);
+ return moduleContext.tryToCreateSchemaContext().get();
+ }
+
+ @Before
+ public final void setup() throws Exception {
+ setupWithSchema(getSchemaContext());
}
/**
* Setups test with Schema context.
* This method is called before {@link #setupWithSchemaService(SchemaService)}
- *
- * @param context
*/
protected abstract void setupWithSchema(SchemaContext context);