Package com.google.gwt.dev.util

Examples of com.google.gwt.dev.util.UnitTestTreeLogger


      final Class<? extends ValidationException> expectedException,
      final Pattern expectedMessage) {
    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.expect(TreeLogger.ERROR, expectedMessage, expectedException);
    builder.setLowestLogLevel(TreeLogger.INFO);
    UnitTestTreeLogger testLogger = builder.createLogger();
    return testLogger;
  }
View Full Code Here


  }

  private void assertUnableToComplete(
      Class<? extends ValidationException> expectedException,
      Pattern expectedMessage, Generator generator, final String typeName) {
    UnitTestTreeLogger testLogger = createTestLogger(expectedException,
        expectedMessage);

    try {
      generator.generate(testLogger, context, typeName);
      Assert.fail("Expected a " + UnableToCompleteException.class);
    } catch (UnableToCompleteException expected) {
      // expected
    }
    testLogger.assertCorrectLogEntries();
  }
View Full Code Here

    builder.expectError(
        EditorModel.cycleErrorMessage(
            types.findType("t.CyclicEditorDriver.AEditor"), "<Root Object>",
            "b.a"), null);
    builder.expectError(EditorModel.poisonedMessage(), null);
    UnitTestTreeLogger testLogger = builder.createLogger();
    try {
      new EditorModel(testLogger, types.findType("t.CyclicEditorDriver"),
          rfedType);
      fail("Should have complained about cycle");
    } catch (UnableToCompleteException expected) {
    }
    testLogger.assertCorrectLogEntries();
  }
View Full Code Here

            types.findType("t.MissingGetterEditorDriver.AProxy")), null);
    builder.expectError(
        EditorModel.noGetterMessage("yetAgain",
            types.findType("t.MissingGetterEditorDriver.AProxy")), null);
    builder.expectError(EditorModel.poisonedMessage(), null);
    UnitTestTreeLogger testLogger = builder.createLogger();
    try {
      new EditorModel(testLogger,
          types.findType("t.MissingGetterEditorDriver"), rfedType);
      fail("Should have thrown exception");
    } catch (UnableToCompleteException expecetd) {
    }
    testLogger.assertCorrectLogEntries();
  }
View Full Code Here

        EditorModel.tooManyInterfacesMessage(types.findType("t.TooManyInterfacesEditorDriver")),
        null);
    builder.expectError(EditorModel.foundPrimitiveMessage(JPrimitiveType.LONG,
        "", "lastModified.foo"), null);
    builder.expectError(EditorModel.poisonedMessage(), null);
    UnitTestTreeLogger testLogger = builder.createLogger();

    try {
      new EditorModel(testLogger, types.getJavaLangObject(), rfedType);
      fail("Should have thrown exception");
    } catch (UnableToCompleteException expected) {
    }
    try {
      new EditorModel(testLogger, rfedType, rfedType);
      fail("Should have thrown exception");
    } catch (UnableToCompleteException expected) {
    }
    try {
      new EditorModel(testLogger,
          types.findType("t.TooManyInterfacesEditorDriver"), rfedType);
      fail("Should have thrown exception");
    } catch (UnableToCompleteException expected) {
    }
    try {
      new EditorModel(testLogger,
          types.findType("t.PersonEditorWithBadPrimitiveAccessDriver"),
          rfedType);
      fail("Should have thrown exception");
    } catch (UnableToCompleteException expected) {
    }
    testLogger.assertCorrectLogEntries();
  }
View Full Code Here

    builder.expectError(
        EditorModel.noEditorParameterizationMessage(
            types.findType(Editor.class.getName()),
            types.findType(SimpleEditor.class.getName()).isGenericType().getRawType()),
        null);
    UnitTestTreeLogger testLogger = builder.createLogger();
    try {
      new EditorModel(testLogger,
          types.findType("t.UnparameterizedEditorEditorDriver"), rfedType);
      fail("Should have thrown exception");
    } catch (UnableToCompleteException expecetd) {
    }
    testLogger.assertCorrectLogEntries();
  }
View Full Code Here

    builder.expectDebug(
        "Loading inherited module 'com.google.gwt.dev.cfg.testdata.errors.BadModule'", null);
    builder.expectError("Line 3, column 1 : Element type \"inherits\" must be followed by either "
        + "attribute specifications, \">\" or \"/>\".", null);

    UnitTestTreeLogger logger = builder.createLogger();

    try {
      ModuleDefLoader.loadFromClassPath(
          logger, compilerContext, "com.google.gwt.dev.cfg.testdata.errors.DeepInheritsError0");
      fail("Should have failed to load module.");
    } catch (UnableToCompleteException e) {
      // failure is expected.
    }
    logger.assertLogEntriesContainExpected();
  }
View Full Code Here

   */
  public void testModuleNamingInvalid() {
    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.ERROR);
    builder.expectError("Invalid module name: 'com.google.gwt.dev.cfg.testdata.naming.Invalid..Foo'", null);
    UnitTestTreeLogger logger = builder.createLogger();
    try {
      ModuleDefLoader.loadFromClassPath(
          logger, compilerContext, "com.google.gwt.dev.cfg.testdata.naming.Invalid..Foo");
      fail("Expected exception from invalid module name.");
    } catch (UnableToCompleteException expected) {
    }
    logger.assertLogEntriesContainExpected();
  }
View Full Code Here

   */
  public void testModuleNestedNamingInvalid() {
    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.ERROR);
    builder.expectError("Invalid module name: 'com.google.gwt.dev.cfg.testdata.naming.Invalid..Foo'", null);
    UnitTestTreeLogger logger = builder.createLogger();
    try {
      ModuleDefLoader.loadFromClassPath(logger,
          compilerContext, "com.google.gwt.dev.cfg.testdata.naming.NestedInvalid", false);
      fail("Expected exception from invalid module name.");
    } catch (UnableToCompleteException expected) {
    }
    logger.assertLogEntriesContainExpected();
  }
View Full Code Here

    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.WARN);
    for (String errorMessage : errorMessages) {
      builder.expectError(errorMessage, null);

      UnitTestTreeLogger logger = builder.createLogger();

      try {
        ModuleDefLoader.loadFromClassPath(
            logger, compilerContext, moduleName);
        fail("Should have failed to load module.");
      } catch (UnableToCompleteException e) {
        // failure is expected.
      }
      logger.assertCorrectLogEntries();
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.util.UnitTestTreeLogger

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.