https://github.com/ganchix/testcontainers-java-module-ganache
Testcontainers module for Ganache CLI
https://github.com/ganchix/testcontainers-java-module-ganache
ethereum ganache ganache-cli java test testcontainers testing
Last synced: about 1 year ago
JSON representation
Testcontainers module for Ganache CLI
- Host: GitHub
- URL: https://github.com/ganchix/testcontainers-java-module-ganache
- Owner: ganchix
- License: mit
- Created: 2018-05-20T19:06:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-13T18:08:45.000Z (almost 8 years ago)
- Last Synced: 2025-04-13T11:12:17.931Z (about 1 year ago)
- Topics: ethereum, ganache, ganache-cli, java, test, testcontainers, testing
- Language: Java
- Size: 70.3 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# TestContainers Ganache testing module [](https://travis-ci.org/ganchix/testcontainers-java-module-ganache) [](https://codecov.io/gh/ganchix/testcontainers-java-module-ganache) [](https://maven-badges.herokuapp.com/maven-central/io.github.ganchix/testcontainers-java-module-ganache) [](https://github.com/ganchix/testcontainers-java-module-ganache)
Testcontainers module for [Ganache](http://truffleframework.com/ganache/).
# Table of Contents
- [Overview](#overview)
- [Getting started](#getting-started)
- [Considerations](#considerations)
- [License](#license)
### Overview
A simple way to test [Ethereum](https://www.ethereum.org/) in your Java Code
See [testcontainers.org](https://www.testcontainers.org) for more information about Testcontainers.
### Getting started
#### Add dependency
##### Maven
```
io.github.ganchix
testcontainers-java-module-ganache
0.0.4
```
##### Gradle
```
compile group: 'io.github.ganchix', name: 'testcontainers-java-module-ganache', version: '0.0.4'
```
#### Code example
Running Ganache during a test:
```java
public class SomeTest {
@Rule
public GanacheContainer GanacheContainer = new GanacheContainer();
@Test
public void simpleTestWithClientCreation() {
Web3j web3j = ganacheContainer.getWeb3j();
assertEquals( web3j.ethBlockNumber().send().getBlockNumber(), BigInteger.ZERO);
assertNotNull(ganacheContainer);
}
}
```
### Considerations
To obtain the data of addresses and privates keys of console log we implemented a custom log consumer [LogGanacheExtractorConsumer](src/main/java/io/github/ganchix/ganache/LogGanacheExtractorConsumer.java),
if you overwrite it this information will not be extracted.
### License
Testcontainers module for Ganache is licensed under the MIT License. See [LICENSE](LICENSE.md) for details.
Copyright (c) 2018 Rafael Ríos Moya