01: package org.uispec4j;
02:
03: import javax.swing.*;
04:
05: public class PasswordFieldTest extends UIComponentTestCase {
06:
07: private PasswordField passwordField;
08: private JPasswordField jPasswordField;
09:
10: protected void setUp() throws Exception {
11: jPasswordField = new JPasswordField();
12: passwordField = new PasswordField(jPasswordField);
13: }
14:
15: public void testGetComponentTypeName() throws Exception {
16: assertEquals("passwordField", passwordField
17: .getDescriptionTypeName());
18: }
19:
20: public void testGetDescription() throws Exception {
21: assertEquals("<passwordField/>", passwordField.getDescription());
22: }
23:
24: public void testFactory() throws Exception {
25: checkFactory(new JPasswordField(), PasswordField.class);
26: }
27:
28: protected UIComponent createComponent() {
29: return passwordField;
30: }
31:
32: public void testPasswordEquals() throws Exception {
33: jPasswordField.setText("pwd");
34: assertTrue(passwordField.passwordEquals("pwd"));
35: assertFalse(passwordField.passwordEquals("unknown"));
36: }
37:
38: public void testEnterPassword() throws Exception {
39: passwordField.setPassword("pwd");
40: assertEquals("pwd", new String(jPasswordField.getPassword()));
41: }
42: }
|