Skip to content

Commit 181efaa

Browse files
authored
Merge branch 'code-differently:main' into Shawn-lesson16
2 parents 398e46d + a3a21bb commit 181efaa

File tree

33 files changed

+855
-221
lines changed

33 files changed

+855
-221
lines changed

.github/workflows/check_lesson_17_java_pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
branches: [ "main" ]
66
paths:
7-
- "lesson_17/oop/**"
7+
- "lesson_17/bank/**"
88

99
jobs:
1010
build:
@@ -24,5 +24,5 @@ jobs:
2424
distribution: 'temurin'
2525

2626
- name: Build Lesson 17 with Java
27-
working-directory: ./lesson_17/oop
27+
working-directory: ./lesson_17/bank
2828
run: ./gradlew check

.github/workflows/check_push.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ on:
1818
- "lesson_13/maps_java/**"
1919
- "lesson_13/maps_ts/**"
2020
- "lesson_14/exceptions/**"
21+
- "lesson_15/tdd/**"
22+
- "lesson_16/objects/**"
23+
- "lesson_17/bank/**"
2124

2225
jobs:
2326
build:
@@ -125,4 +128,14 @@ jobs:
125128

126129
- name: Build Lesson 15 with Java
127130
working-directory: ./lesson_15/tdd
131+
run: |
132+
./gradlew assemble
133+
./gradlew spotlessCheck
134+
135+
- name: Build Lesson 16 with Java
136+
working-directory: ./lesson_16/objects
137+
run: ./gradlew check
138+
139+
- name: Build Lesson 17 with Java
140+
working-directory: ./lesson_17/bank
128141
run: ./gradlew check

lesson_10/libraries/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"start": "node build/lesson10.js",
88
"dev": "tsc-watch --noClear -p ./tsconfig.build.json --onSuccess \"node ./build/lesson10.js\"",
9-
"test": "node --experimental-vm-modules node_modules/.bin/jest",
9+
"test": "node --experimental-vm-modules node_modules/.bin/jest --coverage",
1010
"compile": "tsc -p tsconfig.build.json",
1111
"prepare": "npm run compile",
1212
"pretest": "npm run compile",
@@ -42,4 +42,4 @@
4242
"csv-parser": "^3.0.0",
4343
"uuid": "^10.0.0"
4444
}
45-
}
45+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

