Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
update unit test for 98 99 100 164 to 168 170 to 175 180 to 184 186 1…
Browse files Browse the repository at this point in the history
…87 190 to 205
  • Loading branch information
Sotatek-TruongNguyen5 committed Jun 29, 2023
1 parent 218d11e commit addc6ae
Show file tree
Hide file tree
Showing 36 changed files with 139 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")

public class DebugDumpBlockTest {
Expand All @@ -23,5 +23,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugDumpBlockResponse response = w3.debugDumpBlock("0x80").send();
assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(String.class, response.getResult().getRoot());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugDumpStateTrieTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.TEST_URL));
Expand All @@ -22,5 +22,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugDumpStateTrieResponse response = w3.debugDumpStateTrie("0x80").send();
assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(String.class, response.getResult().getRoot());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import org.web3j.protocol.klaytn.Web3j;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.ArrayList;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugGetBadBlocksTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.SERVER_URL));
Expand All @@ -22,5 +23,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugGetBadBlocksResponse response = w3.debugGetBadBlocks().send();
assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(ArrayList.class, response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugGetBlockRlpTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.TEST_URL));
Expand All @@ -22,5 +22,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugGetBlockRlpResponse response = w3.debugGetBlockRlp("earliest").send();
assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(String.class, response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import org.web3j.protocol.klaytn.Web3j;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.ArrayList;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugGetModifiedAccountsByHashTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.TEST_URL));
Expand All @@ -24,5 +25,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugGetModifiedAccountsByHashResponse response = w3.debugGetModifiedAccountsByHash(startBlockHash, endBlockHash).send();
assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(ArrayList.class, response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import org.web3j.protocol.klaytn.Web3j;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.ArrayList;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugGetModifiedAccountsByNumberTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.TEST_URL));
Expand All @@ -24,5 +25,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugGetModifiedAccountsByNumberResponse response = w3.debugGetModifiedAccountsByNumber(startBlockNum, endBlockNum).send();
assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(ArrayList.class, response.getResult());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package opensdk.sdk.apis.klaytnDebug.blockchainInspection;
package opensdk.sdk.apis.debug.blockchainInspection;

import opensdk.sdk.apis.constant.UrlConstants;
import org.web3j.protocol.klaytn.core.method.response.DebugPrintBlockResponse;
Expand All @@ -8,10 +8,10 @@

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugPrintBlockTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.SERVER_URL));
Expand All @@ -22,5 +22,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugPrintBlockResponse response = w3.debugPrintBlock(65120).send();
assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(String.class, response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugSetHeadResponse response = w3.debugSetHead("0x100").send();
assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package opensdk.sdk.apis.debug.blockchainInspection;

import opensdk.sdk.apis.constant.UrlConstants;
import org.junit.jupiter.api.Assertions;
import org.web3j.protocol.klaytn.core.method.response.DebugStartContractWarmUpResponse;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.web3j.protocol.klaytn.Web3j;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.web3j.protocol.http.HttpService;
@DisplayName("Debug RPC Test")
public class DebugStartContractWarmUpTest {
Expand All @@ -19,6 +23,11 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
String address = "0xfD1d63a152f7A7Ef14bd157C1c73c5bC3239EA5D";

DebugStartContractWarmUpResponse response = w3.debugStartContractWarmUp(address).send();
response.getResult();

if(response == null) {

This comment has been minimized.

Copy link
@Sotatek-HuyLe3

Sotatek-HuyLe3 Jun 29, 2023

Contributor

check lại cho anh đoạn này nhé

assertNull(response.getResult());
} else {
assertNotNull(response.getError());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ public class DebugStopWarmUpTest {
@DisplayName("RPC debug_stopWarmUp")
void whenRequestValid_ThenCall200ResponseReturns() throws IOException {
DebugStopWarmUpResponse response = w3.debugStopWarmUp().send();
assertNotNull(response);
assertNull(response.getError());

if(response == null) {

This comment has been minimized.

Copy link
@Sotatek-HuyLe3

Sotatek-HuyLe3 Jun 29, 2023

Contributor

tương tự như trên

assertNull(response.getResult());
} else {
assertNotNull(response.getError());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugVerbosityTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.SERVER_URL));
Expand All @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.web3j.protocol.http.HttpService;

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

@DisplayName("Debug RPC Test")
public class DebugIsPProfRunningTest {
private Web3j w3 = Web3j.build(new HttpService(UrlConstants.SERVER_URL));
Expand All @@ -23,5 +23,8 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNotNull(response.getResult());
assertInstanceOf(Boolean.class, response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ void whenRequestValid_ThenCall200ResponseReturns() throws IOException {

assertNotNull(response);
assertNull(response.getError());

assertNull(response.getResult());
}
}
Loading

0 comments on commit addc6ae

Please sign in to comment.