Package com.iconloop.score.test
Annotation Type GenerateTScore
-
@Target({TYPE,METHOD}) @Retention(SOURCE) @Repeatable(GenerateTScores.class) public @interface GenerateTScore
@GenerateTScore
is used to generate a wrapper SCORE class for testing. If you deploy the generated SCORE class using the unittest framework, the following additional features are available.- Log a proper event on calling the method tagged with
EventLog
- Check if a method is properly tagged with
External
andPayable
- Check if a parameter is properly tagged with
Optional
For example, the following is your contract implementation.
public class MyContract { public MyContract() { } @External public void setValue(String value) { ... } }
Then you may deploy the contract with the generated SCORE class in the unittest. Note that the default suffix for the generated class is TS.public class MyContractTest { @Test @GenerateTScore(MyContract.class) public void testSetValue() { var score = sm.deploy(MyContractTS.class); } }
Of course, you may use the class as is, without any additional features. - Log a proper event on calling the method tagged with