|
|
@ -17,6 +17,7 @@ package org.hyperledger.besu.config; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.hyperledger.besu.config.GenesisReader.ALLOCATION_FIELD; |
|
|
|
import static org.hyperledger.besu.config.GenesisReader.ALLOCATION_FIELD; |
|
|
|
import static org.hyperledger.besu.config.GenesisReader.CONFIG_FIELD; |
|
|
|
import static org.hyperledger.besu.config.GenesisReader.CONFIG_FIELD; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
|
|
|
|
|
|
|
|
|
import org.hyperledger.besu.datatypes.Address; |
|
|
|
import org.hyperledger.besu.datatypes.Address; |
|
|
|
import org.hyperledger.besu.datatypes.Wei; |
|
|
|
import org.hyperledger.besu.datatypes.Wei; |
|
|
@ -27,6 +28,7 @@ import java.nio.file.Path; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.io.TempDir; |
|
|
|
import org.junit.jupiter.api.io.TempDir; |
|
|
@ -111,4 +113,17 @@ public class GenesisReaderTest { |
|
|
|
entry.put("balance", balance.toShortHexString()); |
|
|
|
entry.put("balance", balance.toShortHexString()); |
|
|
|
return entry; |
|
|
|
return entry; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
void testNonceHandlingAsStringAndInteger() { |
|
|
|
|
|
|
|
ObjectNode accountNode = JsonNodeFactory.instance.objectNode(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
accountNode.put("nonce", 10); |
|
|
|
|
|
|
|
String nonceAsStringFromInt = JsonUtil.getValueAsString(accountNode, "nonce").orElse(""); |
|
|
|
|
|
|
|
assertEquals("10", nonceAsStringFromInt, "Nonce should convert integer to string correctly"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
accountNode.put("nonce", "20"); |
|
|
|
|
|
|
|
String nonceAsStringDirect = JsonUtil.getValueAsString(accountNode, "nonce").orElse(""); |
|
|
|
|
|
|
|
assertEquals("20", nonceAsStringDirect, "Nonce should keep string as string correctly"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|