https://github.com/exercism/java-representer
https://github.com/exercism/java-representer
community-contributions-accepted exercism-representer exercism-tooling maintained
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/exercism/java-representer
- Owner: exercism
- License: agpl-3.0
- Created: 2020-02-18T21:24:18.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-06-02T07:16:16.000Z (7 months ago)
- Last Synced: 2025-06-11T16:35:57.185Z (7 months ago)
- Topics: community-contributions-accepted, exercism-representer, exercism-tooling, maintained
- Language: Java
- Size: 392 KB
- Stars: 0
- Watchers: 6
- Forks: 9
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Java Representer [![Coverage Status][coveralls-badge]][coveralls-report]
This repository contains the source code for the [Representer][representer-docs] used by the Java track on Exercism.
It takes a Java exercise solution submitted by a student and transforms it into a normalized representation.
## Contributing
If you want to contribute to the Java Representer, please refer to the [Contributing Guide][contributing-guide].
## Usage
### Running directly
Start by building the JAR using Gradle:
```sh
./gradlew build
```
Then, run the Java Representer using `build/libs/java-representer.jar`.
For example, to create a representation for a solution to the `leap` exercise, run:
```sh
java -jar build/libs/java-representer.jar leap /path/to/leap /path/to/output/folder
```
The Representer output can be found in the following files inside the `/path/to/output/folder` directory:
- `representation.txt` - Contains the normalized representation of the Java code inside the solution.
- `mapping.json` - Contains a mapping between the generated placeholders used in the representation and the original identifiers.
- `representation.json` - Contains metadata.
### Running with Docker
To run the Java Representer using Docker, first build and tag the Docker image:
```sh
docker build -t exercism/java-representer .
```
Then, run the image and mount the directory of the solution to represent.
For example, to create a representation for a solution to the `leap` exercise, run:
```sh
docker run -v /path/to/leap:/input -v /path/to/output/folder:/output exercism/java-representer leap /input /output
```
The Representer output can be found in the following files inside the `/path/to/output/folder` directory:
- `representation.txt` - Contains the normalized representation of the Java code inside the solution.
- `mapping.json` - Contains a mapping between the generated placeholders used in the representation and the original identifiers.
- `representation.json` - Contains metadata.
## Tests
### Unit tests
To run the unit tests:
```sh
./gradlew test
```
### Smoke tests
To run the smoke tests using Docker:
```sh
bin/run-tests-in-docker.sh
```
[contributing-guide]: https://github.com/exercism/java-representer/blob/main/CONTRIBUTING.md
[representer-docs]: https://exercism.org/docs/building/tooling/representers
[coveralls-badge]: https://coveralls.io/repos/github/exercism/java-representer/badge.svg?branch=main
[coveralls-report]: https://coveralls.io/github/exercism/java-representer?branch=main