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:

@import java.io.IOException;@

@public class Operations {@

@public long returnFive() {@

@return 5;@

@}@

@public long returnSum(long i, double d) {@

@return (long) (i + d);@

@}@

@public void throwUncheckedException() {@

@throw new RuntimeException("Runtime Exception in executed code");@

@}@

@public void throwCheckedException() throws IOException {@

@throw new IOException("IOException in executed code");@

@}@

@}@



Right click on Staircase.sct.

In the context menu, select *Run as... → Run Configurations*.

In the Staircase run configuration, enter Operations as operation class.

Click *Apply*.

Click *Close*.



Open Staircase.sct and add the following to the internal scope:

@operation returnFive():integer@

@operation returnSum(param1 : integer, param2 : real ):integer@

@operation throwUncheckedException(): void@

@operation throwCheckedException():void@

@operation unsupportedMethod():void@

| There are no error markers in the project. There are five warnings "Internal declaration is not used in statechart". | %{color:red}open% | | 11.2 | Calling a valid operation during statechat execution | Open Staircase.sct.

Edit transition from LightOn to LightOff and change the expression to "@after returnFive() s@".

Run simulation.

Click keypress to transition to state LightOn.

| After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% | | 11.3 | CheckedException during execution | Open Staircase.sct.

Edit state LightOn.

Change expression to "@entry / throwCheckedException()@".

Run simulation.

Click keypress to transition to state LightOn.

| 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.4 | UncheckedException during execution | Open Staircase.sct.

Edit state LightOn.

Change expression to "@entry / throwUncheckedException()@".

Run simulation.

Click keypress to transition to state LightOn.

| 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.5 | Calling invalid operation | Open Staircase.sct.

Edit transition from LightOn to LightOff and change the expression to "@after returnFive s@", i.e. without the brackets.

Run simulation.

Click keypress to transition to state LightOn.

| After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% | | 11.6 | Calling another valid operation during statechat execution | Open Staircase.sct.

Edit transition from LightOn to LightOff and change the expression to "@after returnSum(1, 4.1) s@".

Run simulation.

Click keypress to transition to state LightOn.

| After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% |