Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *              C E D A R
  *          S O L U T I O N S       "Software done right."
  *           S O F T W A R E
  *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  * Copyright (c) 2013 Kenneth J. Pronovici.
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the Apache License, Version 2.0.
 * See LICENSE for more information about the licensing terms.
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * Author   : Kenneth J. Pronovici <pronovic@ieee.org>
 * Language : Java 6
 * Project  : Common Java Functionality
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package com.cedarsolutions.junit.gwt;
import  junitx.util.DirectorySuiteBuilder;
import  junitx.util.SimpleTestFilter;
Suite builder for GWT test cases.

Author(s):
Kenneth J. Pronovici <pronovic@ieee.org>
@SuppressWarnings("rawtypes")
public class GwtTestSuiteBuilder extends DirectorySuiteBuilder {

    
Create a suite builder configured with the proper type of filter.
    public GwtTestSuiteBuilder() {
        this.setFilter(new SimpleTestFilter() {
            @Override
            public boolean include(Class clazz) {
                return GWTTestCase.class.isAssignableFrom(clazz);
            }
        });
    }

    
Generate a suite.

Parameters:
suiteName Name of the suite
directories Directories that should be scanned for classes
Returns:
JUnit test suite generated from the indicated directories
Throws:
Exception If there is a problem generating the suite.
    public static Test generateSuite(String suiteNameString ... directoriesthrows Exception {
        TestSuite suite = new TestSuite(suiteName);
        GwtTestSuiteBuilder builder = new GwtTestSuiteBuilder();
        for (String directoryName : directories) {
            File directory = new File(directoryName);
            List classnames = builder.browse(directory);
            builder.merge(classnamessuite);
        }
        return suite;
    }
New to GrepCode? Check out our FAQ X