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 015package org.apache.tapestry.test; 016 017import org.apache.hivemind.impl.MessageFormatter; 018import org.apache.hivemind.service.ClassFabUtils; 019 020/** 021 * Container of static methods to format logging and exception messages, used within the 022 * 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 be called 025 * TestMessages ... but that's always a bad idea (it makes the class look like a JUnit test suite). 026 * <p> 027 * This class is public, not package private, because some related sub-packages make use of it as 028 * well. 029 * 030 * @author Howard Lewis Ship 031 * @since 4.0 032 */ 033public class ScriptMessages 034{ 035 private final static MessageFormatter _formatter = new MessageFormatter(ScriptMessages.class); 036 037 static String wrongTypeForEnhancement(Class type) 038 { 039 return _formatter 040 .format("wrong-type-for-enhancement", ClassFabUtils.getJavaClassName(type)); 041 } 042 043 static String unableToInstantiate(Class abstractClass, Throwable cause) 044 { 045 return _formatter.format("unable-to-instantiate", abstractClass.getName(), cause); 046 } 047}