コード例 #1
0
ファイル: TestToUML.java プロジェクト: KaetheKong/CSSE374
  @Test
  public void testCodeASM() {
    CodeASM ASMParser = new CodeASM("TestFiles.TestJavaCodeASMParsing");
    try {
      ASMParser.run(false);
    } catch (IOException e) {
      e.printStackTrace();
    }
    ASMParser.getFields();
    ASMParser.getMethods();
    String classAccess = ASMParser.getClassAccess();
    String className = ASMParser.getClassName();
    String superclassNames = ASMParser.getSuperclassName();
    if (superclassNames.startsWith("java")) {
      superclassNames = null;
    }
    ASMParser.getClassInterfaces();
    boolean isInterface = ASMParser.isInterface();
    boolean isAbstract = ASMParser.isAbstract();

    assertEquals(classAccess, "public");
    assertEquals(className, "TestFiles/TestJavaCodeASMParsing");
    assertFalse(isInterface);
    assertFalse(isAbstract);
    assertEquals(superclassNames, null);
  }
コード例 #2
0
ファイル: TestToUML.java プロジェクト: KaetheKong/CSSE374
  @Test
  public void testUsesClass() {
    IData<IDesignPattern> dpd = new DesignPatternData(0, 0, 0);
    dpd.initialize(true, null);

    CodeASM ASMParser = new CodeASM("TestFiles.TestJavaCodeASMParsing");
    try {
      ASMParser.run(false);
    } catch (IOException e) {
      e.printStackTrace();
    }
    Map<String, FieldClass> fields = ASMParser.getFields();
    Map<String, MethodClass> methods = ASMParser.getMethods();
    ArrayList<String> Classnames = new ArrayList<String>();
    Classnames.add(ASMParser.getClassName());

    ArrayList<MethodClass> allmethods = new ArrayList<>();
    ArrayList<FieldClass> allfields = new ArrayList<>();

    for (String f : fields.keySet()) {
      allfields.add(fields.get(f));
    }

    for (String m : methods.keySet()) {
      allmethods.add(methods.get(m));
    }

    ClassClass newCC =
        new ClassClass(
            allmethods,
            allfields,
            ASMParser.getSuperclassName(),
            ASMParser.getClassInterfaces(),
            ASMParser.getClassAccess(),
            ASMParser.getClassName(),
            ASMParser.isInterface(),
            ASMParser.isAbstract(),
            dpd);

    IConnection useTest = new UsesClass(newCC, Classnames);
    String edge =
        "    edge [\n\t style = \"dashed\"\n\t arrowhead = \"open\"\n\t label = \"\"\n    ]\n";
    String connections = "";
    assertEquals(useTest.getEdge(), edge);
    assertEquals(useTest.getConnection(), connections);
  }