001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.test; 016 017 import org.apache.hivemind.impl.MessageFormatter; 018 import org.apache.hivemind.service.ClassFabUtils; 019 020 /** 021 * Container of static methods to format logging and exception messages, used 022 * within the org.apache.tapesty.test package (and a few sub-packages). 023 * <p> 024 * Technically, these are messages for the test package, and this class should 025 * be called TestMessages ... but that's always a bad idea (it makes the class 026 * look like a JUnit test suite). 027 * <p> 028 * This class is public, not package private, because some related sub-packages 029 * make use of it as well. 030 * 031 * @author Howard Lewis Ship 032 * @since 4.0 033 */ 034 public final class ScriptMessages 035 { 036 037 private static final MessageFormatter _formatter = new MessageFormatter( 038 ScriptMessages.class); 039 040 /* defeat instantiation */ 041 private ScriptMessages() 042 { 043 } 044 045 static String wrongTypeForEnhancement(Class type) 046 { 047 return _formatter.format("wrong-type-for-enhancement", ClassFabUtils 048 .getJavaClassName(type)); 049 } 050 051 static String unableToInstantiate(Class abstractClass, Throwable cause) 052 { 053 return _formatter.format("unable-to-instantiate", abstractClass 054 .getName(), cause); 055 } 056 }