### Question:
ErrorType implements Serializable { public ErrorType(String errorKey, String msgPattern) { this.key = errorKey; this.msgPattern = msgPattern; int numParamCount = 0; while(true) { String placeholder = "{" + String.valueOf(numParamCount) + "}"; if (msgPattern.indexOf(placeholder)<0) break; numParamCount++; } this.numParams = numParamCount; log.debug("Error defined: " + key + "=" + msgPattern); } ErrorType(String errorKey, String msgPattern); String getKey(); String getMessagePattern(); int getNumParams();  }### Answer:
@Test public void testErrorType() { ErrorType errorType = new ErrorType("key", " {0} and {1} and {3} is {2}"); assertEquals(4, errorType.getNumParams()); assertEquals("key", errorType.getKey()); assertEquals(" {0} and {1} and {3} is {2}", errorType.getMessagePattern()); }