KotlinCS 124 LogoJava

Index

MP3

MP2

MP1

MP0

Android Studio

Git

Course Activity

Learning Objectives
Learning Objectives

MP2 challenges you to complete a more complex set of tasks with less guidance. You’ll be expected to add a new activity to your application, designing its user interface and adding the required support in the API server and client. We’ll also include information about client-server interaction and the HTTP protocol.

Specifically, after completing MP2 you should be able to:

  1. Understand how a simple web server and client interact to exchange data
  2. Add a new activity to the user interface, complete its user interface, and launch it from the main activity
  3. Engage in test-driven development

Submission ID and Team
Submission ID and Team

Your submission ID and team should appear below.

Deadlines
Deadlines

All remaining MP checkpoints have two deadlines. We provide 10 points for getting started on the MP promptly and earning a certain number of points before the early deadline. For MP2, you must earn 40 points by the early deadline. The remainder of the MP is due a few days later.

For MP2 the deadlines are:

MP2 also has an extra credit deadline. If you submit a fully-completed MP2 by this date, you will earn a 105 / 100.

Note that the extra credit deadline is designed to encourage some students to finish early and leave more time for staff to support the rest. As such, we will not provide additional support around the extra credit deadline.

Objectives, Testing, and Grading
Objectives, Testing, and Grading

You will receive the MP2 test suites via email. You will also need to install an updated helper file, which you will also receive via email.

Kotlin
Kotlin

If you are using Kotlin, move MP2Test.kt to the app/src/test/kotlin/edu/illinois/cs/cs124/ay2023/mp/test/ directory in your machine project. Move CoursesReadCountSecurityManager.kt to the app/src/test/kotlin/edu/illinois/cs/cs124/ay2023/mp/test/helpers directory in your machine project. Note that this will overwrite an existing file.

Java
Java

If you are using Java, move MP2Test.java to the app/src/test/java/edu/illinois/cs/cs124/ay2023/mp/test/ directory in your machine project. Move CoursesReadCountSecurityManager.java to the app/src/test/java/edu/illinois/cs/cs124/ay2023/mp/test/helpers directory in your machine project. Note that this will overwrite an existing file.

Reconfiguration
Reconfiguration

Next, you’ll want to reconfigure grade.yaml in the root directory of your project to request that we grade MP2. Note that, like MP1, your app will not compile after installing the test suites. There are a few things you need to add to get it to compile. These steps are covered on the first MP2 lesson.

Objectives
Objectives

To complete MP2 you’ll add a new activity to your app that will display course details. This will require adding a new route to your API server to deliver course details to your app, support in your API client for using that route, modifications to the MainActivity to launch your new activity, and completing the UI for the new activity so that it displays course details.

Testing
Testing

We have provided five test cases to guide your development. test0_CourseClassDesign tests the design of your new Course class that holds additional course information. test1_ServerCourseRoute and test2_ClientGetCourse test that your API server and client work properly to deliver detailed course information to your app. test3_SummaryClickLaunch and test4_CourseView test that your new activity works properly, including being launched from the main activity and displaying course details. You will probably want to complete the tests in order.

Grading
Grading

Grading for MP2 is broken down as follows:

You can estimate your grade at any time by using the Grade task available in Android Studio. This is an estimate, not an official score.

Submitting
Submitting

You submit MP2 by pushing to GitHub, in the same way that you did for MP1 and MP0. However, make sure that you have configured grade.yaml before pushing. We grade the checkpoint you have configured in grade.yaml. So make sure that is set up to grade MP2 once you are ready.

Cheating
Cheating

Please review the CS 124 policies on collaboration.

All submitted code will be checked for cheating. Cheaters will receive stiff penalties. Hard-working students who are struggling honestly for their grade demand it.

Original Test Suites
Original Test Suites

If you need to restore the original test suites, please download them below:

Clarifications
Clarifications

Server Method and Field Visibility
Server Method and Field Visibility

You will need to add methods to your Server class to complete MP2, and in general you are free to modify that code as needed to complete the remaining MP checkpoints.

However, any new methods or fields you add to the Server class must be private. This is checked when the MP2 test suites start up, and unfortunately a failure results in a rather cryptic and unhelpful error message:

java.lang.NullPointerException: Cannot invoke "org.robolectric.internal.TestEnvironment.resetState()" because the return value of "org.robolectric.RobolectricTestRunner$RobolectricFrameworkMethod.getTestEnvironment()" is null
at org.robolectric.RobolectricTestRunner.lambda$finallyAfterTest$0(RobolectricTestRunner.java:370)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:86)
at org.robolectric.RobolectricTestRunner.finallyAfterTest(RobolectricTestRunner.java:368)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:298)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:101)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

Scores
Scores

You can view your official MP2 scores below.