Class TSHProcessor

java.lang.Object
org.fhirfrog.frog.shorthand.TSHProcessor

public class TSHProcessor extends Object
Main entry point for parsing TSH files and compiling to FHIR TestScript resources.

Example usage:


 TSHProcessor processor = new TSHProcessor();
 
 // Parse from file
 TestScript testScript = processor.parse(Path.of("test.tsh"));
 
 // Parse from string
 String tsh = "TestScript: MyTest\nTitle: \"My Test\"\n...";
 TestScript testScript = processor.parse(tsh);
 
 // Serialize to JSON
 String json = processor.toJson(testScript);
 
 // Serialize to XML
 String xml = processor.toXml(testScript);
 
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.hl7.fhir.r4.model.TestScript
    parse(String tshContent)
    Parse TSH string and compile to TestScript.
    org.hl7.fhir.r4.model.TestScript
    parse(Path tshFile)
    Parse TSH file and compile to TestScript.
    toJson(org.hl7.fhir.r4.model.TestScript testScript)
    Serialize TestScript to JSON.
    toXml(org.hl7.fhir.r4.model.TestScript testScript)
    Serialize TestScript to XML.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TSHProcessor

      public TSHProcessor()
  • Method Details

    • parse

      public org.hl7.fhir.r4.model.TestScript parse(Path tshFile) throws IOException
      Parse TSH file and compile to TestScript.
      Parameters:
      tshFile - path to .tsh file
      Returns:
      compiled TestScript resource
      Throws:
      IOException - if file cannot be read
    • parse

      public org.hl7.fhir.r4.model.TestScript parse(String tshContent)
      Parse TSH string and compile to TestScript.
      Parameters:
      tshContent - TSH source code
      Returns:
      compiled TestScript resource
    • toJson

      public String toJson(org.hl7.fhir.r4.model.TestScript testScript)
      Serialize TestScript to JSON.
      Parameters:
      testScript - TestScript resource to serialize
      Returns:
      pretty-printed JSON string
    • toXml

      public String toXml(org.hl7.fhir.r4.model.TestScript testScript)
      Serialize TestScript to XML.
      Parameters:
      testScript - TestScript resource to serialize
      Returns:
      pretty-printed XML string