h1(#Test2). Yakindu SCT Testcase 11 - Operations

|_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status|
| 11.1 | Preparations | In the src folder, create a new Java source file Operations.java with following contents:<p><pre>@import java.io.IOException;@<p><br>	@public class Operations {@<p>	@public long returnFive() {@<br>	@return 5;@<br>	@}@<p>	@public long returnPlusFive(long i) {@<br>	@return i+returnFive();@<br>	@}@<p>	@public long returnSum(long i, double d) {@<br>	@return (long) (i + d);@<br>	@}@<p>	@public void throwUncheckedException() {@<br>	@throw new RuntimeException("Runtime Exception in executed code");@<br>	@}@<p>	@public void throwCheckedException() throws IOException {@<br>	@throw new IOException("IOException in executed code");@<br>	@}@<br>@}@<p>Right click on Staircase.sct.</p><p>In the context menu, select *Run as... → Run Configurations*.</p><p>In the Staircase run configuration, enter Operations as operation class.</p><p>Click *Apply*.</p><p>Click *Close*.</p><br></br><p>Open Staircase.sct and add the following to the internal scope:</p><p>	@operation returnFive():integer@<br>	@operation returnSum(param1 : integer, param2 : real ):integer@<br>	@operation returnPlusFive(param1 : integer) : integer@<br>	@operation throwUncheckedException(): void@<br>	@operation throwCheckedException():void@<br>	@operation unsupportedMethod():void@ </pre>| There are no error markers in the project. There are five warnings "Internal declaration is not used in statechart". | %{color:red}open% |
| 11.2 | Check operation proposals | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and write "@/@".</p><p>Press CTRL + SPACE</p> <p>Choose & insert proposals</p><pre><p>	"@returnFive():integer@"<p>	"@returnPlusFive(param1:integer):integer@"<p>	"@returnSum(param1 : integer, param2 : real ):integer@"</p>| <p>Choosing the proposals result in the following insertions</p><p>	"@returnFive@"</p><p>	"@returnPlusFive()@" AND cursor between brackets</p><p>	"@returnSum()@" AND cursor between brackets</p></pre> | %{color:red}open% |
| 11.3 | Calling a valid operation during statechat execution | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to <p>"@after returnFive() s@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% |
| 11.4 | CheckedException during execution | Open Staircase.sct.<p>Edit state LightOn.</p><p>Change expression to <p>"@entry / throwCheckedException()@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | A popup method informs the user that a IOException has occurred in the executed code and offers to relaunch or terminate the simulation. | %{color:red}open% |
| 11.5 | UncheckedException during execution | Open Staircase.sct.<p>Edit state LightOn.</p><p>Change expression to <p>"@entry / throwUncheckedException()@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | A popup method informs the user that a RuntimeException has occurred in the executed code and offers to relaunch or terminate the simulation. | %{color:red}open% |
| 11.6 | Calling invalid operation | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to <p>"@after returnFive s@", i.e. without the brackets.</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% |
| 11.7 | Calling another valid operation during statechat execution | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to <p>"@after returnSum(1, 4.1) s@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% |


