/testability-explorer/src/test/java/com/google/test/metric/report/SourceLoaderTest.java
Java | 47 lines | 24 code | 8 blank | 15 comment | 0 complexity | c58a3bcb3f434024488327da9ea30c9c MD5 | raw file
Possible License(s): Apache-2.0
- /*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
- package com.google.test.metric.report;
- import junit.framework.TestCase;
- import com.google.classpath.ClassPath;
- import com.google.classpath.ClassPathFactory;
- public class SourceLoaderTest extends TestCase {
- private final ClassPath classPath = new ClassPathFactory().createFromPaths("src/test/java", "core/src/test/java");
- public void testReadSourceFile() throws Exception {
- SourceLoader loader = new SourceLoader(classPath);
- Source source = loader.load(getClass().getName());
- assertEquals(" * Copyright 2007 Google Inc.", source.getLine(2).getText());
- }
- private static class InnerClass {
- }
- public void testReadInnerSourceFile() throws Exception {
- SourceLoader loader = new SourceLoader(classPath);
- Source source = loader.load(InnerClass.class.getCanonicalName());
- assertEquals(" * Copyright 2007 Google Inc.", source.getLine(2).getText());
- }
- public void testNonExistantSource() throws Exception {
- SourceLoader loader = new SourceLoader(classPath);
- Source source = loader.load("X-I don't exist-X");
- assertNotNull(source);
- }
- }