/testability-explorer/src/main/java/com/google/test/metric/Testability.java

http://testability-explorer.googlecode.com/ · Java · 54 lines · 24 code · 8 blank · 22 comment · 0 complexity · da46f984c376d2e1c944d7ab3864c58a MD5 · raw file

  1. /*
  2. * Copyright 2007 Google Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.google.test.metric;
  17. /**
  18. * Has the responsibility of acting as the static main() entrypoint to the application.
  19. * Delegates to CommandLineConfig for available command line options to parse.
  20. * Delegates to Args4J for the responsibility of parsing options.
  21. * Delegates to TestabilityRunner to actually run the analysis.
  22. */
  23. import com.google.inject.CreationException;
  24. import com.google.inject.Guice;
  25. import com.google.inject.Inject;
  26. public class Testability {
  27. private final Runnable runner;
  28. @Inject
  29. public Testability(Runnable runner) {
  30. this.runner = runner;
  31. }
  32. public static void main(String... args) {
  33. try {
  34. Guice.createInjector(
  35. new ConfigModule(args, System.out, System.err),
  36. new TestabilityModule()).
  37. getInstance(Testability.class).
  38. run();
  39. } catch (CreationException e) {
  40. // ignore, the error is printed in the ConfigModule
  41. }
  42. }
  43. public void run() {
  44. runner.run();
  45. }
  46. }