Package org.jmock.lib
Class LastWordNamingScheme
java.lang.Object
org.jmock.lib.LastWordNamingScheme
- All Implemented Interfaces:
MockObjectNamingScheme
A naming scheme in which the implicit name for a mock object is
the last word of the mocked type's name in lower case.
E.g. A mock object of type HelloWorld would be named "world".
If the type name is an acronym it is completely lowercased.
For example, the type URL would be named "url". Digits and other
non-letter characters are left on the end of the word. For
example, the type NMEA0183 would be named "nmea0183".
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondefaultNameFor
(Class<?> typeToMock) Derive a name for a mock object from the name of the given type.private int
indexOfLastLetter
(String simpleName) private int
indexOfLastLowerCaseChar
(String simpleName, int wordEnd) private int
indexOfLastUpperCaseChar
(String simpleName, int wordEnd)
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
LastWordNamingScheme
private LastWordNamingScheme()
-
-
Method Details
-
defaultNameFor
Description copied from interface:MockObjectNamingScheme
Derive a name for a mock object from the name of the given type.- Specified by:
defaultNameFor
in interfaceMockObjectNamingScheme
- Parameters:
typeToMock
- The type being mocked.- Returns:
- The default name for a mock object of the given type.
-
indexOfLastLetter
-
indexOfLastUpperCaseChar
-
indexOfLastLowerCaseChar
-