Skip to content

Commit

Permalink
Add Junit test for result type
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Velkovski authored and Boris Velkovski committed Feb 27, 2023
1 parent 30d4e9a commit abaef5b
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ bintray {
name = 'none'
}
}
}
}
1 change: 1 addition & 0 deletions polkaj-adapter-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ dependencies {
api 'org.codehaus.groovy:groovy-all:3.0.3'
api 'commons-codec:commons-codec:1.14'
api 'cglib:cglib-nodep:3.3.0'
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
}
1 change: 1 addition & 0 deletions polkaj-api-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ apply from: '../common_java_app.gradle'

dependencies {
api project(":polkaj-json-types")
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
}
1 change: 1 addition & 0 deletions polkaj-api-http/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ compileJava {
dependencies {
api project(":polkaj-json-types")
api project(":polkaj-api-base")
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'

testImplementation 'org.mock-server:mockserver-netty:5.10'
testImplementation project(":polkaj-adapter-tests")
Expand Down
1 change: 1 addition & 0 deletions polkaj-api-ws/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ compileJava {
dependencies {
api project(":polkaj-json-types")
api project(":polkaj-api-base")
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'

testImplementation 'org.java-websocket:Java-WebSocket:1.5.1'
testImplementation project(":polkaj-adapter-tests")
Expand Down
1 change: 1 addition & 0 deletions polkaj-common-types/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ apply from: '../common_java_app.gradle'

dependencies {
api project(":polkaj-ss58")
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
}
1 change: 1 addition & 0 deletions polkaj-json-types/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ dependencies {
api project(":polkaj-ss58")

api 'com.fasterxml.jackson.core:jackson-databind:2.11.0'
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'

}
1 change: 1 addition & 0 deletions polkaj-scale-types/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ apply from: '../common_java_app.gradle'
dependencies {
api project(":polkaj-scale")
api project(":polkaj-common-types")
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testImplementation 'org.testng:testng:7.1.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import io.emeraldpay.polkaj.scale.ScaleCodecReader;
import io.emeraldpay.polkaj.scale.ScaleCodecWriter;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Assertions;

public class EncodeDecodeResult {
public class EncodeDecodeResultTest {

@Test
public void EncodeDecodeResult() {
public void EncodeDecodeResultTest() {
Result<Integer, Integer> dataToEncode = new Result<>(Result.ResultMode.OK, 10, 5);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
try (ScaleCodecWriter writer = new ScaleCodecWriter(buf)) {
Expand All @@ -24,9 +24,9 @@ public void EncodeDecodeResult() {
ResultReader<Integer, Integer> resultReader = new ResultReader<>();
Result<Integer, Integer> result = resultReader.readResult(reader, ScaleCodecReader::readCompactInt, ScaleCodecReader::readCompactInt);

assertEquals(dataToEncode.mode, result.mode);
assertEquals(dataToEncode.getOkValue(), result.getOkValue());
assertEquals(null, result.getErrorValue());
Assertions.assertEquals(dataToEncode.mode, result.mode);
Assertions.assertEquals(dataToEncode.getOkValue(), result.getOkValue());
Assertions.assertEquals(null, result.getErrorValue());
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
1 change: 1 addition & 0 deletions polkaj-scale/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ apply from: '../common_java_app.gradle'

dependencies {
api project(":polkaj-common-types")
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
}
1 change: 1 addition & 0 deletions polkaj-schnorrkel/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply from: '../common_java_app.gradle'

dependencies {
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
}

test {
Expand Down
1 change: 1 addition & 0 deletions polkaj-ss58/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ apply from: '../common_java_app.gradle'

dependencies {
api 'com.github.multiformats:java-multibase:v1.0.0'
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
implementation 'org.bouncycastle:bcprov-jdk15on:1.65'
}
1 change: 1 addition & 0 deletions polkaj-tx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ dependencies {
// for xxHash
api 'net.openhft:zero-allocation-hashing:0.11'
api 'org.bouncycastle:bcprov-jdk15on:1.65'
api 'org.junit.jupiter:junit-jupiter-api:5.9.2'
}

0 comments on commit abaef5b

Please sign in to comment.