public GeneratorBase createGenerator(GenDiagram diagram) {
   final GenEditorGenerator editorGen = diagram.getEditorGen();
   // using caching EmitterSource saves few seconds on test execution (115-118 compared to 112)
   // but it seems reasonable to avoid unpredictability of reuse (due to use of soft references)
   // and might be good idea to have separate test to test emitter reuse explicitly
   return new Generator(
       editorGen,
       new CodegenEmitters(
           !editorGen.isDynamicTemplates(),
           editorGen.getTemplateDirectory(),
           editorGen.getModelAccess() != null));
 }
  public void testCompileDynamicDomainModel() throws Exception {
    DiaGenSource s = createLibraryGen(false);
    final GenEditorGenerator editorGen = s.getGenDiagram().getEditorGen();
    assertNull("prereq", editorGen.getModelAccess());
    DynamicModelAccess dma = GMFGenFactory.eINSTANCE.createDynamicModelAccess();
    editorGen.setModelAccess(dma);
    generateAndCompile(
        s,
        new GenDiagramMutator("dynmodel") {

          @Override
          public void doMutation(GenDiagram d) {
            final DynamicModelAccess modelAccess = d.getEditorGen().getModelAccess();
            modelAccess.setClassName("NonDefaultDynamicAccessorName");
          }

          @Override
          public void undoMutation(GenDiagram d) {
            final DynamicModelAccess modelAccess = d.getEditorGen().getModelAccess();
            modelAccess.setClassName(null);
          }
        });
  }