Coder Social home page Coder Social logo

banking-kata-optivem's Introduction

Banking Kata - Java

CI

Purpose

This demo was created for the purposes of meetup series on TDD & Clean Architecture. See the YouTube Meetups. Please note that this project is purely for demo purposes only.

Overview

This project illustrates TDD & Clean Architecture implementation in Java, showing the Use Case Driven Development Approach.

We implement a Banking system with the following use cases:

  • Open account
  • Withdraw funds
  • Deposit funds
  • View account

We also have authentication with Keycloak - a realm with client_id and with client_credentials flow enabled.

Prerequisites

  • OpenJDK 17
  • Docker

Running Unit Tests

Run unit tests for core:

./gradlew coreTest

Running Integration Tests

Apply the environment variables (Windows):

. .\env\env.ps1

Apply the environment variables (for Linux/Mac):

source ./env/env.sh

For Mac only, you need to build a custom Keycloak image to enable Keycloak to work on Mac M1. This is due to a reported Mac-specific issue docker/for-mac#5310. For any other OS, please skip this step, because this issue is Mac-specific:

./src/main/resources/keycloak/build-keycloak-image-m1.zsh 16.0.0

Run docker:

docker-compose up -d

To run all the adapter integration tests:

./gradlew adapterTest

Running System Tests

To run the whole system:

./gradlew systemTest

Code Coverage & Mutation Testing

Run JaCoCo code coverage:

./gradlew jacocoTestReport

Run PIT mutation testing (currently this doesn't work, pending to fix #69):

./gradlew pitest

Reports

See the build\reports directory for the generated reports for test results, code coverage and mutation testing.

Reports:

  • build\reports\tests
  • build\reports\jacoco
  • build\reports\pitest

Running Spring Boot

./gradlew startup:bootRun

Optional Notes

Environment variables are located inside the env folder. You can optionally choose to edit them.

You can choose to run the tests via IntelliJ UI.

In the case of integration tests (for adapters) you'd have to specify environment variables before you run the tests. To do that, you can copy the text from the file env/env.intellij.ui into the Environment variables section into Tests in 'banking-kata.adapters' configuration.

To run Docker with the environment file:

docker-compose --env-file=env/.env.local up -d

You can run the integration tests individually, e.g. if you modified a module (in this way you avoid waiting for all of them to finish):

./gradlew adapter-persistence-jpa:test

Issues

If you experience Integration Tests failing, please see the following known issue valentinacupac#64.

If you experience any other issues, please create a ticket https://github.com/valentinacupac/banking-kata-java/issues/new

Contributors

Our contributors are:

If you'd like to contribute, see instructions here https://github.com/valentinacupac/banking-kata-java/blob/main/CONTRIBUTING.md

banking-kata-optivem's People

Contributors

adrianliz avatar donaldsiziba avatar f-lombardo avatar valentinacupac avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.