/testability-explorer/src/main/resources/messages.properties

http://testability-explorer.googlecode.com/ · Properties File · 152 lines · 79 code · 19 blank · 54 comment · 0 complexity · bc6fa168539891cb3f19169510848762 MD5 · raw file

  1. ###
  2. #
  3. # Copyright 2007 Google Inc.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License"); you may not
  6. # use this file except in compliance with the License. You may obtain a copy of
  7. # the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. # License for the specific language governing permissions and limitations under
  15. # the License.
  16. #
  17. ###
  18. ###
  19. # US-English message bundle for the testability explorer reports.
  20. # It contains some HTML markup, so it's intended to be displayed in HTML.
  21. # TODO(alexeagle): we'll probably want to render issues in other contexts, like the CLI or IDE
  22. #
  23. # @author alexeagle@google.com (Alex Eagle)
  24. ###
  25. report.title=Testability Report
  26. report.timestamp=Report generated on: {0,date,yyyy-MM-dd hh:mm:ss}
  27. report.explain.linkToWiki=Why is it bad?
  28. report.explain.onLine=On line
  29. report.explain.aroundLine=\
  30. <acronym title="Java class file format doesn't \
  31. include line numbers for method declarations">Around line</acronym>
  32. report.explain.contribution=Contribution<br/>to class cost
  33. report.explain.class.hardToTest=Class {0}{1}{2} is hard to test because:
  34. ###
  35. # Hard to test due to construction of the class
  36. ###
  37. report.explain.class.construction=\
  38. It is expensive to construct an instance of the class, and every test will need to call a constructor.
  39. report.explain.class.construction.static_init=\
  40. These static initializers will need to be run once, when the class is loaded.
  41. report.explain.class.construction.static_init.element={0}static {1}{2} is declared
  42. report.explain.class.construction.static_init.suggest=\
  43. Instead of initializing this state statically, try initializing a fresh copy in each instance. \
  44. Creating new objects in Java is cheap, and this static state can't be cleaned up between tests.
  45. report.explain.class.construction.static_method=Static methods are called in constructor
  46. report.explain.class.construction.static_method.element=static method {0}{1}{2} is called
  47. report.explain.class.construction.static_method.suggest=\
  48. This couples every test to use the code in the static method. \
  49. Refactor the static method to be an instance method on the class.
  50. report.explain.class.construction.setter=Setters will need to be called by tests
  51. report.explain.class.construction.setter.element=\
  52. Setter method {0}{1}{2} may need to be called before some methods can be tested
  53. report.explain.class.construction.setter.suggest=\
  54. Setter methods should avoid doing serious work. Instead, the \
  55. initialized state should be passed to the setter.
  56. report.explain.class.construction.non_mockable=You are calling <tt>new</tt> in the constructor
  57. report.explain.class.construction.non_mockable.element=<tt>new</tt> instance of {0}{1}{2} created
  58. report.explain.class.construction.non_mockable.suggest=\
  59. Using new couples this class to the one instantiated, \
  60. preventing you from testing this class in isolation of that collaborator. \
  61. Instead, pass an instance of the collaborator as a new constructor parameter.
  62. report.explain.class.construction.complexity=Constructors with a high cyclomatic complexity
  63. report.explain.class.construction.complexity.element={0}{1}{2} is complex
  64. report.explain.class.construction.complexity.suggest=\
  65. Don't perform work in the constructor. Instead, initialize all the needed state, and pass \
  66. it as a new parameter.
  67. report.explain.class.construction.singleton=A singleton is used
  68. report.explain.class.construction.singleton.element=mutable global field {0}{1}{2} is declared
  69. report.explain.class.construction.singleton.suggest=Don't use singletons. Instead, use a \
  70. dependency injection framework or factory that always returns the same instance.
  71. #report.explain.class.staticInit=Static initializers must be run:
  72. #report.explain.class.staticInit.variable=a static member variable {0} is initialized to a value that is complex to evaluate.
  73. #report.explain.class.staticInit.suggest=Suggestion: these static members are complex. Instantiate the values outside this class, and pass them as parameters to the constructor.
  74. #report.explain.class.constructor=The constructor does work:
  75. #report.explain.class.constructor.methodExec=in the constructor, {0} is executed, which has a high complexity.
  76. #report.explain.class.constructor.suggest=Suggestion: tests will have to execute this code to create an instance. Do this work outside the class, and pass the needed state as a parameter to the constructor. If this is impossible, at least move this code to an initialization method.
  77. ###
  78. # Hard to test due to non-mockable collaborators
  79. ###
  80. report.explain.class.collaborator=\
  81. These collaborators cannot be mocked, so it is impossible to unit test this class in isolation.
  82. report.explain.class.collaborator.static_method=Static methods are called:
  83. report.explain.class.collaborator.static_method.element=static method {0}{1}{2} is called
  84. report.explain.class.collaborator.static_method.suggest=\
  85. Since these static methods are complex, we want to mock them out in the unit test. \
  86. If they are declared in your code, refactor the methods to be non-static, \
  87. and inject an instance of the class. Otherwise, you can create a wrapper object.
  88. report.explain.class.collaborator.non_mockable=Non-mockable collaborators:
  89. report.explain.class.collaborator.non_mockable.element={0}{1}{2} is called
  90. # TODO(alexeagle): figure out which reason is the right one here
  91. report.explain.class.collaborator.non_mockable.suggest=\
  92. This method call can't be mocked out from a unit test because the test cannot \
  93. control how the object is instantiated. This can be caused by: \
  94. - the object was created using new, \
  95. - it was returned by a non-mockable collaborator, or \
  96. - the method is declared final or private, which prevents overriding in a subclass
  97. report.explain.class.collaborator.singleton=Singletons are used:
  98. report.explain.class.collaborator.singleton.element=mutable global state is accessed by {0}{1}{2}
  99. report.explain.class.collaborator.singleton.suggest=\
  100. Don't use singletons. Instead, use \
  101. dependency injection and always inject the same instance.
  102. ###
  103. # Hard to test because of direct costs
  104. ###
  105. report.explain.class.directCost=\
  106. The code itself is complex, and it will be hard to test all the different paths of execution
  107. report.explain.class.directcost.complexity=\
  108. There are complicated methods
  109. report.explain.class.directcost.complexity.element=method {0}{1}{2} has high complexity
  110. report.explain.class.directcost.complexity.suggest=\
  111. Refactor the method by breaking the complex portions into several smaller methods.
  112. ###
  113. # Hard to test because of mutable global state
  114. ###
  115. ###
  116. # Makes other code hard to test
  117. ###
  118. #report.explain.class.impactOnOthers=This class may make it hard to test other code that uses it because:
  119. #report.explain.class.staticVars=Static variables need to be set to the correct state
  120. #
  121. report.explain.class.benefits=If these changes were made, the cost of testing this class would be reduced by {0}{1,number,##%}{2}.
  122. ################################
  123. #
  124. # The "About Testability" report
  125. #
  126. ################################
  127. report.about.title=Examples of how Testability works
  128. report.about.description=Testability explorer analyzes compiled classes, looking for issues in your code that make it difficult to unit test. \
  129. Each class below is an example of a particular bad practice, and is followed by the explanation of the issues that are found in that code. \
  130. <strong>To make the examples short, the issues in this code are minor. To demonstrate the report, the sensitivity has been set artificially high.\
  131. Normally, these issues would not be reported. </strong>\
  132. To create a report like this for your code, see <a href="http://testability-explorer.googlecode.com">the Testability Explorer website</a>.
  133. report.about.class=Example class: {0}{1}{2}