From 054d5163d0a733baf6a8de340b32f19c1f65ae25 Mon Sep 17 00:00:00 2001 From: "Anthony D. Mays" Date: Thu, 29 Feb 2024 11:45:55 -0500 Subject: [PATCH] feat: adds additional questions Signed-off-by: Anthony D. Mays --- .../org.eclipse.buildship.core.prefs | 10 +++---- lesson_02/quiz/lesson_02_quiz/.classpath | 6 ---- .../.settings/org.eclipse.jdt.core.prefs | 16 +++++------ .../com/codedifferently/lesson2/Lesson2.java | 28 ++++++++++++++++++- .../codedifferently/lesson2/Lesson2Test.java | 2 +- .../src/test/resources/application.yml | 4 ++- .../org.eclipse.buildship.core.prefs | 2 +- .../instructional-lib/.classpath | 15 +--------- .../org.eclipse.buildship.core.prefs | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 16 +++++------ 10 files changed, 55 insertions(+), 46 deletions(-) diff --git a/lesson_02/quiz/.settings/org.eclipse.buildship.core.prefs b/lesson_02/quiz/.settings/org.eclipse.buildship.core.prefs index e4795584..56ae655f 100644 --- a/lesson_02/quiz/.settings/org.eclipse.buildship.core.prefs +++ b/lesson_02/quiz/.settings/org.eclipse.buildship.core.prefs @@ -1,13 +1,13 @@ -arguments= +arguments=--init-script /Users/anthonymays/.local/share/nvim/mason/packages/jdtls/config_mac/org.eclipse.osgi/54/0/.cp/gradle/init/init.gradle auto.sync=false build.scans.enabled=false connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) connection.project.dir= eclipse.preferences.version=1 gradle.user.home= -java.home= +java.home=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home jvm.arguments= offline.mode=false -override.workspace.settings=false -show.console.view=false -show.executions.view=false +override.workspace.settings=true +show.console.view=true +show.executions.view=true diff --git a/lesson_02/quiz/lesson_02_quiz/.classpath b/lesson_02/quiz/lesson_02_quiz/.classpath index 31e14eb8..c1b6284e 100644 --- a/lesson_02/quiz/lesson_02_quiz/.classpath +++ b/lesson_02/quiz/lesson_02_quiz/.classpath @@ -14,12 +14,6 @@ - - - - - - diff --git a/lesson_02/quiz/lesson_02_quiz/.settings/org.eclipse.jdt.core.prefs b/lesson_02/quiz/lesson_02_quiz/.settings/org.eclipse.jdt.core.prefs index ee08bb14..be44e1b7 100644 --- a/lesson_02/quiz/lesson_02_quiz/.settings/org.eclipse.jdt.core.prefs +++ b/lesson_02/quiz/lesson_02_quiz/.settings/org.eclipse.jdt.core.prefs @@ -1,10 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=ignore org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve @@ -14,9 +14,9 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.source=17 diff --git a/lesson_02/quiz/lesson_02_quiz/src/main/java/com/codedifferently/lesson2/Lesson2.java b/lesson_02/quiz/lesson_02_quiz/src/main/java/com/codedifferently/lesson2/Lesson2.java index fa4abc52..cbe4a24f 100644 --- a/lesson_02/quiz/lesson_02_quiz/src/main/java/com/codedifferently/lesson2/Lesson2.java +++ b/lesson_02/quiz/lesson_02_quiz/src/main/java/com/codedifferently/lesson2/Lesson2.java @@ -38,7 +38,9 @@ public static List makeQuizQuestions() { makeQuestion5(), makeQuestion6(), makeQuestion7(), - makeQuestion8()); + makeQuestion8(), + makeQuestion9(), + makeQuestion10()); } private static QuizQuestion makeQuestion0() { @@ -133,4 +135,28 @@ private static QuizQuestion makeQuestion8() { "What is binary number 0b01100101 in decimal?", "0"); // Specify the correct number (no leading zeros). } + + private static QuizQuestion makeQuestion9() { + return new MultipleChoiceQuizQuestion( + 9, + "What git command can you use to create a new branch?", + Map.of( + AnswerChoice.A, "git checkout ", + AnswerChoice.B, "git pull ", + AnswerChoice.C, "git checkout -b ", + AnswerChoice.D, "git push "), + AnswerChoice.UNANSWERED); // Replace `UNANSWERED` with the correct answer. + } + + private static QuizQuestion makeQuestion10() { + return new MultipleChoiceQuizQuestion( + 10, + "What is the difference between a fork and a branch in git?", + Map.of( + AnswerChoice.A, "You cannot push changes to a fork", + AnswerChoice.B, "There is no difference since everything is a branch to git", + AnswerChoice.C, "A fork requires an upstream remote whereas a branch does not", + AnswerChoice.D, "You can only make pull requests using a branch"), + AnswerChoice.UNANSWERED); // Replace `UNANSWERED` with the correct answer. + } } diff --git a/lesson_02/quiz/lesson_02_quiz/src/test/java/com/codedifferently/lesson2/Lesson2Test.java b/lesson_02/quiz/lesson_02_quiz/src/test/java/com/codedifferently/lesson2/Lesson2Test.java index d08fd5a6..36675bb1 100644 --- a/lesson_02/quiz/lesson_02_quiz/src/test/java/com/codedifferently/lesson2/Lesson2Test.java +++ b/lesson_02/quiz/lesson_02_quiz/src/test/java/com/codedifferently/lesson2/Lesson2Test.java @@ -30,7 +30,7 @@ class Lesson2Test { private SoftAssertions softly; - private final int EXPECTED_NUMBER_OF_QUESTIONS = 9; + private final int EXPECTED_NUMBER_OF_QUESTIONS = 11; @BeforeEach void setUp() { diff --git a/lesson_02/quiz/lesson_02_quiz/src/test/resources/application.yml b/lesson_02/quiz/lesson_02_quiz/src/test/resources/application.yml index 0e6305be..fae42c4e 100644 --- a/lesson_02/quiz/lesson_02_quiz/src/test/resources/application.yml +++ b/lesson_02/quiz/lesson_02_quiz/src/test/resources/application.yml @@ -8,4 +8,6 @@ quiz: - $2y$10$iFn9/MgkxivuY52mbO5fUem7qYXIG8ryHcVbcUOPUZDNoe0jGTNPC - $2y$10$lGfYCXq82al27tWZduYk.u.oUjte1kFysDQvCzX0QmszeTPpmXRJ2 - $2y$10$VlCST/6T58aTDJtrKq/Ljeo.djaR0pEfzVoz3EWW3D0deWQeKWZQC - - $2y$10$hNogDMb01UduWT456XvCuuD4L9EDO2AJ0ACDFPueFJwl6aoIIlsQy \ No newline at end of file + - $2y$10$hNogDMb01UduWT456XvCuuD4L9EDO2AJ0ACDFPueFJwl6aoIIlsQy + - $2y$10$A41j.FhPLNTGbRlUttKrkeTfWHZ/PTITUPaYzEHd3nBs8FNmcwPB6 + - $2y$10$WBf0gBTv264RQ0ON/vS69.iJUESdsnwCUNRPKNn.I67vGv0hY9jWK diff --git a/lib/java/codedifferently-instructional/.settings/org.eclipse.buildship.core.prefs b/lib/java/codedifferently-instructional/.settings/org.eclipse.buildship.core.prefs index d8849818..008f350a 100644 --- a/lib/java/codedifferently-instructional/.settings/org.eclipse.buildship.core.prefs +++ b/lib/java/codedifferently-instructional/.settings/org.eclipse.buildship.core.prefs @@ -2,7 +2,7 @@ arguments=--init-script /home/vscode/.vscode-server/data/User/globalStorage/redh auto.sync=true build.scans.enabled=false connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir= +connection.project.dir=../../../lesson_02/quiz eclipse.preferences.version=1 gradle.user.home= java.home=/usr/local/sdkman/candidates/java/current diff --git a/lib/java/codedifferently-instructional/instructional-lib/.classpath b/lib/java/codedifferently-instructional/instructional-lib/.classpath index e70de6d5..187fe762 100644 --- a/lib/java/codedifferently-instructional/instructional-lib/.classpath +++ b/lib/java/codedifferently-instructional/instructional-lib/.classpath @@ -13,20 +13,7 @@ - - - - - - - - - - - - - - + diff --git a/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.buildship.core.prefs b/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.buildship.core.prefs index b1886adb..3347e5c2 100644 --- a/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.buildship.core.prefs +++ b/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.buildship.core.prefs @@ -1,2 +1,2 @@ -connection.project.dir=.. +connection.project.dir=../../../../lesson_02/quiz eclipse.preferences.version=1 diff --git a/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.jdt.core.prefs b/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.jdt.core.prefs index 66ec0063..7726726d 100644 --- a/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.jdt.core.prefs +++ b/lib/java/codedifferently-instructional/instructional-lib/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,9 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve @@ -13,9 +13,9 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.source=17