コード例 #1
0
 private static void matchJasmineFileStructures(
     @NotNull JasmineFileStructure jasmineFileStructure,
     @NotNull MarkedJasmineFileStructure markedJasmineFileStructure) {
   Collection<MarkedJasmineSuiteStructure> markedJasmineSuiteStructures =
       markedJasmineFileStructure.getInnerSuiteStructures();
   for (MarkedJasmineSuiteStructure markedJasmineSuiteStructure : markedJasmineSuiteStructures) {
     JasmineSuiteStructure jasmineSuiteStructure =
         jasmineFileStructure.findTopLevelSuiteByName(markedJasmineSuiteStructure.getName());
     if (jasmineSuiteStructure == null) {
       Assert.fail(
           "Can't find automatically collected Jasmine suite with name '"
               + markedJasmineSuiteStructure.getName()
               + "'!");
     }
     matchJasmineSuites(jasmineSuiteStructure, markedJasmineSuiteStructure);
   }
   if (jasmineFileStructure.getTopLevelSuiteCount() != markedJasmineSuiteStructures.size()) {
     Assert.fail(
         "Marked Jasmine suite count is "
             + markedJasmineSuiteStructures.size()
             + ", but automatically collected Jasmine suite count is "
             + jasmineFileStructure.getTopLevelSuiteCount());
   }
 }
コード例 #2
0
  private static void matchJasmineSuites(
      @NotNull JasmineSuiteStructure jasmineSuiteStructure,
      @NotNull MarkedJasmineSuiteStructure markedJasmineSuiteStructure) {
    Assert.assertEquals(jasmineSuiteStructure.getName(), markedJasmineSuiteStructure.getName());
    Assert.assertEquals(
        jasmineSuiteStructure.getEnclosingCallExpression(),
        markedJasmineSuiteStructure.getPsiElement());
    Collection<MarkedJasmineSuiteStructure> innerMarkedSuiteStructures =
        markedJasmineSuiteStructure.getInnerSuiteStructures();
    for (MarkedJasmineSuiteStructure innerMarkedSuiteStructure : innerMarkedSuiteStructures) {
      JasmineSuiteStructure innerSuiteStructure =
          jasmineSuiteStructure.getInnerSuiteByName(innerMarkedSuiteStructure.getName());
      if (innerSuiteStructure == null) {
        Assert.fail(
            "Can't find automatically collected Jasmine suite with name '"
                + innerMarkedSuiteStructure.getName()
                + "'!");
      }
      matchJasmineSuites(innerSuiteStructure, innerMarkedSuiteStructure);
    }
    Assert.assertEquals(
        "Checking inner suite count of '" + jasmineSuiteStructure.getName() + "' suite",
        innerMarkedSuiteStructures.size(),
        jasmineSuiteStructure.getSuiteChildrenCount());

    Collection<MarkedJasmineSpecStructure> innerMarkedSpecStructures =
        markedJasmineSuiteStructure.getInnerSpecStructures();
    for (MarkedJasmineSpecStructure innerMarkedSpecStructure : innerMarkedSpecStructures) {
      JasmineSpecStructure innerSpecStructure =
          jasmineSuiteStructure.getInnerSpecByName(innerMarkedSpecStructure.getName());
      if (innerSpecStructure == null) {
        Assert.fail(
            "Can't find automatically collected Jasmine spec with name '"
                + innerMarkedSpecStructure.getName()
                + "'!");
      }
      matchJasmineSpecs(innerSpecStructure, innerMarkedSpecStructure);
    }
    Assert.assertEquals(
        "Checking inner spec count of '" + jasmineSuiteStructure.getName() + "' suite",
        innerMarkedSpecStructures.size(),
        jasmineSuiteStructure.getSpecCount());
  }