PageRenderTime 33ms CodeModel.GetById 24ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/testability-explorer/src/test/java/com/google/test/metric/report/RemovePackageFormatterTest.java

http://testability-explorer.googlecode.com/
Java | 39 lines | 27 code | 8 blank | 4 comment | 0 complexity | 24ae5e0a0ddbcb8cc01ce7f86dd07f87 MD5 | raw file
 1// Copyright 2009 Google Inc. All Rights Reserved.
 2
 3package com.google.test.metric.report;
 4
 5import junit.framework.TestCase;
 6
 7/**
 8 * @author alexeagle@google.com (Alex Eagle)
 9 */
10public class RemovePackageFormatterTest extends TestCase {
11  RemovePackageFormatter formatter = new RemovePackageFormatter();
12
13  public void testShortFormatting() throws Exception {
14    String shortened = formatter.format("int com.google.longpackagename.Foo.thing()");
15    assertEquals("int thing()", shortened);
16  }
17
18  public void testShortFormattingWithParameters() throws Exception {
19    String shortened = formatter.format("t.n.e(p.e, a.b)");
20    assertEquals("e(e, b)", shortened);
21  }
22
23  public void testInnerClassMethodNamesShortFormatting() throws Exception {
24    String shortened = formatter.format("String com.google.Outer$HasInner.computeString()");
25    assertEquals("String computeString()", shortened);
26  }
27
28  public void testInnerClassConstructorMethod() throws Exception {
29    String shortened = formatter.format("com.google.test.metric.example.ExpensiveConstructor."
30        + "StaticWorkInTheConstructor$StaticHolder()");
31    assertEquals("StaticWorkInTheConstructor$StaticHolder()", shortened);
32  }
33
34  public void testTypeNameShortening() throws Exception {
35    String shortened = formatter.format("com.google.test.metric.example.ExpensiveConstructor."
36        + "StaticWorkInTheConstructor$StaticHolder");
37    assertEquals("StaticWorkInTheConstructor$StaticHolder", shortened);
38  }
39}