|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.core; import java.util.Enumeration; import java.util.MissingResourceException; import java.util.Properties; import java.util.ResourceBundle; import java.util.StringTokenizer; import junit.framework.*; import org.netbeans.junit.*; /** * Test of all resurce bundle keys used in Jelly2 * @author Adam Sotona */ public class BundleKeysTest extends NbTestCase { String keys; /** Use for internal test execution inside IDE * @param args command line arguments */ public static void main(java.lang.String[] args) { junit.textui.TestRunner.run(suite()); } /** Method used for explicit testsuite definition * @return created suite */ public static Test suite() { TestSuite suite = new NbTestSuite(); try { Properties props=new Properties(); props.load(BundleKeysTest.class.getClassLoader().getResourceAsStream("org/netbeans/core/BundleKeysTest.properties")); Enumeration bundles=props.keys(); String bundle; while (bundles.hasMoreElements()) { bundle=(String)bundles.nextElement(); suite.addTest(new BundleKeysTest(bundle, props.getProperty(bundle))); } } catch (Exception e) {} return suite; } /** Constructor required by JUnit. * @param testName method name to be used as testcase */ public BundleKeysTest(String bundleName, String keys) { super(bundleName); this.keys=keys; } protected void runTest() throws Throwable { ResourceBundle bundle=ResourceBundle.getBundle(getName()); StringTokenizer tok=new StringTokenizer(keys, ","); String key=""; String missing=""; int mis=0; while (tok.hasMoreTokens()) try { key=tok.nextToken(); bundle.getObject(key); } catch (MissingResourceException mre) { missing+=key+" "; mis++; } if (mis>0) throw new AssertionFailedError("Missing "+String.valueOf(mis)+" key(s): "+missing+". Please inform QA or any JellyTools developer."); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.