01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.logging;
05:
06: import junit.framework.TestCase;
07:
08: public class KeysTest extends TestCase {
09:
10: public void test() {
11: String[] keys = Keys.getKeys(Class1.class);
12:
13: assertEquals(5, keys.length);
14:
15: for (int i = 0; i < keys.length; i++) {
16: assertEquals("index " + i, "good", keys[i]);
17: }
18:
19: }
20:
21: private static class Class1 {
22: static final String GOOD_1 = "good";
23: public static final String GOOD_2 = "good";
24: protected static final String GOOD_3 = "good";
25: private static final String GOOD_4 = "good";
26: transient static final String GOOD_5 = "good";
27:
28: private static final Object NO_GOOD_1 = new Object(); // not type String
29: private static String NO_GOOD_2 = "bad"; // not final
30: final String NO_GOOD_3 = "bad"; // not static
31: static final String No_GOOD_4 = "bad"; // not all caps
32:
33: public void silenceWarnings() {
34: // this method here to make eclipse shutup about unused variables
35: if (true) {
36: throw new Error("oh no you didn't!");
37: }
38:
39: System.out.println(GOOD_4);
40: System.out.println(NO_GOOD_1);
41: System.out.println(NO_GOOD_2);
42: }
43:
44: }
45:
46: }
|