Skip to content

Commit 8ae09b9

Browse files
author
Mark
committed
Result in TransactionResultEntity can only be JsonObject, Number, String
or boolean
1 parent 9c3324b commit 8ae09b9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/main/java/com/arangodb/entity/TransactionResultEntity.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.arangodb.entity;
1818

19+
import com.google.gson.JsonObject;
20+
1921
/**
2022
* @author tamtam180 - kirscheless at gmail.com
2123
* @author gschwab
@@ -28,9 +30,8 @@ public class TransactionResultEntity extends BaseEntity {
2830
*/
2931
private Object result;
3032

31-
@SuppressWarnings("unchecked")
32-
public <T> T getResult() {
33-
return (T) this.result;
33+
public JsonObject getResultAsJsonObject() {
34+
return (JsonObject) result;
3435
}
3536

3637
public long getResultAsLong() {
@@ -58,6 +59,14 @@ public int getResultAsInt() {
5859
return number.intValue();
5960
}
6061

62+
public boolean getResultAsBoolean() {
63+
return (Boolean) result;
64+
}
65+
66+
public String getResultAsString() {
67+
return (String) result;
68+
}
69+
6170
public void setResult(Object result) {
6271
this.result = result;
6372
}

src/test/java/com/arangodb/ArangoDriverTransactionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ public void test_Transaction() throws ArangoException {
122122
transaction.setParams(true);
123123
result = driver.executeTransaction(transaction);
124124

125-
assertThat(result.<Boolean> getResult(), is(true));
125+
assertThat(result.getResultAsBoolean(), is(true));
126126
assertThat(result.getStatusCode(), is(200));
127127
assertThat(result.getCode(), is(200));
128128
assertThat(result.isError(), is(false));
129129

130130
transaction.setParams("Hans");
131131
result = driver.executeTransaction(transaction);
132132

133-
assertThat(result.<String> getResult(), is("Hans"));
133+
assertThat(result.getResultAsString(), is("Hans"));
134134
assertThat(result.getStatusCode(), is(200));
135135
assertThat(result.getCode(), is(200));
136136
assertThat(result.isError(), is(false));

0 commit comments

Comments
 (0)