Package com.google.test.metric

Examples of com.google.test.metric.MethodInfo


      functionDefinition.accept(localVariablesExtractor);
      OperationBuilder operationBuilder = new OperationBuilder(repository);
      functionDefinition.accept(operationBuilder);

      ClassInfo classInfo = stack.peek();
      classInfo.addMethod(new MethodInfo(
          classInfo,
          functionDefinition.getName(),
          functionDefinition.getLine(),
          null,
          functionDefinition.getParameters(),
View Full Code Here


      assertTrue(actual, expectingOps.remove(actual));
    }
  }

  public void testConstructor() throws Exception {
    MethodInfo method = getMethod("Simple()", Simple.class);
    List<Operation> operations = method.getOperations();
    assertOperations(
        operations,
        "java.lang.Object:Object()",
        "java.lang.Object:Object()",
        "com.google.test.metric.method.MethodBlockTest.Simple.a{java.lang.Object} <- new{java.lang.Object}");
View Full Code Here

    }
  }

  public void testTryCatchBlock() throws Exception {

    MethodInfo method = getMethod("void method()", TryCatchFinally.class);
    String operations = method.getOperations().toString();

    assertTrue(operations.contains("b{int} <- 1{int}"));
    assertTrue(operations.contains("b{int} <- 2{int}"));
    assertTrue(operations.contains("b{int} <- 3{int}"));
    assertTrue(operations.contains("b{int} <- 4{int}"));
View Full Code Here

    return classInfo.getMethod(methodName);
  }

  public void testMethodWithIIF() throws Exception {
    Class<IIF> clazz = IIF.class;
    MethodInfo method = getMethod("void method()", clazz);
    assertOperations(method.getOperations(),
        "b{int} <- 1{int}",
        "java.lang.Object:Object()",
        clazz.getCanonicalName() + ".a{java.lang.Object} <- new{java.lang.Object}",
        clazz.getCanonicalName() + ".a{java.lang.Object} <- null{java.lang.Object}",
        "b{int} <- 2{int}");
View Full Code Here

      a = 5;
    }
  }

  public void testSwitchTable() throws Exception {
    MethodInfo method = getMethod("void method()", SwitchTable.class);
    assertOperations(method.getOperations(), "a{int} <- 0{int}",
        "a{int} <- 1{int}", "a{int} <- 2{int}", "a{int} <- 3{int}",
        "a{int} <- 4{int}", "a{int} <- 5{int}");
  }
View Full Code Here

      return staticText.length();
    }
  }

  public void testCallMethodsLength() throws Exception {
    MethodInfo method = getMethod("int length()", CallMethods.class);
    assertOperations(method.getOperations(), "java.lang.String:int length()", "return ?{int}");
  }
View Full Code Here

    MethodInfo method = getMethod("int length()", CallMethods.class);
    assertOperations(method.getOperations(), "java.lang.String:int length()", "return ?{int}");
  }

  public void testCallMethodsStaticLength() throws Exception {
    MethodInfo method = getMethod("int staticLength()", CallMethods.class);
    assertOperations(method.getOperations(), "java.lang.String:int length()", "return ?{int}");
  }
View Full Code Here

  }

  /** used for testing */
  public MethodCost compute(String clazz, String methodName) {
    ClassInfo classInfo = classRepository.getClass(clazz);
    MethodInfo method = classInfo.getMethod(methodName);
    return metricComputer.compute(method);
  }
View Full Code Here

    assertEquals(0, methodCost.getTotalCost().getCyclomaticComplexityCost());
    assertEquals(1, methodCost.getTotalCost().getGlobalCost());
  }

  public void testGadgetGetCountHasOneReturnOperation() throws Exception {
    MethodInfo getCount = repo.getClass(Gadget.class.getCanonicalName()).getMethod("int getCount()");
    assertEquals(1, getCount.getOperations().size());
  }
View Full Code Here

    }
    block.decomposeIntoBlocks();
    try {
      String javaName = namer.nameMethod(classInfo.getName(), name, desc);
      boolean isConstructor = name.equals("<init>") || name.equals("<clinit>");
      MethodInfo methodInfo = new MethodInfo(classInfo, javaName, startingLineNumber,
          methodThis, parameters, localVariables, visibility,
          block.getOperations(), isFinal, isConstructor, cyclomaticComplexity);
      classInfo.addMethod(methodInfo);
    } catch (IllegalStateException e) {
      throw new IllegalStateException("Error in " + classInfo + "." + name
View Full Code Here

TOP

Related Classes of com.google.test.metric.MethodInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.