Clover coverage report - clover
Coverage timestamp: Sat Oct 8 2005 22:54:17 EDT
file stats: LOC: 83   Methods: 7
NCLOC: 67   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CallEditorTest.java 100% 95.5% 85.7% 93.5%
coverage coverage
 1   
 package abbot.editor.editors;
 2   
 
 3   
 import java.awt.Component;
 4   
 import javax.swing.*;
 5   
 
 6   
 import junit.extensions.abbot.*;
 7   
 import abbot.script.*;
 8   
 import abbot.tester.JTextComponentTester;
 9   
 import abbot.finder.matchers.*;
 10   
 import abbot.editor.widgets.*;
 11   
 
 12   
 /** Verify CallEditor operation. */
 13   
 
 14   
 public class CallEditorTest
 15   
     extends ComponentTestFixture implements XMLConstants {
 16   
 
 17   
     private Call call;
 18   
     private CallEditor editor;
 19   
     private JTextComponentTester tester;
 20   
 
 21  2
     protected void setUp() {
 22  2
         call = new Call(getResolver(), null,
 23   
                         "java.lang.Object", "hashCode", null);
 24  2
         editor = new CallEditor(call);
 25  2
         tester = new JTextComponentTester();
 26   
     }
 27   
 
 28  1
     public void testMethodList() throws Throwable {
 29  1
         showFrame(editor);
 30  1
         JComboBox cb = getMethodComboBox(editor);
 31  1
         assertEquals("Wrong method selected",
 32   
                      cb.getSelectedItem(), "hashCode");
 33  1
         String[] expected = {
 34   
             "equals",
 35   
             "getClass",
 36   
             "hashCode",
 37   
             "notify",
 38   
             "notifyAll",
 39   
             "toString",
 40   
             "wait",
 41   
         };
 42  1
         assertEquals("Wrong number of methods",
 43   
                      expected.length, cb.getItemCount());
 44  1
         for (int i=0;i < cb.getItemCount();i++) {
 45  7
             assertEquals("Wrong method in combo list",
 46   
                          expected[i], cb.getItemAt(i));
 47   
         }
 48   
     }
 49   
 
 50  1
     public void testMethodListUpdateOnClassChange() throws Exception {
 51  1
         showFrame(editor);
 52  1
         JTextField tf = getTargetClassBox(editor);
 53  1
         JComboBox cb = getMethodComboBox(editor);
 54  1
         int count = cb.getItemCount();
 55  1
         String TEXT = "abbot.tester.ComponentTester";
 56  1
         tester.actionEnterText(tf, TEXT);
 57  1
         assertEquals("Text entered improperly", TEXT, tf.getText());
 58  1
         assertTrue("Method list was not updated", count != cb.getItemCount());
 59   
     }
 60   
 
 61  1
     protected JTextField getTargetClassBox(CallEditor editor)
 62   
         throws Exception
 63   
     {
 64  1
         return (JTextField)getFinder().
 65   
             find(editor, new NameMatcher(TAG_CLASS));
 66   
     }
 67   
 
 68  2
     protected JComboBox getMethodComboBox(CallEditor editor) throws Exception {
 69  2
         return (JComboBox)getFinder().
 70   
             find(editor, new NameMatcher(TAG_METHOD));
 71   
     }
 72   
 
 73   
     /** Construct a test case with the given name. */
 74  2
     public CallEditorTest(String name) {
 75  2
         super(name);
 76   
     }
 77   
 
 78   
     /** Run the default test suite. */
 79  0
     public static void main(String[] args) {
 80  0
         RepeatHelper.runTests(args, CallEditorTest.class);
 81   
     }
 82   
 }
 83