Skip to content

Commit 4fb8532

Browse files
authored
Merge pull request #2 from boolean-uk/extension-template
restructured core, added extensions and updated workflows
2 parents 44c5a4d + 692cbf5 commit 4fb8532

File tree

8 files changed

+52
-17
lines changed

8 files changed

+52
-17
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Extension Criteria
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
build-gradle-project:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout project sources
12+
uses: actions/checkout@v2
13+
- name: Setup Gradle
14+
uses: gradle/gradle-build-action@v2
15+
- name: Run build with Gradle Wrapper
16+
run: ./gradlew test --tests com.booleanuk.extension.*

.github/workflows/standard-criteria.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
- name: Setup Gradle
1414
uses: gradle/gradle-build-action@v2
1515
- name: Run build with Gradle Wrapper
16-
run: ./gradlew build
16+
run: ./gradlew test --tests com.booleanuk.core.*

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ name in the [settings.gradle](./settings.gradle) file.
99
## Set up instructions
1010
- Fork this repository and clone the forked version to your machine
1111
- Open the root directory of the project in IntelliJ
12-
- Implement the requirements listed in comments in the `./src/main/java/com.booleanuk/Exercise.java` file
13-
- When ready to test your solution, open the `./src/test/java/com.booleanuk/ExerciseTest.java` file and click a "Run Test" button. You can either run the entire test suite via figure 1 in the screenshot below, or run a specific test via figure 2.
12+
- Implement the requirements listed in comments in the `./src/main/java/com.booleanuk/core/Exercise.java` file
13+
- When ready to test your solution, open the `./src/test/java/com.booleanuk/core/ExerciseTest.java` file and click a "Run Test" button. You can either run the entire test suite via figure 1 in the screenshot below, or run a specific test via figure 2.
1414

1515
![](./assets/run-a-test.PNG)
1616

@@ -24,6 +24,6 @@ In the sample screenshot below, we've tried to complete the first step of the ex
2424

2525
At the top, we see `expected: <32> but was: <33>`. This means the test expected the value to be 32, but the value the student provided was 33. We can see this in the code snippets at the top of the screenshot.
2626

27-
In the stack trace itself, we see this line: `at app//com.booleanuk.ExerciseTest.shouldBeAged32(ExerciseTest.java:20)`. This is helpful! This tells us the exact line in the ExerciseTest.java file (line 20) where the failure happened, as well as the method name (shouldBeAged32), helping us to identify where the issue began. This is the kind of thing you need to look for; a relevant file name, method name, class name and line number to give you a good starting point for debugging.
27+
In the stack trace itself, we see this line: `at app//com.booleanuk.core.ExerciseTest.shouldBeAged32(ExerciseTest.java:20)`. This is helpful! This tells us the exact line in the ExerciseTest.java file (line 20) where the failure happened, as well as the method name (shouldBeAged32), helping us to identify where the issue began. This is the kind of thing you need to look for; a relevant file name, method name, class name and line number to give you a good starting point for debugging.
2828

2929
![](./assets/test-failure.PNG)

src/main/java/com/booleanuk/Sample.java renamed to src/main/java/com/booleanuk/core/Exercise.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.booleanuk;
1+
package com.booleanuk.core;
22

3-
public class Sample {
3+
public class Exercise {
44
public static String sayHelloWorld() {
55
return "Hello, world!";
66
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.booleanuk.extension;
2+
3+
public class Extension {
4+
public static String sayHelloWorld() {
5+
return "Hello, world!";
6+
}
7+
}

src/test/java/com/booleanuk/SampleTest.java

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.booleanuk.core;
2+
3+
import com.booleanuk.core.Exercise;
4+
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.Test;
6+
7+
class ExerciseTest {
8+
@Test
9+
public void shouldSayHelloWorld() {
10+
Assertions.assertEquals("Hello, world!", Exercise.sayHelloWorld());
11+
}
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.booleanuk.extension;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
6+
public class ExtensionTest {
7+
@Test
8+
public void shouldSayHelloWorld() {
9+
Assertions.assertEquals("Hello, world!", Extension.sayHelloWorld());
10+
}
11+
}

0 commit comments

Comments
 (0)