Title: Sapna Shankar Talke — R45-T004: Test an invariant of ThinLens (ThinLens.java) [src/main/java/com/thealgorithms/physics/ThinLens.java] · Issue #4 · S-AI-Projects/TheAlgorithms-Java · GitHub
Open Graph Title: Sapna Shankar Talke — R45-T004: Test an invariant of ThinLens (ThinLens.java) [src/main/java/com/thealgorithms/physics/ThinLens.java] · Issue #4 · S-AI-Projects/TheAlgorithms-Java
X Title: Sapna Shankar Talke — R45-T004: Test an invariant of ThinLens (ThinLens.java) [src/main/java/com/thealgorithms/physics/ThinLens.java] · Issue #4 · S-AI-Projects/TheAlgorithms-Java
Description: Student: Sapna Shankar Talke Task: R45-T004 · 4 of 10 Repository: https://github.com/S-AI-Projects/TheAlgorithms-Java Assigned working branch: student/e26b07f0703 Goal Work on src/main/java/com/thealgorithms/physics/ThinLens.java. Add a ...
Open Graph Description: Student: Sapna Shankar Talke Task: R45-T004 · 4 of 10 Repository: https://github.com/S-AI-Projects/TheAlgorithms-Java Assigned working branch: student/e26b07f0703 Goal Work on src/main/java/com/the...
X Description: Student: Sapna Shankar Talke Task: R45-T004 · 4 of 10 Repository: https://github.com/S-AI-Projects/TheAlgorithms-Java Assigned working branch: student/e26b07f0703 Goal Work on src/main/java/com/the...
Opengraph URL: https://github.com/S-AI-Projects/TheAlgorithms-Java/issues/4
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sapna Shankar Talke — R45-T004: Test an invariant of ThinLens (ThinLens.java) [src/main/java/com/thealgorithms/physics/ThinLens.java]","articleBody":"\u003c!-- sai-task-v1:R45-T004 -->\n\n## Student: Sapna Shankar Talke\n\n**Task:** R45-T004 · 4 of 10\n**Repository:** https://github.com/S-AI-Projects/TheAlgorithms-Java\n**Assigned working branch:** `student/e26b07f0703`\n\n## Goal\n\nWork on src/main/java/com/thealgorithms/physics/ThinLens.java. Add a property test around `ThinLens`: Preserve the documented output type, shape, ordering and input-mutation behavior; compare fresh equivalent inputs under controlled external state. Fixture: Use the smallest valid input and one ordinary input for `ThinLens` from src/main/java/com/thealgorithms/physics/ThinLens.java. Write the literal inputs and independently calculated expected outputs in the tests before editing the implementation. The check must name the source line establishing each precondition.\n\n## Steps\n\n1. Read src/main/java/com/thealgorithms/physics/ThinLens.java, especially `ThinLens` near line 23. Record its public inputs, result, mutation behavior and any external dependencies before changing it.\n2. Use the fixture to establish the invariant on understandable examples. Use the smallest valid input and one ordinary input for `ThinLens` from src/main/java/com/thealgorithms/physics/ThinLens.java. Write the literal inputs and independently calculated expected outputs in the tests before editing the implementation. The check must name the source line establishing each precondition.\n3. Generate at least 100 bounded valid cases with a fixed seed; restrict the generator to the actual input domain and retain a readable small case.\n4. Implement work/R45-T004/check.py as a focused runner that executes the new checks and propagates failures. Native check to incorporate: mvn test (JDK 21 as specified in pom.xml); use JUnit in the corresponding src/test/java package. Record the actual command and nonzero test count.\n5. Create the checks specified below and run `python3 work/R45-T004/check.py`. Save inputs, expected versus actual results and tool versions in work/R45-T004/; a check must exit non-zero when an assertion fails.\n6. Commit the repository change on branch R45-T004; prepare a PR to the organisation fork explaining the result and linking the checks. Keep each task independently reviewable. Remove work/R45-T004/ from a later upstream branch.\n\n## Done when\n\n☐ The checked behavior is tied to `ThinLens` in src/main/java/com/thealgorithms/physics/ThinLens.java; every assertion has an explicit expected value.\n☐ Use the smallest valid input and one ordinary input for `ThinLens` from src/main/java/com/thealgorithms/physics/ThinLens.java. Write the literal inputs and independently calculated expected outputs in the tests before editing the implementation. The check must name the source line establishing each precondition.\n☐ Existing supported behavior and the public interface are preserved unless a failing regression demonstrates and documents a defect.\n☐ The generator never relies on undefined input behavior; the invariant is justified in the PR.\n☐ The checks fail when the relevant invariant is deliberately broken in a temporary copy.\n\n\u003cdetails>\n\u003csummary>Additional task guidance\u003c/summary>\n\n\nAdditional curated task guidance\n\nItem:\nsrc/main/java/com/thealgorithms/physics/ThinLens.java\n\nTask type:\nInvariant/property checks\n\nCode change (goes into the PR):\nAdd invariant-based tests for src/main/java/com/thealgorithms/physics/ThinLens.java, with a deterministic seed and the smallest failing example; document the invariant next to the implementation.\n\nAutomated check:\npython3 work/R45-T004/check.py\n\nPrerequisites:\nJDK 21, Maven and Python 3.\n\nUpstream PR rules:\nFollow the Java style and Maven checks. The project does not accept standalone LeetCode problem additions; a new feature requires an upstream issue first. Submit coursework to the organisation fork first; keep work/ evidence out of any later upstream PR. Upstream acceptance is not a grading requirement. Policy: https://github.com/TheAlgorithms/Java/blob/6edd2d878947c7fb08a6f3286b316eca09fe9200/CONTRIBUTING.md\n\nSource (pinned):\nhttps://github.com/TheAlgorithms/Java/blob/6edd2d878947c7fb08a6f3286b316eca09fe9200/src/main/java/com/thealgorithms/physics/ThinLens.java#L23\n\nChange:\nReplaces the shared task template with an item-specific contribution brief.\n\nPR destination:\nUpstream candidate after review\n\n\n\u003c/details>\n\n## Submission checklist\n\n- [ ] Complete this task and its checks.\n- [ ] Add the required evidence and link your pull request here.\n- [ ] Select this **S-AI-Projects fork** as the PR base repository.\n- [ ] Request instructor review.\n\nKeep this PR focused on this task. Do not submit assignment PRs to the upstream repository.","author":{"url":"https://github.com/ankushbisht01","@type":"Person","name":"ankushbisht01"},"datePublished":"2026-11-03T22:46:48Z","url":"https://github.com/S-AI-Projects/TheAlgorithms-Java/issues/4"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7d8f73a0-373f-e212-a189-d12e0dc29f93 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E940:B6856:A922A5:ED8805:6AFDCD13 |
| html-safe-nonce | 47c9c874473c065f2f2597abcab64af8ec12928fa58cbfcc4ee720a67df1de44 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTQwOkI2ODU2OkE5MjJBNTpFRDg4MDU6NkFGRENEMTMiLCJ2aXNpdG9yX2lkIjoiMzUwMDI3NjI1ODI2OTk1NDc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8b1b3d432f21eb75b02f42a30996e46fbf9a1a73cf7a9cbb5c48138f1f1e1a2d |
| hovercard-subject-tag | issue:6192539913 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/S-AI-Projects/TheAlgorithms-Java/4/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fd67e002bb927d2238bd9ce63734c8a0f90041cc1855aa3ae24ffe5a924794be/S-AI-Projects/TheAlgorithms-Java/issues/4 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fd67e002bb927d2238bd9ce63734c8a0f90041cc1855aa3ae24ffe5a924794be/S-AI-Projects/TheAlgorithms-Java/issues/4 |
| og:image:alt | Student: Sapna Shankar Talke Task: R45-T004 · 4 of 10 Repository: https://github.com/S-AI-Projects/TheAlgorithms-Java Assigned working branch: student/e26b07f0703 Goal Work on src/main/java/com/the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ankushbisht01 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 26886a40b582b821a7a76351e0a2f42b6d6160854b6e2520db24f31fd7be5da7 |
| turbo-cache-control | no-preview |
| go-import | github.com/S-AI-Projects/TheAlgorithms-Java git https://github.com/S-AI-Projects/TheAlgorithms-Java.git |
| octolytics-dimension-user_id | 351892385 |
| octolytics-dimension-user_login | S-AI-Projects |
| octolytics-dimension-repository_id | 1444142392 |
| octolytics-dimension-repository_nwo | S-AI-Projects/TheAlgorithms-Java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 63477660 |
| octolytics-dimension-repository_parent_nwo | TheAlgorithms/Java |
| octolytics-dimension-repository_network_root_id | 63477660 |
| octolytics-dimension-repository_network_root_nwo | TheAlgorithms/Java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 68ebaa631a1d248d69ebde4b9c5defd3a19aeb2f |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width