001 package com.croftsoft.core.lang; 002 003 /********************************************************************* 004 * A semantic interface indicating the class has a static test method. 005 * 006 * <p align="justify"> 007 * When a class implements this semantic marker interface, it indicates 008 * that it defines a static test method with the following signature: 009 * <code> 010 * <pre>public static boolean test ( String [ ] args )</pre> 011 * </code> 012 * </p> 013 * 014 * <p align="justify"> 015 * This method performs one or more unit self-tests for the class that 016 * it is defined in, returning true if the tests were successful and 017 * false if otherwise. It may perform white-box or black-box testing. 018 * </p> 019 * 020 * <p> 021 * When provided with a null or empty String array argument, it 022 * performs its default test. 023 * The default test must not have persistent side-effects such as 024 * creating files or modifying static variables nor attempt operations 025 * that have nuisance effects. 026 * The default test may write to the standard output and the standard 027 * error to facilitate debugging. 028 * If provided with a non-empty String array argument, it may run 029 * tests that have persistent side-effects. 030 * </p> 031 * 032 * <p align="justify"> 033 * The test method can be called by the class main method, passing the 034 * command-line arguments as the test method arguments. This makes it 035 * easy to test the class from the command-line during development. 036 * Note that if no command-line arguments are specified, the argument 037 * is an empty String array and the default test will be run. 038 * <code> 039 * <pre> 040 * public static void main ( String [ ] args ) 041 * { 042 * System.out.println ( test ( args ) ); 043 * } 044 * </pre> 045 * </code> 046 * </p> 047 * 048 * <p align="justify"> 049 * Automated testing of all the classes in a library can be performed 050 * using reflection to test if a class implements the interface 051 * Testable. If the class does, its test method can be called using 052 * reflection and the boolean result reported along with anything 053 * written to the standard output and standard error. If a class 054 * contains a test method that conforms to the required signature but 055 * it does not implement the semantic interface Testable, the test 056 * method should not be executed as the similarity may be coincidental. 057 * </p> 058 * 059 * @version 060 * 2003-03-12 061 * @since 062 * 2003-03-12 063 * @author 064 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 065 *********************************************************************/ 066 067 public interface Testable { }