lesson_16/objects/objects_app/build.gradle.kts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ plugins {
22
// Apply the application plugin to add support for building a CLI application in Java.
33
application
44
eclipse
5+
jacoco
6+
id("io.freefair.lombok") version "8.10.2"
57
id("com.diffplug.spotless") version "6.25.0"
68
id("org.springframework.boot") version "3.2.2"
79
id("com.adarshr.test-logger") version "4.0.0"
@@ -16,17 +18,14 @@ repositories {
1618

1719
dependencies {
1820
// Use JUnit Jupiter for testing.
19-
testImplementation("com.codedifferently.instructional:instructional-lib")
2021
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1")
2122
testImplementation("org.springframework.boot:spring-boot-starter-test")
2223
testImplementation("org.assertj:assertj-core:3.25.1")
2324
testImplementation("at.favre.lib:bcrypt:0.10.2")
2425

2526
// This dependency is used by the application.
26-
implementation("com.codedifferently.instructional:instructional-lib")
2727
implementation("com.google.guava:guava:31.1-jre")
2828
implementation("com.google.code.gson:gson:2.10.1")
29-
implementation("org.projectlombok:lombok:1.18.30")
3029
implementation("org.springframework.boot:spring-boot-starter")
3130
}
3231

@@ -38,8 +37,29 @@ application {
3837
tasks.named<Test>("test") {
3938
// Use JUnit Platform for unit tests.
4039
useJUnitPlatform()
40+
finalizedBy(tasks.jacocoTestReport)
4141
}
4242

43+
tasks.jacocoTestReport {
44+
dependsOn(tasks.test)
45+
reports {
46+
xml.required = true
47+
}
48+
}
49+
50+
tasks.jacocoTestCoverageVerification {
51+
violationRules {
52+
rule {
53+
limit {
54+
minimum = "0.8".toBigDecimal()
55+
}
56+
}
57+
}
58+
}
59+
60+
tasks.check {
61+
dependsOn(tasks.jacocoTestCoverageVerification)
62+
}
4363

4464
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
4565

lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/Lesson16Test.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import static org.assertj.core.api.Assertions.assertThat;
44

55
import org.junit.jupiter.api.Test;
6+
import org.springframework.boot.test.context.SpringBootTest;
67

8+
@SpringBootTest(useMainMethod = SpringBootTest.UseMainMethod.WHEN_AVAILABLE)
79
class Lesson16Test {
810

911
@Test
10-
void testCanVote() {
12+
void testMain() {
1113
assertThat(new Lesson16()).isNotNull();
1214
}
1315
}

lesson_16/objects/settings.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@
77
* in the user manual at https://docs.gradle.org/8.0.2/userguide/multi_project_builds.html
88
*/
99

10-
includeBuild("../../lib/java/codedifferently-instructional")
11-
1210
rootProject.name = "lesson_16"
1311
include("objects_app")

lesson_17/README.md

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,27 @@ Please review the following resources before lecture:
1616

1717
## Homework
1818

19-
- [ ] Complete [Library Management System](#library-management-system) assignment.
19+
- [ ] Complete [Applying SOLID principles](#applying-solid-principles-bank-atm) exercise.
20+
- [ ] Review [OOP Project](/project_oop/) documentation and complete user stories.
2021

21-
## Library Management System
22+
## Applying SOLID Principles (Bank ATM)
2223

23-
For this assignment, you will build a library management system using object oriented principles. Pay attention to the requirements careful in order to implement your system successfully.
24+
Your task for this assignment is add enhancements to an ATM simulator. The [BankAtm][bankatm-file] is at the center of the model, allowing us to add one or more `CheckingAccount` instances and make withdrawals or deposits via cash or check. You will need to implement at least two of the following functional enhancements to the `BankAtm` class WITHOUT adding a new method. Note that you can update existing methods, however.
2425

2526
### Functional Requirements
2627

27-
* We want to define a book and keep track of its title, isbn, author(s), number of pages, and whether it is checked out or not.
28-
* We want define a patron with properties including their name and the books they have checked out.
29-
* We want to define a library that:
30-
* Allows us to add/remove a book to and from its collection of books.
31-
* Allows us to register new patrons
32-
* Allows us to check out books to patrons.
33-
* Allows us to return books from patrons.
28+
* We want to support a `SavingsAccount` that works just like the `CheckingAccount`, but doesn't allow you to write checks against the account.
29+
* We want the `BankAtm` class to support the concept of a `BusinessCheckingAccount`. A business account requires that at least one of the owning accounts is a business.
30+
* In addition to supporting checks and cash, we also want to support the concept of another monetary instrument called a `MoneyOrder`. Unlike a `Check`, a `MoneyOrder` withdraws funds from a source account immediately on creation for the purposes of this simulation..
31+
* For traceability, all of the transactions in the `BankAtm` class should logged. Create an `AuditLog` class that keeps a record of all debits and credits to any account and integrate it with the `BankAtm` class.
32+
* For the `depositFunds` method that accepts a cash amount, we'd like the ability to deposit funds in a variety of currencies. Add a parameter that accepts a currency type and a new object that encapsulates the currency converter logic for converting a cash amount to the account currency type.
3433

3534
### Technical Requirements
3635

37-
* All of your types must be created in a unique sub-package under the `com.codedifferently.lesson17` namespace.
38-
* Include tests for all of your classes and public methods.
39-
* Include appropriate `javadoc` for your classes and methods. In VS Code, you can usually start a comment with `/**` and press `Enter` to let the IDE automatically create some starter text for you.
36+
* You must integrate new features into the `BankAtm` without adding a new public method. Existing public methods may be modified without breaking existing functionality.
37+
* You must update the `BankAtm` tests and may modify or add other applicable tests.
38+
* Feel free to add the minimal number of classes, interfaces, or abstract classes needed to fulfill each requirement.
39+
* You must update existing javadocs and may add new documentation for new types and methods you introduce.
4040

41-
### Tips
42-
43-
* Read the functional requirements carefully, and take special care to identify *objects*, their *data*, and their *actions*.
44-
* It is highly recommended that you write your tests firsts, and then build what you need to make the tests work. This is essential to [Test-Driven Development][tdd-article].
45-
* How will you ensure that books are properly checked out using the library? What if someone tries to check out a book the library doesn't own (or vice-versa with returns)?
46-
* What are the public methods that you need to have to get the system working? Don't make anything public that you don't need to fulfill the requirements of the assignment. For instance, adding a getter method for a book's ISBN makes sense, but adding a method for returning the library's hours of operation is beyond the scope of this assignment.
47-
* How can you use collections to manage books and patrons? For instance, it would be wise to ensure that patrons can only be registered once based on some unique identifier.
48-
49-
[tdd-article]: https://semaphoreci.com/blog/test-driven-development
41+
[bank-folder]: ./bank/
42+
[bankatm-file]: ./bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/BankAtm.java
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)