/eclipse-plugin/com.google.test.metric.eclipse.ui.test/src/main/java/com/google/test/metric/eclipse/internal/util/TestabilityExplorerMessageRetrieverTest.java

http://testability-explorer.googlecode.com/ · Java · 47 lines · 22 code · 5 blank · 20 comment · 0 complexity · 7f15b4adbb6beaa173f91039174982c9 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. */
  16. package com.google.test.metric.eclipse.internal.util;
  17. import com.google.test.metric.report.issues.IssueSubType;
  18. import com.google.test.metric.report.issues.IssueType;
  19. import junit.framework.TestCase;
  20. /**
  21. * Tests for {@link TestabilityExplorerMessageRetriever}
  22. *
  23. * @author shyamseshadri@google.com (Shyam Seshadri)
  24. */
  25. public class TestabilityExplorerMessageRetrieverTest extends TestCase {
  26. TestabilityExplorerMessageRetriever retriever = new TestabilityExplorerMessageRetriever();
  27. public void testConvertTypeSubTypeToString() throws Exception {
  28. assertEquals("construction.static_init",
  29. retriever.convertTypeSubTypeToString(IssueType.CONSTRUCTION, IssueSubType.STATIC_INIT));
  30. assertEquals("construction.setter",
  31. retriever.convertTypeSubTypeToString(IssueType.CONSTRUCTION, IssueSubType.SETTER));
  32. assertEquals("collaborator.non_mockable",
  33. retriever.convertTypeSubTypeToString(IssueType.COLLABORATOR, IssueSubType.NON_MOCKABLE));
  34. assertEquals("directcost.complexity",
  35. retriever.convertTypeSubTypeToString(IssueType.DIRECT_COST, IssueSubType.COMPLEXITY));
  36. }
  37. public void testGetSuggestion() throws Exception {
  38. assertEquals("Suggestion: refactor the method by breaking the complex portions into several"
  39. + " smaller methods.",
  40. retriever.getSuggestion(IssueType.DIRECT_COST, IssueSubType.COMPLEXITY));
  41. }
  42. }