-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Tool
The testing tools framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework.
To achieve this, testing tool supports some important concepts in an object-oriented way:
A test fixture represents the preparation needed to perform one or more tests, and any associated cleanup actions. This may involve, for example, creating temporary or proxy databases, directories, or starting a server process.
A test case is the individual unit of testing. It checks for a specific response to a particular set of inputs. Testing tool provides a base class, Test Case, which may be used to create new test cases.
A test suite is a collection of test cases, test suites, or both. It is used to aggregate tests that should be executed together.
A test runner is a component which orchestrates the execution of tests and provides the outcome to the user. The runner may use a graphical interface, a textual interface, or return a special value to indicate the results of executing the tests.
The testing tool module provides a rich set of tools for constructing and running tests. This section demonstrates that a small subset of the tools suffices to meet the needs of most users.
package java.awt.event;
import java.awt.Component;
import java.io.IOException;
import java.io.ObjectInputStream;
public class KeyEvent extends InputEvent {
private boolean isProxyActive;
public static final int KEY_FIRST = 400;
public static final int KEY_LAST = 402;
public static final int KEY_TYPED = 400;
public static final int KEY_PRESSED = 401;
public static final int KEY_RELEASED = 402;
public static final int VK_ENTER = 10;
public static final int VK_BACK_SPACE = 8;
public static final int VK_TAB = 9;
public static final int VK_CANCEL = 3;
public static final int VK_CLEAR = 12;
public static final int VK_SHIFT = 16;
public static final int VK_CONTROL = 17;
public static final int VK_ALT = 18;
public static final int VK_PAUSE = 19;
public static final int VK_CAPS_LOCK = 20;
public static final int VK_ESCAPE = 27;
public static final int VK_SPACE = 32;
public static final int VK_PAGE_UP = 33;
public static final int VK_PAGE_DOWN = 34;
public static final int VK_END = 35;
public static final int VK_HOME = 36;
public static final int VK_LEFT = 37;
public static final int VK_UP = 38;
public static final int VK_RIGHT = 39;
public static final int VK_DOWN = 40;
public static final int VK_COMMA = 44;
public static final int VK_MINUS = 45;
public static final int VK_PERIOD = 46;
public static final int VK_SLASH = 47;
public static final int VK_0 = 48;
public static final int VK_1 = 49;
public static final int VK_2 = 50;
public static final int VK_3 = 51;
public static final int VK_4 = 52;
public static final int VK_5 = 53;
public static final int VK_6 = 54;
public static final int VK_7 = 55;
public static final int VK_8 = 56;
public static final int VK_9 = 57;
public static final int VK_SEMICOLON = 59;
public static final int VK_EQUALS = 61;
public static final int VK_A = 65;
public static final int VK_B = 66;
public static final int VK_C = 67;
public static final int VK_D = 68;
public static final int VK_E = 69;
public static final int VK_F = 70;
public static final int VK_G = 71;
public static final int VK_H = 72;
public static final int VK_I = 73;
public static final int VK_J = 74;
public static final int VK_K = 75;
public static final int VK_L = 76;
public static final int VK_M = 77;
public static final int VK_N = 78;
public static final int VK_O = 79;
public static final int VK_P = 80;
public static final int VK_Q = 81;
public static final int VK_R = 82;
public static final int VK_S = 83;
public static final int VK_T = 84;
public static final int VK_U = 85;
public static final int VK_V = 86;
public static final int VK_W = 87;
public static final int VK_X = 88;
public static final int VK_Y = 89;
public static final int VK_Z = 90;
public static final int VK_OPEN_BRACKET = 91;
public static final int VK_BACK_SLASH = 92;
public static final int VK_CLOSE_BRACKET = 93;
public static final int VK_NUMPAD0 = 96;
public static final int VK_NUMPAD1 = 97;
public static final int VK_NUMPAD2 = 98;
public static final int VK_NUMPAD3 = 99;
public static final int VK_NUMPAD4 = 100;
public static final int VK_NUMPAD5 = 101;
public static final int VK_NUMPAD6 = 102;
public static final int VK_NUMPAD7 = 103;
public static final int VK_NUMPAD8 = 104;
public static final int VK_NUMPAD9 = 105;
public static final int VK_MULTIPLY = 106;
public static final int VK_ADD = 107;
public static final int VK_SEPARATER = 108;
public static final int VK_SEPARATOR = 108;
public static final int VK_SUBTRACT = 109;
public static final int VK_DECIMAL = 110;
public static final int VK_DIVIDE = 111;
public static final int VK_DELETE = 127;
public static final int VK_NUM_LOCK = 144;
public static final int VK_SCROLL_LOCK = 145;
public static final int VK_F1 = 112;
public static final int VK_F2 = 113;
public static final int VK_F3 = 114;
public static final int VK_F4 = 115;
public static final int VK_F5 = 116;
public static final int VK_F6 = 117;
public static final int VK_F7 = 118;
public static final int VK_F8 = 119;
public static final int VK_F9 = 120;
public static final int VK_F10 = 121;
public static final int VK_F11 = 122;
public static final int VK_F12 = 123;
public static final int VK_F13 = 61440;
public static final int VK_F14 = 61441;
public static final int VK_F15 = 61442;
public static final int VK_F16 = 61443;
public static final int VK_F17 = 61444;
public static final int VK_F18 = 61445;
public static final int VK_F19 = 61446;
public static final int VK_F20 = 61447;
public static final int VK_F21 = 61448;
public static final int VK_F22 = 61449;
public static final int VK_F23 = 61450;
public static final int VK_F24 = 61451;
public static final int VK_PRINTSCREEN = 154;
public static final int VK_INSERT = 155;
public static final int VK_HELP = 156;
public static final int VK_META = 157;
public static final int VK_BACK_QUOTE = 192;
public static final int VK_QUOTE = 222;
public static final int VK_KP_UP = 224;
public static final int VK_KP_DOWN = 225;
public static final int VK_KP_LEFT = 226;
public static final int VK_KP_RIGHT = 227;
public static final int VK_DEAD_GRAVE = 128;
public static final int VK_DEAD_ACUTE = 129;
public static final int VK_DEAD_CIRCUMFLEX = 130;
public static final int VK_DEAD_TILDE = 131;
public static final int VK_DEAD_MACRON = 132;
public static final int VK_DEAD_BREVE = 133;
public static final int VK_DEAD_ABOVEDOT = 134;
public static final int VK_DEAD_DIAERESIS = 135;
public static final int VK_DEAD_ABOVERING = 136;
public static final int VK_DEAD_DOUBLEACUTE = 137;
public static final int VK_DEAD_CARON = 138;
public static final int VK_DEAD_CEDILLA = 139;
public static final int VK_DEAD_OGONEK = 140;
public static final int VK_DEAD_IOTA = 141;
public static final int VK_DEAD_VOICED_SOUND = 142;
public static final int VK_DEAD_SEMIVOICED_SOUND = 143;
public static final int VK_AMPERSAND = 150;
public static final int VK_ASTERISK = 151;
public static final int VK_QUOTEDBL = 152;
public static final int VK_LESS = 153;
public static final int VK_GREATER = 160;
public static final int VK_BRACELEFT = 161;
public static final int VK_BRACERIGHT = 162;
public static final int VK_AT = 512;
public static final int VK_COLON = 513;
public static final int VK_CIRCUMFLEX = 514;
public static final int VK_DOLLAR = 515;
public static final int VK_EURO_SIGN = 516;
public static final int VK_EXCLAMATION_MARK = 517;
public static final int VK_INVERTED_EXCLAMATION_MARK = 518;
public static final int VK_LEFT_PARENTHESIS = 519;
public static final int VK_NUMBER_SIGN = 520;
public static final int VK_PLUS = 521;
public static final int VK_RIGHT_PARENTHESIS = 522;
public static final int VK_UNDERSCORE = 523;
public static final int VK_WINDOWS = 524;
public static final int VK_CONTEXT_MENU = 525;
public static final int VK_FINAL = 24;
public static final int VK_CONVERT = 28;
public static final int VK_NONCONVERT = 29;
public static final int VK_ACCEPT = 30;
public static final int VK_MODECHANGE = 31;
public static final int VK_KANA = 21;
public static final int VK_KANJI = 25;
public static final int VK_ALPHANUMERIC = 240;
public static final int VK_KATAKANA = 241;
public static final int VK_HIRAGANA = 242;
public static final int VK_FULL_WIDTH = 243;
public static final int VK_HALF_WIDTH = 244;
public static final int VK_ROMAN_CHARACTERS = 245;
public static final int VK_ALL_CANDIDATES = 256;
public static final int VK_PREVIOUS_CANDIDATE = 257;
public static final int VK_code
_INPUT = 258;
public static final int VK_JAPANESE_KATAKANA = 259;
public static final int VK_JAPANESE_HIRAGANA = 260;
public static final int VK_JAPANESE_ROMAN = 261;
public static final int VK_KANA_LOCK = 262;
public static final int VK_INPUT_METHOD_ON_OFF = 263;
public static final int VK_CUT = 65489;
public static final int VK_COPY = 65485;
public static final int VK_PASTE = 65487;
public static final int VK_UNDO = 65483;
public static final int VK_AGAIN = 65481;
public static final int VK_FIND = 65488;
public static final int VK_PROPS = 65482;
public static final int VK_STOP = 65480;
public static final int VK_COMPOSE = 65312;
public static final int VK_ALT_GRAPH = 65406;
public static final int VK_BEGIN = 65368;
public static final int VK_UNDEFINED = 0;
public static final char CHAR_UNDEFINED = '\uffff';
public static final int KEY_LOCATION_UNKNOWN = 0;
public static final int KEY_LOCATION_STANDARD = 1;
public static final int KEY_LOCATION_LEFT = 2;
public static final int KEY_LOCATION_RIGHT = 3;
public static final int KEY_LOCATION_NUMPAD = 4;
int keycode;
char keyChar;
int keyLocation;
private transient long rawcode;
private transient long primaryLevelUnicode;
private transient long scancode;
private transient long extendedKeycode;
private static final long serialVersionUID = -2352130953028126954L;
private Component originalSource;
private static native void initIDs();
private KeyEvent(Component cmpnt, int i, long l, int i1, int i2, char c, int
i3, boolean bln) {
// compiled code
}
public KeyEvent(Component cmpnt, int i, long l, int i1, int i2, char c, int i3)
{
// compiled code
}
public KeyEvent(Component cmpnt, int i, long l, int i1, int i2, char c) {
// compiled code
}
@Deprecated
public KeyEvent(Component cmpnt, int i, long l, int i1, int i2) {
// compiled code
}
public int getKeycode
() {
// compiled code
}
public void setKeycode
(int i) {
// compiled code
}
public char getKeyChar() {
// compiled code
}
public void setKeyChar(char c) {
// compiled code
}
@Deprecated
public void setModifiers(int i) {
// compiled code
}
public int getKeyLocation() {
// compiled code
}
public static String getKeyText(int i) {
// compiled code
}
public static String getKeyModifiersText(int i) {
// compiled code
}
public boolean isActionKey() {
// compiled code
}
public String paramString() {
// compiled code
}
public int getExtendedKeycode
() {
// compiled code
}
public static int getExtendedKeycode
ForChar(int i) {
// compiled code
}
private void setNewModifiers() {
// compiled code
}
private void setOldModifiers() {
// compiled code
}
private void readObject(ObjectInputStream stream) throws IOException,
ClassNotFoundException {
// compiled code
}
}
package javax.swing;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.security.AccessControlContext;
import java.util.EventListener;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import javax.swing.event.EventListenerList;
public class Timer implements Serializable {
class DoPostEvent implements Runnable {
DoPostEvent() {
// compiled code
}
public void run() {
// compiled code
}
Timer getTimer() {
// compiled code
}
}
protected EventListenerList listenerList;
private final transient AtomicBoolean notify;
private volatile int initialDelay;
private volatile int delay;
private volatile boolean repeats;
private volatile boolean coalesce;
private final transient Runnable doPostEvent;
private static volatile boolean logTimers;
private final transient Lock lock;
transient TimerQueue.DelayedTimer delayedTimer;
private volatile String actionCommand;
private volatile transient AccessControlContext acc;
public Timer(int i, ActionListener al) {
// compiled code
}
final AccessControlContext getAccessControlContext() {
// compiled code
}
public void addActionListener(ActionListener al) {
// compiled code
}
public void removeActionListener(ActionListener al) {
// compiled code
}
public ActionListener[] getActionListeners() {
// compiled code
}
protected void fireActionPerformed(ActionEvent ae) {
// compiled code
}
public T[] getListeners(Class type) {
// compiled code
}
private TimerQueue timerQueue() {
// compiled code
}
public static void setLogTimers(boolean bln) {
// compiled code
}
public static boolean getLogTimers() {
// compiled code
}
public void setDelay(int i) {
// compiled code
}
public int getDelay() {
// compiled code
}
public void setInitialDelay(int i) {
// compiled code
}
public int getInitialDelay() {
// compiled code
}
public void setRepeats(boolean bln) {
// compiled code
}
public boolean isRepeats() {
// compiled code
}
public void setCoalesce(boolean bln) {
// compiled code
}
public boolean isCoalesce() {
// compiled code
}
public void setActionCommand(String string) {
// compiled code
}
public String getActionCommand() {
// compiled code
}
public void start() {
// compiled code
}
public boolean isRunning() {
// compiled code
}
public void stop() {
// compiled code
}
public void restart() {
// compiled code
}
void cancelEvent() {
// compiled code
}
void post() {
// compiled code
}
Lock getLock() {
// compiled code
}
private void readObject(ObjectInputStream stream) throws
ClassNotFoundException, IOException {
// compiled code
} private Object readResolve() {
// compiled code
}}