Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
Please note: this document is currently under revision.
The information herein contained, while still valid, does not reflect the latest state of the described technology.
The Somusar/SoProTech[tm] Booklet Series
Volume VIII

"somusar/tjpp: User's Guide"

Printer friendly


Contents
1. Introduction
2. Overview
3. Installing tjpp[tm]
4. SimpleClass Example
5. ComplexClass Example
6. Running a Test
6.1 Code Examples
7. Exercise: Improving Multitier Code Consistency
8. Contacting Somusar
9. Further Reading
Appendix A - tjpp Directives and Macros

Chapter 6 - Running a Test

A plain Java file, "TestJavapp.java", contains a test program for "SimpleClass.java" and "ComplexClass.java". Running the test produces the diagnostic System.err messages listed and commented in "stderr.txt".

6.1 - Code Examples        top

Code Example 8 - tjpp test class
Line 16 causes an assertion to fail and a trace message to be printed out.
Each line between 17 and 20 produces one trace message.
Source code - File "input_code/TestJavapp.java"
    1      package com.somusar.tjpptest;
    2      
    3      import com.somusar.tjpptest.ComplexClass;
    4      import com.somusar.tjpptest.subpackage.SimpleClass;
    5      
    6      public class TestJavapp {
    7      
    8         public static void main(String[] args) {
    9      
   10            SimpleClass  s = new SimpleClass();
   11            ComplexClass c = new ComplexClass();
   12            double  d;
   13            boolean b;
   14            Object  o;
   15      
   16            b = c.aFunction(20000, ComplexClass.RED);
   17            b = c.aFunction(10000, ComplexClass.GREEN);
   18            d = c.aFunction(12);
   19            s.setAThing(c);
   20            o = s.getAThing();
   21         }
   22      }
	       

Code Example 9 - Diagnostic messages: "stderr.txt"
Lines 1-7 result from line 16 of TestJavapp.java.
Lines 8-10 result from line 17 of the same file.
Lines 11-12 result from line 18.
Lines 13-14 result from line 19.
Lines 15-16 result from line 20.
Source code - File "generated_code/stderr.txt"
    1      [T] File ComplexClass.java, line 145 (src: ComplexClass.tj, 53)
    2      [T]    [aRange = '20000']
    3      [T]    [aColor = '0']
    4      [A] -------------
    5      [A] --- File ComplexClass.java, line 149 (src: ComplexClass.tj, 54)
    6      [A] --- Assertion 'aRange >= 0 && aRange < 20000' failed
    7      [A] -------------
    8      [T] File ComplexClass.java, line 145 (src: ComplexClass.tj, 53)
    9      [T]    [aRange = '10000']
   10      [T]    [aColor = '1']
   11      [T] File ComplexClass.java, line 168 (src: ComplexClass.tj, 70)
   12      [T]    [d = '1.2']
   13      [T] File subpackage/SimpleClass.java, line 64 (src: subpackage/SimpleClass.tj, 56)
   14      [T]    [aThing = '[ aBool = 'false' aColor = '0' aFloat = '0.0' aRange = '0' aString = 'null' aTime = 'null' aUniqueId = '0' anInt = '0' anotherColor = '0' aThing = 'null' anIntArray = 'null' ]']
   15      [T] File subpackage/SimpleClass.java, line 46 (src: subpackage/SimpleClass.tj, 39)
   16      [T]    [aThing = '[ aBool = 'false' aColor = '0' aFloat = '0.0' aRange = '0' aString = 'null' aTime = 'null' aUniqueId = '0' anInt = '0' anotherColor = '0' aThing = 'null' anIntArray = 'null' ]']
	       

[Previous chapter]    [Next chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / tjpp_manual  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster