comtest
Class ComTestCpp.ComTestScanner

java.lang.Object
  extended by comtest.ComTestCpp.ComTestScanner
Enclosing class:
ComTestCpp

public static class ComTestCpp.ComTestScanner
extends Object

Class to do the file scanning and output for test class

Author:
vesal

Nested Class Summary
 class ComTestCpp.ComTestScanner.CommentCodeHandler
          Handles to ComTest-comment and returns the position of last handled line.
 
Method Summary
protected  void addImports()
          Add imports-list to outlines Also if doStaticImport is true then add also static import
 void checkOptionLine(String line, boolean all)
          Check the selected line by ComTest options
 ComTestCpp.ComTestScanner.CommentCodeHandler createCommentCodeHandler()
          This factory method is just for testing purposes
 boolean findNames(String fileName)
          Find outName and className from fileName
 Strings getOutlines()
          This method is just for testing purposes to return current outlines.
 String scan(String fileName)
          Scan the contents and make a test class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOutlines

public Strings getOutlines()
This method is just for testing purposes to return current outlines.

Returns:
current outlines.

createCommentCodeHandler

public ComTestCpp.ComTestScanner.CommentCodeHandler createCommentCodeHandler()
This factory method is just for testing purposes

Returns:
a new handler

findNames

public boolean findNames(String fileName)
                  throws IOException
Find outName and className from fileName

Parameters:
fileName - name to look;
Returns:
true
Throws:
IOException - when problems with the file

checkOptionLine

public void checkOptionLine(String line,
                            boolean all)
Check the selected line by ComTest options

Parameters:
line - what to check
all - to check all or only part
Example:
  TestHelpper t = new TestHelpper();
  t.scanner.checkOptionLine("    * #import imp1; // ", true);
  t.imports.get(0) === "import imp1;";
  t.scanner.checkOptionLine("    *  #import imp2; // ", true);
  t.imports.size() === 1; 
  t.scanner.checkOptionLine("    // #import imp2; // ", true);
  t.imports.get(1) === "import imp2;";
  t.scanner.checkOptionLine("    //#import imp3; // ", true);
  t.imports.get(2) === "import imp3;";
  t.scanner.checkOptionLine("    *#import imp4; // ", true);
  t.imports.get(3) === "import imp4;";
  t.scanner.checkOptionLine("    //  #import imp5; // ", true);
  t.imports.size() === 4; 
 

addImports

protected void addImports()
Add imports-list to outlines Also if doStaticImport is true then add also static import


scan

public String scan(String fileName)
Scan the contents and make a test class

Parameters:
fileName - filename read to contents
Returns:
outName if ok, null if something wrong