PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/testability-explorer/src/test/java/com/google/test/metric/javasrc/JavaClassInfoBuilderTest.java

http://testability-explorer.googlecode.com/
Java | 52 lines | 29 code | 8 blank | 15 comment | 0 complexity | 1eaa0f3e4be05a36ff4fe8a65a9183e5 MD5 | raw file
 1/*
 2 * Copyright 2009 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.javasrc;
17
18import java.util.ArrayList;
19
20import junit.framework.TestCase;
21
22import com.google.test.metric.ClassRepository;
23import com.google.test.metric.JavaClassRepository;
24import com.google.test.metric.Type;
25
26public class JavaClassInfoBuilderTest extends TestCase {
27
28  ClassRepository parent = new JavaClassRepository();
29  JavaSrcRepository repository = new JavaSrcRepository(parent, null);
30  Qualifier qualifier = new Qualifier();
31  CompilationUnitBuilder builder = new CompilationUnitBuilder(repository, qualifier, "");
32
33  public void testClassNameIsConcatinationOfPackageAndType() throws Exception {
34    qualifier.setPackage("pkg");
35    builder.startType(0, "A", null, new ArrayList<Type>());
36    builder.endType();
37    assertNull(builder.type);
38    assertEquals("pkg.A", repository.getClass("pkg.A").getName());
39  }
40
41  public void testInnerClass() throws Exception {
42    qualifier.setPackage("pkg");
43    qualifier.addAlias("B", "pkg.A$B");
44    builder.startType(0, "A", null, new ArrayList<Type>());
45    builder.startType(0, "B", null, new ArrayList<Type>());
46    builder.endType();
47    builder.endType();
48    assertNull(builder.type);
49    assertEquals("pkg.A$B", repository.getClass("pkg.A$B").getName());
50  }
51
52}