Skip to content

Commit a3e012d

Browse files
committed
fix: resolves gradle build issues
Signed-off-by: Anthony D. Mays <[email protected]>
1 parent d4884a1 commit a3e012d

File tree

6 files changed

+79
-65
lines changed

6 files changed

+79
-65
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"source.fixAll.eslint": "explicit",
1010
"source.organizeImports": "explicit"
1111
},
12+
"[java]": {
13+
"editor.codeActionsOnSave": {
14+
"source.organizeImports": "never"
15+
}
16+
},
1217
"[typescriptreact]": {
1318
"editor.defaultFormatter": "esbenp.prettier-vscode"
1419
},

lesson_02/quiz-java/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repositories {
99
}
1010

1111
dependencies {
12-
testImplementation libs.junit_jupiter
12+
testImplementation libs.junit.jupiter
1313
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
1414
implementation libs.guava
1515
implementation project(":codedifferently-instructional")
@@ -24,7 +24,7 @@ java {
2424

2525
application {
2626
// Define the main class for the application.
27-
mainClass = 'org.example.App'
27+
mainClass = 'org.example.Lesson'
2828
}
2929

3030
tasks.named('test') {

lesson_02/quiz-java/app/src/main/java/org/example/Lesson.java

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
import java.util.HashMap;
77
import java.util.Map;
88

9+
import com.codedifferently.instructional.quiz.AnswerChoice;
910
import com.codedifferently.instructional.quiz.MultipleChoiceQuizQuestion;
10-
import com.codedifferently.instructional.quiz.MultipleChoiceQuestion;
11+
1112
public class Lesson {
1213

1314
public static void main(String[] args) {
14-
MultipleChoiceQuestion[] questions = makeQuestions();
15-
for(MultipleChoiceQuestion q : questions) {
15+
MultipleChoiceQuizQuestion[] questions = makeQuestions();
16+
for (MultipleChoiceQuizQuestion q : questions) {
1617
System.out.println(q);
1718
}
1819
}
1920

20-
public static MultipleChoiceQuestion[] makeQuestions() {
21-
MultipleChoiceQuestion[] questions = new MultipleChoiceQuestion[11];
21+
public static MultipleChoiceQuizQuestion[] makeQuestions() {
22+
MultipleChoiceQuizQuestion[] questions = new MultipleChoiceQuizQuestion[11];
2223
questions[0] = makeQuestion0();
2324
questions[1] = makeQuestion1();
2425
questions[2] = makeQuestion2();
@@ -33,30 +34,28 @@ public static MultipleChoiceQuestion[] makeQuestions() {
3334

3435
return questions;
3536
}
36-
3737

38-
39-
public static MultipleChoiceQuestion makeQuestion0() {
38+
public static MultipleChoiceQuizQuestion makeQuestion0() {
4039
Map<AnswerChoice, String> answerChoices = new HashMap<>();
4140
answerChoices.put(AnswerChoice.A, "To make backups of files");
4241
answerChoices.put(AnswerChoice.B, "To keep a record of changes over time");
4342
answerChoices.put(AnswerChoice.C, " To delete unnecessary files");
4443
answerChoices.put(AnswerChoice.D, "To run code more efficiently");
4544

4645
return new MultipleChoiceQuizQuestion(
47-
0,"What is the main purpose of version control?",answerChoices,AnswerChoice.B);
46+
0, "What is the main purpose of version control?", answerChoices, AnswerChoice.B);
4847
}
4948

50-
public static MultipleChoiceQuestion makeQuestion1() {
51-
Map<AnswerChoice, String> answerChoices = new HashMap<>();
49+
public static MultipleChoiceQuizQuestion makeQuestion1() {
50+
Map<AnswerChoice, String> answerChoices = new HashMap<>();
5251
answerChoices.put(AnswerChoice.A, "A duplicate copy of a repository that you own and modify");
5352
answerChoices.put(AnswerChoice.B, "A temporary backup of the code");
5453
answerChoices.put(AnswerChoice.C, "A tool for merging branches");
5554
answerChoices.put(AnswerChoice.D, "What is a fork in Git?");
5655

5756
return new MultipleChoiceQuizQuestion(
58-
1,"What is the main purpose of version control?",answerChoices,AnswerChoice.B);
59-
}
57+
1, "What is a fork in Git?", answerChoices, AnswerChoice.A);
58+
}
6059

6160
public static MultipleChoiceQuizQuestion makeQuestion2() {
6261
Map<AnswerChoice, String> answerChoices = new HashMap<>();
@@ -66,8 +65,9 @@ public static MultipleChoiceQuizQuestion makeQuestion2() {
6665
answerChoices.put(AnswerChoice.D, "Write code directly in GitHub");
6766

6867
return new MultipleChoiceQuizQuestion(
69-
2,"Which of the following is NOT part of the basic Git workflow?",answerChoices,AnswerChoice.D);
68+
2, "Which of the following is NOT part of the basic Git workflow?", answerChoices, AnswerChoice.D);
7069
}
70+
7171
public static MultipleChoiceQuizQuestion makeQuestion3() {
7272
Map<AnswerChoice, String> answerChoices = new HashMap<>();
7373
answerChoices.put(AnswerChoice.A, "git commit");
@@ -76,7 +76,7 @@ public static MultipleChoiceQuizQuestion makeQuestion3() {
7676
answerChoices.put(AnswerChoice.D, "git pull");
7777

7878
return new MultipleChoiceQuizQuestion(
79-
3,"What command is used to combine changes from different branches?",answerChoices,AnswerChoice.B);
79+
3, "What command is used to combine changes from different branches?", answerChoices, AnswerChoice.B);
8080
}
8181

8282
public static MultipleChoiceQuizQuestion makeQuestion4() {
@@ -87,7 +87,7 @@ public static MultipleChoiceQuizQuestion makeQuestion4() {
8787
answerChoices.put(AnswerChoice.D, "VS Code");
8888

8989
return new MultipleChoiceQuizQuestion(
90-
4,"Which IDE is being used in the class?",answerChoices,AnswerChoice.D);
90+
4, "Which IDE is being used in the class?", answerChoices, AnswerChoice.D);
9191
}
9292

9393
public static MultipleChoiceQuizQuestion makeQuestion5() {
@@ -98,62 +98,65 @@ public static MultipleChoiceQuizQuestion makeQuestion5() {
9898
answerChoices.put(AnswerChoice.D, "Source Control");
9999

100100
return new MultipleChoiceQuizQuestion(
101-
5,"What feature allows developers to work from the same pre-configured environment in VS Code?",answerChoices,AnswerChoice.C);
101+
5, "What feature allows developers to work from the same pre-configured environment in VS Code?", answerChoices, AnswerChoice.C);
102102
}
103-
public static MultipleChoiceQuizQuestion makeQuestion6() {
103+
104+
public static MultipleChoiceQuizQuestion makeQuestion6() {
104105
Map<AnswerChoice, String> answerChoices = new HashMap<>();
105-
answerChoices.put(AnswerChoice.A, "Editing and refactoring code");
106-
answerChoices.put(AnswerChoice.B, "Browsing code");
107-
answerChoices.put(AnswerChoice.C, "Playing music");
108-
answerChoices.put(AnswerChoice.D, "Managing source control");
109-
106+
answerChoices.put(AnswerChoice.A, "Editing and refactoring code");
107+
answerChoices.put(AnswerChoice.B, "Browsing code");
108+
answerChoices.put(AnswerChoice.C, "Playing music");
109+
answerChoices.put(AnswerChoice.D, "Managing source control");
110110

111111
return new MultipleChoiceQuizQuestion(
112-
6,"What is NOT a reason for using an IDE?",answerChoices,AnswerChoice.C);
112+
6, "What is NOT a reason for using an IDE?", answerChoices, AnswerChoice.C);
113113
}
114+
114115
public static MultipleChoiceQuizQuestion makeQuestion7() {
115116
Map<AnswerChoice, String> answerChoices = new HashMap<>();
116-
answerChoices.put(AnswerChoice.A, "pwd");
117-
answerChoices.put(AnswerChoice.B, "ls");
118-
answerChoices.put(AnswerChoice.C, "cd");
119-
answerChoices.put(AnswerChoice.D, "mkdir");
117+
answerChoices.put(AnswerChoice.A, "pwd");
118+
answerChoices.put(AnswerChoice.B, "ls");
119+
answerChoices.put(AnswerChoice.C, "cd");
120+
answerChoices.put(AnswerChoice.D, "mkdir");
120121

121122
return new MultipleChoiceQuizQuestion(
122-
7,"Which command is used to print the current working directory in the terminal?",answerChoices,AnswerChoice.A);
123+
7, "Which command is used to print the current working directory in the terminal?", answerChoices, AnswerChoice.A);
123124
}
124-
public static MultipleChoiceQuizQuestion makeQuestion8() {
125+
126+
public static MultipleChoiceQuizQuestion makeQuestion8() {
125127
Map<AnswerChoice, String> answerChoices = new HashMap<>();
126-
answerChoices.put(AnswerChoice.A, "pwd");
127-
answerChoices.put(AnswerChoice.B, "ls");
128-
answerChoices.put(AnswerChoice.C, "cd");
129-
answerChoices.put(AnswerChoice.D, "mkdir");
128+
answerChoices.put(AnswerChoice.A, "pwd");
129+
answerChoices.put(AnswerChoice.B, "ls");
130+
answerChoices.put(AnswerChoice.C, "cd");
131+
answerChoices.put(AnswerChoice.D, "mkdir");
130132

131133
return new MultipleChoiceQuizQuestion(
132-
8,"Which command is used to change directories in the terminal?",answerChoices,AnswerChoice.C);
134+
8, "Which command is used to change directories in the terminal?", answerChoices, AnswerChoice.C);
133135
}
134-
public static MultipleChoiceQuizQuestion makeQuestion9() {
136+
137+
public static MultipleChoiceQuizQuestion makeQuestion9() {
135138

136139
Map<AnswerChoice, String> answerChoices = new HashMap<>();
137-
answerChoices.put(AnswerChoice.A, "Change file or directory permissions");
138-
answerChoices.put(AnswerChoice.B, "List files in a directory");
139-
answerChoices.put(AnswerChoice.C, "Remove a file or directory");
140-
answerChoices.put(AnswerChoice.D, "Copy a file or directory");
140+
answerChoices.put(AnswerChoice.A, "Change file or directory permissions");
141+
answerChoices.put(AnswerChoice.B, "List files in a directory");
142+
answerChoices.put(AnswerChoice.C, "Remove a file or directory");
143+
answerChoices.put(AnswerChoice.D, "Copy a file or directory");
141144

142-
return new MultipleChoiceQuizQuestion(
143-
9,"What does the command `chmod` do?",answerChoices,AnswerChoice.A);
145+
return new MultipleChoiceQuizQuestion(
146+
9, "What does the command `chmod` do?", answerChoices, AnswerChoice.A);
144147

145148
}
146-
public static MultipleChoiceQuizQuestion makeQuestion10() {
147-
Map<AnswerChoice, String> answerChoices = new HashMap<>();
148-
answerChoices.put(AnswerChoice.A, "⌘ + Shift + T");
149-
answerChoices.put(AnswerChoice.B, "⌘ + Spacebar, then type terminal");
150-
answerChoices.put(AnswerChoice.C, "⌘ + Q");
151-
answerChoices.put(AnswerChoice.D, "⌘ + S, then type terminal");
152149

150+
public static MultipleChoiceQuizQuestion makeQuestion10() {
151+
Map<AnswerChoice, String> answerChoices = new HashMap<>();
152+
answerChoices.put(AnswerChoice.A, "⌘ + Shift + T");
153+
answerChoices.put(AnswerChoice.B, "⌘ + Spacebar, then type terminal");
154+
answerChoices.put(AnswerChoice.C, "⌘ + Q");
155+
answerChoices.put(AnswerChoice.D, "⌘ + S, then type terminal");
153156

154-
return new MultipleChoiceQuizQuestion(
155-
10,"What is the shortcut for getting to the Mac terminal?",answerChoices,AnswerChoice.B);
157+
return new MultipleChoiceQuizQuestion(
158+
10, "What is the shortcut for getting to the Mac terminal?", answerChoices, AnswerChoice.B);
156159

157160
}
158161

159-
}
162+
}

lesson_02/quiz-java/app/src/test/java/org/example/AppTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import org.junit.jupiter.api.Test;
77
import static org.junit.jupiter.api.Assertions.*;
88

9-
class AppTest {
10-
@Test void appHasAGreeting() {
11-
App classUnderTest = new App();
12-
assertNotNull(classUnderTest.getGreeting(), "app should have a greeting");
9+
class LessonTest {
10+
@Test void lessonHasQuestions() {
11+
assertNotNull(Lesson.makeQuestions(), "lesson should have questions");
12+
assertTrue(Lesson.makeQuestions().length > 0, "lesson should have at least one question");
1313
}
1414
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* This source file was generated by the Gradle 'init' task
3+
*/
4+
package org.example;
5+
6+
import org.junit.jupiter.api.Test;
7+
import static org.junit.jupiter.api.Assertions.*;
8+
9+
class LessonTest {
10+
@Test void lessonHasQuestions() {
11+
assertNotNull(Lesson.makeQuestions(), "lesson should have questions");
12+
assertTrue(Lesson.makeQuestions().length > 0, "lesson should have at least one question");
13+
}
14+
}

lesson_02/quiz-java/settings.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ plugins {
33
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
44
}
55

6-
dependencyResolutionManagement {
7-
versionCatalogs {
8-
libs {
9-
from(files("gradle/libs.versions.toml"))
10-
}
11-
}
12-
}
13-
146
rootProject.name = 'codedifferently-instructional'
157

168

0 commit comments

Comments
 (0)