Beispiel #1
0
  @Test
  public void testGenerateMultipleStateMultipleActionCommands() throws Exception {
    DomainModel domainModel = parseHelper.parse(MULTIPLE_STATES_MULTIPLE_ACTION_COMMANDS_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    String resouceAKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(resouceAKey));
    String resourceA = fsa.getFiles().get(resouceAKey).toString();
    int indexOfFirstNewProperties = resourceA.indexOf("actionViewProperties = new Properties()");
    assertTrue(indexOfFirstNewProperties > 0);
    assertTrue(resourceA.contains("actionViewProperties.put(\"key\", \"value\""));
    assertTrue(
        resourceA.contains("new Action(\"DoStuff\", Action.TYPE.ENTRY, actionViewProperties)"));

    String resouceBKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/BResourceState.java";
    assertTrue(fsa.getFiles().containsKey(resouceBKey));
    String resourceB = fsa.getFiles().get(resouceBKey).toString();
    int indexOfSecondNewProperties =
        resourceB.indexOf("actionViewProperties = new Properties()", indexOfFirstNewProperties);
    assertTrue(indexOfSecondNewProperties > 0);
    assertTrue(resourceB.contains("actionViewProperties.put(\"keyB\", \"valueB\""));
    assertTrue(
        resourceB.contains("new Action(\"DoSomeStuff\", Action.TYPE.ENTRY, actionViewProperties)"));
    assertTrue(resourceB.contains("actionViewProperties.put(\"keyB0\", \"valueB0\""));
    assertTrue(resourceB.contains("actionViewProperties.put(\"keyB1\", \"valueB1\""));
    assertTrue(
        resourceB.contains(
            "new Action(\"DoSomeMoreStuff\", Action.TYPE.ENTRY, actionViewProperties)"));
  }
