From 4feb835a5339c3f63d73fbd6db2fe307e1f08ed1 Mon Sep 17 00:00:00 2001 From: acolyer Date: Thu, 29 Jul 2004 15:04:00 +0000 Subject: Moved all weaver messages into weaver-messages.properties. Includes fixes for Bugzilla Bug 30439 spurious "circular dependency" error --- .../testsrc/org/aspectj/weaver/BcweaverTests.java | 1 + .../org/aspectj/weaver/WeaverMessagesTestCase.java | 50 ++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java (limited to 'weaver/testsrc') diff --git a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java index 1803cf2fd..ac1587b54 100644 --- a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java +++ b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java @@ -53,6 +53,7 @@ public class BcweaverTests extends TestCase { suite.addTestSuite(MemberTestCase.class); suite.addTestSuite(TypeXTestCase.class); suite.addTestSuite(WeavingURLClassLoaderTest.class); + suite.addTestSuite(WeaverMessagesTestCase.class); //$JUnit-END$ return suite; } diff --git a/weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java b/weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java new file mode 100644 index 000000000..99efe3dc3 --- /dev/null +++ b/weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.weaver; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.util.MissingResourceException; + +import junit.framework.TestCase; + +/** + * @author colyer + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +public class WeaverMessagesTestCase extends TestCase { + + public void testAllMessagesDefined() { + + Class wmClass = WeaverMessages.class; + Field[] fields = wmClass.getDeclaredFields(); + List fieldList = new ArrayList(); + for (int i = 0; i < fields.length; i++) { + Field f = fields[i]; + if (f.getType() == String.class) { + try { + String key = (String) f.get(null); + String value = WeaverMessages.format(key); + assertFalse("Each key should be unique",fieldList.contains(key)); + fieldList.add(key); +// System.out.println(key + "," + value); + } catch (IllegalAccessException ex) { + } catch(MissingResourceException mrEx) { + fail("Missing resource: " + mrEx); + } + } + } + } + +} -- cgit v1.2.3