/testability-explorer/src/main/java/com/google/test/metric/Testability.java
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 */ 16package com.google.test.metric; 17 18/** 19 * Has the responsibility of acting as the static main() entrypoint to the application. 20 * Delegates to CommandLineConfig for available command line options to parse. 21 * Delegates to Args4J for the responsibility of parsing options. 22 * Delegates to TestabilityRunner to actually run the analysis. 23 */ 24 25import com.google.inject.CreationException; 26import com.google.inject.Guice; 27import com.google.inject.Inject; 28 29public class Testability { 30 31 private final Runnable runner; 32 33 @Inject 34 public Testability(Runnable runner) { 35 this.runner = runner; 36 } 37 38 public static void main(String... args) { 39 try { 40 Guice.createInjector( 41 new ConfigModule(args, System.out, System.err), 42 new TestabilityModule()). 43 getInstance(Testability.class). 44 run(); 45 } catch (CreationException e) { 46 // ignore, the error is printed in the ConfigModule 47 } 48 } 49 50 public void run() { 51 runner.run(); 52 } 53 54}