Beispiel #2
0
  /*
   * doGenerate should producer one file per resource
   */
  @Test
  public void testGenerateOneFile() throws Exception {
    DomainModel domainModel = parseHelper.parse(SINGLE_STATE_VIEW_COMMAND_ONLY_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);
    System.out.println(fsa.getFiles());
    assertEquals(2, fsa.getFiles().size());

    assertTrue(fsa.getFiles().containsKey(IFileSystemAccess.DEFAULT_OUTPUT + "TestBehaviour.java"));
    assertTrue(
        fsa.getFiles().containsKey(IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java"));
  }
Beispiel #3
0
  @Test
  public void testGenerateSingleStateViewCommandOnly() throws Exception {
    DomainModel domainModel = parseHelper.parse(SINGLE_STATE_VIEW_COMMAND_ONLY_RIM);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(domainModel.eResource(), fsa);

    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    assertTrue(
        fsa.getFiles()
            .get(expectedKey)
            .toString()
            .contains("new Action(\"GetEntity\", Action.TYPE.VIEW, new Properties())"));
  }
Beispiel #4
0
  @Test
  public void testGenerateOnErrorResourceSeparateRIM() throws Exception {
    DomainModel domainModel = parseHelper.parse(RESOURCE_ON_ERROR_SEPARATE_RIM);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(domainModel.eResource(), fsa);

    // collection
    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "ErrorTest/Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();
    assertTrue(
        output.contains(
            "super(\"ENTITY\", \"A\", createActions(), \"/A\", createLinkRelations(), null, factory.getResourceState(\"ErrorTest.Error.AE\"));"));
  }
Beispiel #5
0
  @Test
  public void testGenerateResourceWithBasepath() throws Exception {
    DomainModel domainModel = parseHelper.parse(RESOURCE_WITH_BASEPATH);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    // collection
    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();
    assertTrue(
        output.contains(
            "super(\"ENTITY\", \"A\", createActions(), \"/{companyid}/A\", createLinkRelations(), null, null);"));
  }
Beispiel #6
0
  @Test
  public void testGenerateAutoTransitionsWithUriLinkage() throws Exception {
    DomainModel domainModel = parseHelper.parse(AUTO_TRANSITION_WITH_URI_LINKAGE_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    String expectedKey =
        IFileSystemAccess.DEFAULT_OUTPUT + "Test/create_pseudo_stateResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();

    assertTrue(output.contains("uriLinkageProperties.put(\"id\", \"{MyId}\");"));
    assertTrue(output.contains("screate_pseudo_state.addTransition(new Transition.Builder()"));
    assertTrue(output.contains(".target(screated)"));
  }
Beispiel #7
0
  @Test
  public void testGenerateResourcesWithGlobalRelations() throws Exception {
    DomainModel domainModel = parseHelper.parse(GLOBAL_RESOURCE_RELATIONS_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    // collection
    String expectedKey =
        IFileSystemAccess.DEFAULT_OUTPUT + "Test/accTransactionsResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String accTransactionsOutput = fsa.getFiles().get(expectedKey).toString();
    // the constructor part
    assertTrue(accTransactionsOutput.contains("\"/accTransactions\", createLinkRelations()"));
    // createLinkRelations method
    String expectedAccTransactionsRelArray =
        ""
            + "        String accTransactionsRelationsStr = \"\";"
            + LINE_SEP
            + "        accTransactionsRelationsStr += \"archive \";"
            + LINE_SEP
            + "        accTransactionsRelationsStr += \"http://www.temenos.com/statement-entries \";"
            + LINE_SEP
            + "        String[] accTransactionsRelations = accTransactionsRelationsStr.trim().split(\" \");"
            + LINE_SEP
            + "";
    assertTrue(accTransactionsOutput.contains(expectedAccTransactionsRelArray));

    // item
    expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/accTransactionResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String accTransactionOutput = fsa.getFiles().get(expectedKey).toString();
    // the constructor part
    assertTrue(accTransactionOutput.contains("\"/accTransaction\", createLinkRelations()"));
    // createLinkRelations method
    String expectedAccTransactionRelArray =
        ""
            + "        String accTransactionRelationsStr = \"\";"
            + LINE_SEP
            + "        accTransactionRelationsStr += \"edit \";"
            + LINE_SEP
            + "        String[] accTransactionRelations = accTransactionRelationsStr.trim().split(\" \");"
            + LINE_SEP
            + "";
    assertTrue(accTransactionOutput.contains(expectedAccTransactionRelArray));
  }
Beispiel #8
0
  @Test
  public void testGenerateEmbeddedTransitions() throws Exception {
    DomainModel domainModel = parseHelper.parse(EMBEDDED_TRANSITION_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();

    assertTrue(output.contains("sA.addTransition(new Transition.Builder()"));
    assertTrue(output.contains(".target(sB)"));
    assertTrue(output.contains(".flags(Transition.EMBEDDED)"));

    String expectedBKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/BResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedBKey));
  }
Beispiel #9
0
  @Test
  public void testGenerateTransitionsWithExpressions() throws Exception {
    DomainModel domainModel = parseHelper.parse(TRANSITION_WITH_EXPRESSION_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();

    final String NEW_STATEMENT = "conditionalLinkExpressions = new ArrayList<Expression>();";
    final String ADD_TRANSITION =
        ".method(\"GET\").target(sB).uriParameters(uriLinkageProperties).evaluation(conditionalLinkExpressions != null ? new SimpleLogicalExpressionEvaluator(conditionalLinkExpressions) : null).label(\"B\")";

    int indexOfNewStatement = output.indexOf(NEW_STATEMENT);
    assertTrue(indexOfNewStatement > 0);
    assertTrue(
        output.contains(
            "conditionalLinkExpressions.add(new ResourceGETExpression(factory.getResourceState(\"Test.B\"), ResourceGETExpression.Function.OK))"));
    int indexOfAddTransition = output.indexOf(ADD_TRANSITION);
    assertTrue(indexOfAddTransition > 0);

    indexOfNewStatement = output.indexOf(NEW_STATEMENT, indexOfNewStatement);
    assertTrue(indexOfNewStatement > 0);
    assertTrue(
        output.contains(
            "conditionalLinkExpressions.add(new ResourceGETExpression(factory.getResourceState(\"Test.B\"), ResourceGETExpression.Function.NOT_FOUND))"));
    indexOfAddTransition = output.indexOf(ADD_TRANSITION, indexOfAddTransition);
    assertTrue(indexOfAddTransition > 0);

    indexOfNewStatement = output.indexOf(NEW_STATEMENT, indexOfNewStatement);
    assertTrue(indexOfNewStatement > 0);
    assertTrue(
        output.contains(
            "conditionalLinkExpressions.add(new ResourceGETExpression(factory.getResourceState(\"Test.C\"), ResourceGETExpression.Function.OK))"));
    assertTrue(
        output.contains(
            "conditionalLinkExpressions.add(new ResourceGETExpression(factory.getResourceState(\"Test.D\"), ResourceGETExpression.Function.NOT_FOUND))"));
    indexOfAddTransition = output.indexOf(ADD_TRANSITION, indexOfAddTransition);
    assertTrue(indexOfAddTransition > 0);
  }
Beispiel #10
0
  @Test
  public void testGenerateSingleStateActionCommands() throws Exception {
    DomainModel domainModel = parseHelper.parse(SINGLE_STATE_ACTION_COMMANDS_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));

    String output = fsa.getFiles().get(expectedKey).toString();
    int indexOfFirstNewProperties = output.indexOf("actionViewProperties = new Properties()");
    assertTrue(indexOfFirstNewProperties > 0);
    assertTrue(output.contains("actionViewProperties.put(\"getkey\", \"getvalue\""));
    assertTrue(
        output.contains("new Action(\"GetEntity\", Action.TYPE.VIEW, actionViewProperties)"));

    // No onerror handler so should not define an error state
    assertTrue(
        output.contains(
            "super(\"ENTITY\", \"A\", createActions(), \"/A\", createLinkRelations(), null, null);"));
  }
 public Class<? extends Object> compile(final Resource res, final JvmDeclaredType type) {
   res.eSetDeliver(false);
   EList<EObject> _contents = res.getContents();
   this.builder.<JvmDeclaredType>operator_add(_contents, type);
   res.eSetDeliver(true);
   InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
   final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
   this.generator.doGenerate(res, fsa);
   Map<String, CharSequence> _files = fsa.getFiles();
   String _identifier = type.getIdentifier();
   String _replace = _identifier.replace(".", "/");
   String _plus = (IFileSystemAccess.DEFAULT_OUTPUT + _replace);
   String _plus_1 = (_plus + ".java");
   CharSequence _get = _files.get(_plus_1);
   final String code = _get.toString();
   String _identifier_1 = type.getIdentifier();
   final Class<? extends Object> compiledClass =
       this.javaCompiler.compileToClass(_identifier_1, code);
   EList<EObject> _contents_1 = res.getContents();
   EObject _head = IterableExtensions.<EObject>head(_contents_1);
   this.helper.assertNoErrors(_head);
   return compiledClass;
 }
Beispiel #12
0
  @Test
  public void testGenerateUpdateTransition() throws Exception {
    DomainModel domainModel = parseHelper.parse(TRANSITION_WITH_UPDATE_EVENT);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);

    String resourceAKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(resourceAKey));
    String resourceA = fsa.getFiles().get(resourceAKey).toString();
    assertTrue(resourceA.contains("sA.addTransition(new Transition.Builder()"));
    assertTrue(resourceA.contains(".flags(Transition.FOR_EACH)"));
    assertTrue(resourceA.contains(".method(\"GET\")"));
    assertTrue(resourceA.contains(".target(sB)"));
    assertTrue(resourceA.contains(".uriParameters(uriLinkageProperties)"));
    assertTrue(
        resourceA.contains(
            ".evaluation(conditionalLinkExpressions != null ? new SimpleLogicalExpressionEvaluator(conditionalLinkExpressions) : null)"));
    assertTrue(resourceA.contains(".label(\"B\")"));

    String resourceBKey = IFileSystemAccess.DEFAULT_OUTPUT + "Test/BResourceState.java";
    assertTrue(fsa.getFiles().containsKey(resourceBKey));
    String resourceB = fsa.getFiles().get(resourceBKey).toString();
    assertTrue(resourceB.contains("sB.addTransition(new Transition.Builder()"));
    assertTrue(resourceB.contains(".method(\"PUT\")"));
    assertTrue(resourceB.contains(".target(sB_pseudo)"));
    assertTrue(resourceB.contains(".uriParameters(uriLinkageProperties)"));
    assertTrue(
        resourceB.contains(
            ".evaluation(conditionalLinkExpressions != null ? new SimpleLogicalExpressionEvaluator(conditionalLinkExpressions) : null)"));
    assertTrue(resourceB.contains(".label(\"B_pseudo\")"));

    String resourceB_pseudoKey =
        IFileSystemAccess.DEFAULT_OUTPUT + "Test/B_pseudoResourceState.java";
    assertTrue(fsa.getFiles().containsKey(resourceB_pseudoKey));
    String resourceB_pseudo = fsa.getFiles().get(resourceB_pseudoKey).toString();
    assertTrue(resourceB_pseudo.contains("sB_pseudo.addTransition(new Transition.Builder()"));
    assertTrue(resourceB_pseudo.contains(".flags(Transition.AUTO)"));
    assertTrue(resourceB_pseudo.contains(".target(sA)"));
    assertTrue(resourceB_pseudo.contains(".uriParameters(uriLinkageProperties)"));
    assertTrue(
        resourceB_pseudo.contains(
            ".evaluation(conditionalLinkExpressions != null ? new SimpleLogicalExpressionEvaluator(conditionalLinkExpressions) : null)"));

    assertTrue(resourceB_pseudo.contains("sB_pseudo.addTransition(new Transition.Builder()"));
    assertTrue(resourceB_pseudo.contains(".flags(Transition.AUTO)"));
    assertTrue(resourceB_pseudo.contains(".target(sB)"));
    assertTrue(resourceB_pseudo.contains(".uriParameters(uriLinkageProperties)"));
    assertTrue(
        resourceB_pseudo.contains(
            ".evaluation(conditionalLinkExpressions != null ? new SimpleLogicalExpressionEvaluator(conditionalLinkExpressions) : null)"));
  }
Beispiel #13
0
  /*
   * doGenerate should producer one file per resource
   */
  @Test
  public void testGenerateFileInPackage() throws Exception {
    DomainModel domainModel = parseHelper.parse(SINGLE_STATE_WITH_PACKAGE_RIM);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(domainModel.eResource(), fsa);
    System.out.println(fsa.getFiles());
    assertEquals(2, fsa.getFiles().size());

    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "blah/TestBehaviour.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    String output = fsa.getFiles().get(expectedKey).toString();
    assertTrue(output.contains("package blah;"));
    assertTrue(output.contains("public class TestBehaviour {"));
    assertTrue(output.contains("getRIM"));
    assertTrue(output.contains("factory.getResourceState(\"blah.Test.A\");"));

    String expectedRSKey = IFileSystemAccess.DEFAULT_OUTPUT + "blah/Test/AResourceState.java";
    assertTrue(fsa.getFiles().containsKey(expectedRSKey));
    String outputRS = fsa.getFiles().get(expectedRSKey).toString();
    assertTrue(outputRS.contains("package blah.Test;"));
  }
Beispiel #14
0
  @Test
  public void testGenerateSimpleStates() throws Exception {
    DomainModel domainModel = parseHelper.parse(SIMPLE_STATES_RIM);
    ResourceInteractionModel model = (ResourceInteractionModel) domainModel.getRims().get(0);
    InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    underTest.doGenerate(model.eResource(), fsa);
    System.out.println(fsa.getFiles());
    assertEquals(4, fsa.getFiles().size());

    // the behaviour class
    String expectedKey = IFileSystemAccess.DEFAULT_OUTPUT + "SimpleBehaviour.java";
    assertTrue(fsa.getFiles().containsKey(expectedKey));
    assertEquals(SIMPLE_STATES_BEHAVIOUR, fsa.getFiles().get(expectedKey).toString());

    // one class per resource
    assertTrue(
        fsa.getFiles()
            .containsKey(IFileSystemAccess.DEFAULT_OUTPUT + "Simple/AResourceState.java"));
    assertTrue(
        fsa.getFiles()
            .containsKey(IFileSystemAccess.DEFAULT_OUTPUT + "Simple/BResourceState.java"));
  }
 @Test
 public void bug390290InnerClassMemberImport() {
   try {
     final XExpression expression = this.expression("null");
     final Procedure1<JvmGenericType> _function =
         new Procedure1<JvmGenericType>() {
           public void apply(final JvmGenericType it) {
             final JvmGenericType innerClass =
                 JvmModelGeneratorTest.this.builder.toClass(it, "InnerClass");
             final JvmGenericType innerClassString =
                 JvmModelGeneratorTest.this.builder.toClass(it, "String");
             EList<JvmMember> _members = it.getMembers();
             JvmModelGeneratorTest.this.builder.<JvmGenericType>operator_add(_members, innerClass);
             EList<JvmMember> _members_1 = it.getMembers();
             JvmModelGeneratorTest.this.builder.<JvmGenericType>operator_add(
                 _members_1, innerClassString);
             EList<JvmMember> _members_2 = it.getMembers();
             JvmTypeReference _typeForName =
                 JvmModelGeneratorTest.this.references.getTypeForName(String.class, expression);
             final Procedure1<JvmOperation> _function =
                 new Procedure1<JvmOperation>() {
                   public void apply(final JvmOperation fooMethod) {
                     EList<JvmFormalParameter> _parameters = fooMethod.getParameters();
                     JvmParameterizedTypeReference _createTypeRef =
                         JvmModelGeneratorTest.this.references.createTypeRef(innerClass);
                     JvmFormalParameter _parameter =
                         JvmModelGeneratorTest.this.builder.toParameter(it, "p1", _createTypeRef);
                     JvmModelGeneratorTest.this.builder.<JvmFormalParameter>operator_add(
                         _parameters, _parameter);
                     EList<JvmFormalParameter> _parameters_1 = fooMethod.getParameters();
                     JvmParameterizedTypeReference _createTypeRef_1 =
                         JvmModelGeneratorTest.this.references.createTypeRef(innerClassString);
                     JvmFormalParameter _parameter_1 =
                         JvmModelGeneratorTest.this.builder.toParameter(
                             it, "p2", _createTypeRef_1);
                     JvmModelGeneratorTest.this.builder.<JvmFormalParameter>operator_add(
                         _parameters_1, _parameter_1);
                     JvmModelGeneratorTest.this.builder.setBody(fooMethod, expression);
                   }
                 };
             JvmOperation _method =
                 JvmModelGeneratorTest.this.builder.toMethod(it, "foo", _typeForName, _function);
             JvmModelGeneratorTest.this.builder.<JvmOperation>operator_add(_members_2, _method);
           }
         };
     final JvmGenericType clazz = this.builder.toClass(expression, "my.test.Outer", _function);
     Resource _eResource = expression.eResource();
     _eResource.eSetDeliver(false);
     Resource _eResource_1 = expression.eResource();
     EList<EObject> _contents = _eResource_1.getContents();
     this.builder.<JvmGenericType>operator_add(_contents, clazz);
     Resource _eResource_2 = expression.eResource();
     _eResource_2.eSetDeliver(true);
     InMemoryFileSystemAccess _inMemoryFileSystemAccess = new InMemoryFileSystemAccess();
     final InMemoryFileSystemAccess fsa = _inMemoryFileSystemAccess;
     Resource _eResource_3 = expression.eResource();
     this.generator.doGenerate(_eResource_3, fsa);
     Map<String, CharSequence> _files = fsa.getFiles();
     String _identifier = clazz.getIdentifier();
     String _replace = _identifier.replace(".", "/");
     String _plus = (IFileSystemAccess.DEFAULT_OUTPUT + _replace);
     String _plus_1 = (_plus + ".java");
     CharSequence _get = _files.get(_plus_1);
     final String code = _get.toString();
     boolean _contains = code.contains("import");
     Assert.assertFalse(_contains);
     boolean _contains_1 = code.contains("java.lang.String foo");
     Assert.assertTrue(_contains_1);
     String _identifier_1 = clazz.getIdentifier();
     final Class<? extends Object> compiledClass =
         this.javaCompiler.compileToClass(_identifier_1, code);
     Resource _eResource_4 = expression.eResource();
     EList<EObject> _contents_1 = _eResource_4.getContents();
     EObject _head = IterableExtensions.<EObject>head(_contents_1);
     this.helper.assertNoErrors(_head);
     Class<? extends Object>[] _declaredClasses = compiledClass.getDeclaredClasses();
     int _size =
         ((List<Class<? extends Object>>) Conversions.doWrapArray(_declaredClasses)).size();
     Assert.assertEquals(2, _size);
     Class<? extends Object>[] _declaredClasses_1 = compiledClass.getDeclaredClasses();
     Class<? extends Object> _head_1 =
         IterableExtensions.<Class<? extends Object>>head(
             ((Iterable<Class<? extends Object>>) Conversions.doWrapArray(_declaredClasses_1)));
     Class<? extends Object>[] _declaredClasses_2 = compiledClass.getDeclaredClasses();
     Class<? extends Object> _last =
         IterableExtensions.<Class<? extends Object>>last(
             ((Iterable<Class<? extends Object>>) Conversions.doWrapArray(_declaredClasses_2)));
     Method _method = compiledClass.getMethod("foo", _head_1, _last);
     Assert.assertNotNull(_method);
   } catch (Exception _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }