alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

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-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */


/*
 * TestEditorWizard.java
 * NetBeans JUnit based test
 *
 * Created on April 18, 2002, 4:11 PM
 */
package org.netbeans.test.gui.editor;

import junit.framework.*;
import org.netbeans.junit.*;

import java.io.File;

import org.netbeans.modules.web.core.syntax.*;
import org.netbeans.editor.ext.*;
import org.netbeans.editor.ext.java.*;

import java.awt.event.KeyEvent;
import java.awt.Container;
import java.awt.Component;

import javax.swing.AbstractButton;
import javax.swing.JList;
import javax.swing.ListModel;
import javax.swing.JScrollPane;
import javax.swing.JComponent;
import javax.swing.JViewport;

import org.netbeans.jellytools.*;
import org.netbeans.jellytools.actions.*;
import org.netbeans.jellytools.nodes.*;


import org.netbeans.jemmy.operators.JEditorPaneOperator;



public class TestEditorAbbr extends JellyTestCase {

    private static String workDir = null;
    private static ExplorerOperator explorer = null;
    private static EditorOperator editor = null;
    private static JEditorPaneOperator txtOper = null;
    private static int line = 1;


    public TestEditorAbbr(String testName) {
        super(testName);
    }

    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }

    public static Test suite() {
        workDir = System.getProperty("scratch.dir").replace('/',File.separatorChar); 
        explorer = ExplorerOperator.invoke();
        explorer.selectPageFilesystems();
        (new Thread () {
            public void run() {
                try {
                NbDialogOperator nbDialog = new NbDialogOperator("Mount Web Module");
                nbDialog.ok();
                } catch (Exception e) {
                }
            }
        }).run();
        TestSuite suite = new NbTestSuite(TestEditorAbbr.class); 
        /* TestSuite suite = new NbTestSuite();
        suite.addTest(new TestEditorAbbr("test"));
        */
        System.out.println("Test started");
        return suite;
    }
    //TEST 1
    public void testAG() {
        prepareFile("Abbr");
        txtOper.typeKey('a');
        txtOper.typeKey('g');
        txtOper.typeKey(' ');
        if(!checkResults("application.getValue")) {
            failure("Abbreviation for 'ag' don't work");
        }
        closeEditor();
    }
    //TEST2 
    public void testAP() {
        prepareFile("Abbr");
        txtOper.typeKey('a');
        txtOper.typeKey('p');
        txtOper.typeKey(' ');
        if(!checkResults("application.putValue")) {
            failure("Abbreviation for 'ap' don't work");
        }
        closeEditor();
    }
    //TEST3 
    public void testAR() {
        prepareFile("Abbr");
        txtOper.typeKey('a');
        txtOper.typeKey('r');
        txtOper.typeKey(' ');
        if(!checkResults("application.removeValue")) {
            failure("Abbreviation for 'ar' don't work");
        }
        closeEditor();
    }
    //TEST4 
    public void testCFGI() {
        prepareFile("Abbr");
        txtOper.typeKey('c');
        txtOper.typeKey('f');
        txtOper.typeKey('g');
        txtOper.typeKey('i');
        txtOper.typeKey(' ');
        if(!checkResults("config.getInit")) {
            failure("Abbreviation for 'cfgi' don't work");
        }
        closeEditor();
    }
    //TEST5 
    public void testJG() {
        prepareFile("Abbr");
        txtOper.typeKey('j');
        txtOper.typeKey('g');
        txtOper.typeKey(' ');
        if(!checkResults("
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

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.