/home/wpollock1/public_html/restricted/Java1/TextKit Model Solution/TextKitMain.java
import utils.TextKit;
/* TextKitMain.java - a test driver for utils.TextKit.
*
* To generate the Javadocs, create a docs directory, then run
* the following command (using a single line only!):
* javadoc -d docs -author -version -noqualifier java.*
* -link https://docs.oracle.com/javase/8/docs/api/ TextKitMain.java utils
* (First create the file "utils\package-info.java" if you want to add
* a description of the package itself to the generated docs.)
*
* @author ©2004-2015 by Wayne Pollock, Tampa Florida USA
* @version 2.3
*/
public class TextKitMain {
/** This prevents one from creating objects of this class.
*/
private TextKitMain () {}
/** Main is only used to test the methods in utils.TextKit. This is
* an "ad-hoc" method of testing. A production quality class would
* use assertions and/or JUnit testing, but for now this is sufficient.
*
* @param args unused
*/
public static void main ( String [] args )
{
// Testing TextKit.lineOfStars:
System.out.println( "\tCalling TextKit.lineOfStars(5):" );
System.out.println( TextKit.lineOfStars(5) );
System.out.println( "Five stars should be showing above" );
System.out.println( "\n\tCalling lineOfStars(-1), " +
"which should throw an exception:" );
try {
TextKit.lineOfStars( -1 );
System.out.println( "If you see this, then lineOfStars didn't" +
"throw an exception the way it should have!" );
}
catch ( Exception e ) { System.out.println( e ); }
// Testing TextKit.pad:
System.out.println( "\n\tCalling TextKit.pad( 17, 4 ):" );
System.out.println( "\n*" + TextKit.pad(17, 4) + "*" );
System.out.println( "* 17* (two leading spaces) should be showing above" );
// Testing TextKit.numberToOrdinal:
System.out.println( "\n\tCalling TextKit.numberToOrdinal( 17 ):" );
System.out.println( TextKit.numberToOrdinal( 17 ) );
System.out.println( "\"17th\" should be showing above" );
System.out.println( "\n\tCalling TextKit.numberToOrdinal( 101 ):" );
System.out.println( TextKit.numberToOrdinal( 101 ) );
System.out.println( "\"101st\" should be showing above" );
}
}