Beispiel #1
0
  @Test
  public void testDestinationOfSpoon() throws Exception {
    final File binaryOutput = new File("./target/spoon/test/binary/");
    final Launcher launcher = new Launcher();
    launcher.getEnvironment().setShouldCompile(true);
    launcher.addInputResource("./src/test/java/spoon/test/api/testclasses");
    launcher.setSourceOutputDirectory("./target/spooned");
    launcher.setBinaryOutputDirectory(binaryOutput);
    launcher.run();

    assertTrue(binaryOutput.exists());
  }
Beispiel #2
0
  @Test
  public void testVariableAccessInNoClasspath() throws Exception {
    final Launcher launcher = new Launcher();
    launcher.getEnvironment().setNoClasspath(true);
    launcher.addInputResource("./src/test/resources/variable");
    launcher.setSourceOutputDirectory("./target/variable/");
    launcher.run();

    final CtClass<Object> aClass =
        launcher.getFactory().Class().get("org.argouml.uml.ui.behavior.use_cases.PropPanelUseCase");
    final List<CtFieldRead> elements = aClass.getElements(new TypeFilter<>(CtFieldRead.class));

    for (CtFieldRead element : elements) {
      assertNotNull(element.getVariable());
    }

    assertEquals(
        "java.lang.Class mclass = ((java.lang.Class) (org.argouml.model.ModelFacade.USE_CASE))",
        elements.get(0).getParent().toString());
    assertEquals(
        "new org.argouml.uml.ui.PropPanelButton(org.argouml.uml.ui.behavior.use_cases.PropPanelUseCase.this, buttonPanel, _navUpIcon, org.argouml.i18n.Translator.localize(\"UMLMenu\", \"button.go-up\"), \"navigateNamespace\", null)",
        elements.get(2).getParent().toString());
  }