Add temp object creation test in read only test
@@ -50,6 +50,12 @@ public class ReadOnlyTest extends SimpleTest {
sVal = "string2";
return 0;
}
+
+ @External(readonly=true)
+ public int createTempObject() {
+ Object obj = new Object();
+ return obj.hashCode();
+ }
}
public static class ProxyScore {
@@ -78,6 +84,11 @@ public class ReadOnlyTest extends SimpleTest {
public int changeSVal() {
return ((BigInteger) Context.call(real, "changeSVal")).intValue();
}
+
+ @External
+ public int createTempObject() {
+ return ((BigInteger) Context.call(real, "createTempObject")).intValue();
+ }
}
private Contract score;
@@ -117,6 +128,12 @@ public class ReadOnlyTest extends SimpleTest {
() -> score.query("changeSVal"));
assertEquals(Status.AccessDenied, e.getResult().getStatus());
}
+
+ @Test
+ void creatingTempObjectSucceeds() {
+ score.invoke("createTempObject");
+ score.query("createTempObject");
+ }
}
@Nested
@@ -154,5 +171,10 @@ public class ReadOnlyTest extends SimpleTest {
() -> score.invoke("changeSVal"));
assertEquals(Status.UnknownFailure, e.getResult().getStatus());
}
+
+ @Test
+ void creatingTempObjectSucceeds() {
+ score.invoke("createTempObject");
+ }
}
}
