Skip to content

Commit

Permalink
Add Kotlin to list of languages, refresh assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
codecop committed Oct 3, 2023
1 parent b6efbde commit a0bfe95
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/Kotlin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test Kotlin

on:
push:
paths:
- 'Kotlin/**'
- '.github/workflows/Kotlin.yml'
pull_request:
paths:
- 'Kotlin/**'
- '.github/workflows/Kotlin.yml'

jobs:
build:
runs-on: ubuntu-latest

env:
DB_USER: root
DB_OLD_PASSWORD: root
DB_PASSWORD: mysql

steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Start MYSQL and import DB
run: |
sudo systemctl start mysql
mysqladmin --user=${{ env.DB_USER }} --password=${{ env.DB_OLD_PASSWORD }} password ${{ env.DB_PASSWORD }}
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/build/Database/initDatabase.sql
- name: Set up Kotlin
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 8
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build and test
working-directory: Kotlin
run: ./gradlew --console=plain --info --stacktrace build test
46 changes: 46 additions & 0 deletions Kotlin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Dependency Breaking Katas

Exercises to practice breaking dependencies in legacy
code to create tests for it.

## Goal

We have some legacy code. We need to make changes.
To make changes we need to introduce tests first.
We might have to change some code to enable testing.
We need to introduce so-called Seams (see [Michael
Feathers' Working Effectively with Legacy
Code](https://www.goodreads.com/book/show/44919.Working_Effectively_with_Legacy_Code)).

Changing code without test is risky, so we want to

* Only change as little code as possible.
* Rely on automated Refactoring tools as much as possible.
* You must not change the public API of the class.

### Assignments for Techniques

* Parametrise Constructor
* Subclass And Override Method
* Extract And Override Call
* Replace Global Reference With Getter
* Extract And Override Factory Method

Planned

* Extract Interface
* Adapt Parameter

### Task

Each task presents you with a class and some collaborators.

* Bring this class under test. Make sure to cover all paths in the core logic.
* There is an existing test class with a first test case which might or might not work.
* You cannot change collaborators because they are used by other teams as well.

### License

[New BSD License](http://opensource.org/licenses/bsd-license.php), see `license.txt` in repository.

(This is a copied document - do not edit!)
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ run on our online shop. During campaigns we e.g. offer discounts.

* Bring `MarketingCampaign` under test. Make sure to cover all paths in the core logic.
* There is an existing `MarketingCampaignTest` with a first test case which might or might not work.

(This is a copied document - do not edit!)
6 changes: 6 additions & 0 deletions build/clean.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ cd ..



cd Kotlin
call gradlew clean
cd ..



pause
12 changes: 12 additions & 0 deletions build/refresh_copied_md.bat
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@ cd ..\..



cd Kotlin
@call "%~p0\_copy.bat" .. README.md .
cd src
@call "%~p0\_copy.bat" ..\..\Java\src\main\java\org\codecop\dependencies\a Assignment.md main\kotlin\org\codecop\dependencies\a
@call "%~p0\_copy.bat" ..\..\Java\src\main\java\org\codecop\dependencies\b Assignment.md main\kotlin\org\codecop\dependencies\b
@call "%~p0\_copy.bat" ..\..\Java\src\main\java\org\codecop\dependencies\c Assignment.md main\kotlin\org\codecop\dependencies\c
@call "%~p0\_copy.bat" ..\..\Java\src\main\java\org\codecop\dependencies\d Assignment.md main\kotlin\org\codecop\dependencies\d
@call "%~p0\_copy.bat" ..\..\Java\src\main\java\org\codecop\dependencies\e Assignment.md main\kotlin\org\codecop\dependencies\e
cd ..\..



pause

0 comments on commit a0bfe95

Please sign in to comment.