Milestone 1: 1 — Project Scaffolding, Core Email Slicing Logic, and Build Pipeline#45
Open
mcode-app-dev[bot] wants to merge 5 commits into
Open
Conversation
added 5 commits
March 20, 2026 17:34
Include patterns for Maven build output, compiled classes, IDE files, and Python testing artifacts to prevent committing generated files.
Set up Maven build with Java 17 compiler, JUnit 5 dependency, maven-jar-plugin for executable JAR, and Maven Wrapper (3.9.6) for self-contained builds.
Add four source files migrated from emailSlicer.py: - EmailSlicerResult: Java 17 record for username/domain pair - EmailSlicer: pure parsing logic splitting on first '@' - Messages: centralized user-facing string constants - Main: console I/O shell matching Python original output format
Cover valid emails (simple, dots, subdomains), whitespace stripping,
multiple '@' signs (Python-compatible split on first '@'), missing '@',
null/empty/blank inputs, and edge cases ('@' at start/end/only).
13 test cases using @ParameterizedTest and @CsvSource.
Replace Python-specific content with Java build/run/test instructions, project structure, and Maven Wrapper usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View Milestone
Table of Contents
Status
The milestone was successfully completed. All goals specified in the Milestone Instructions — Maven project scaffolding, core email-slicing logic, console I/O, centralized messages, and JUnit 5 unit tests — have been implemented. The build produces an executable JAR and all tests pass.
One intentional deviation from the Modernization Instructions: The Modernization Instructions specify that inputs like
"@","@domain", and"user@"should be rejected as invalid. However, the Milestone Instructions explicitly require matching the Python original's behavior in this milestone (split on first@; only reject inputs lacking@entirely). The current implementation follows the Milestone Instructions, deferring stricter regex-based validation to Milestone 2.Feature Overview
This milestone migrates the Python Email Slicer (
emailSlicer.py) to an idiomatic Java 17 console application. The user can:./mvnw packagejava -jar target/email-slicer.jarTesting
Automated Testing
EmailSlicerTest.javacontains 11 test cases (via JUnit 5 parameterized and standard tests) covering:avimax37@gmail.com,first.last@example.org,user@mail.example.co.uk" user@test.com "@signs"a@b@c.com"— splits on first@, matching Python@"invalidemail.com","justtext"null,""," ""@domain.com","user@","@"Run with:
./mvnw testManual Testing
./mvnw packagejava -jar target/email-slicer.jaravimax37@gmail.comat the promptinvalidemail.com— expected output:Please enter a valid Email Id.Architecture
Overview
graph TD subgraph Legend L1[Modified] L2[New] end subgraph "Console Application" MAIN["Main.java\n(Console I/O Entry Point)"] MSGS["Messages.java\n(User-facing Strings)"] end subgraph "Core Logic" SLICER["EmailSlicer.java\n(Parsing Logic)"] RESULT["EmailSlicerResult.java\n(Result Record)"] end subgraph "Build System" POM["pom.xml + Maven Wrapper\n(Build Pipeline)"] end MAIN --> SLICER MAIN --> MSGS SLICER --> RESULT POM --> MAIN style L1 fill:#ffff00,color:#000 style L2 fill:#00cc00,color:#000 style MAIN fill:#00cc00,color:#000 style MSGS fill:#00cc00,color:#000 style SLICER fill:#00cc00,color:#000 style RESULT fill:#00cc00,color:#000 style POM fill:#00cc00,color:#000Changes
Build System (
pom.xml,mvnw,.mvn/)pom.xmlwith Java 17 compiler settings, JUnit 5.10.2 test dependency, and three plugins:maven-compiler-plugin,maven-surefire-plugin,maven-jar-pluginmaven-jar-pluginconfigured withcom.emailslicer.Mainas the main class, producingtarget/email-slicer.jarmvnw/mvnw.cmd/.mvn/wrapper/maven-wrapper.properties) checked in for zero-install builds.gitignoreadded for Java/Maven/IDE artifactsCore Logic (
EmailSlicer.java,EmailSlicerResult.java)EmailSlicer— final utility class with a single static methodslice(String): Optional<EmailSlicerResult>. Strips whitespace, splits on the first@viaindexOf, and returnsOptional.empty()for null/blank/missing-@inputs. No I/O side effects.EmailSlicerResult— Java 17recordwith two components (username,domain), providing immutable value semantics with auto-generatedequals(),hashCode(),toString().Console Application (
Main.java,Messages.java)Main— thin I/O shell that prints a prompt, reads one line viaScanner, delegates toEmailSlicer.slice(), and prints the result or an error. Mirrors the Python script's top-level flow.Messages— final constants class centralizing all user-facing strings (PROMPT_EMAIL,USERNAME_PREFIX,DOMAIN_PREFIX,INVALID_EMAIL). Output strings match the Python original exactly.Documentation (
README.md)Design Decisions
Hand-crafted minimal POM over archetype generation — The project has only four source files. A generated archetype would introduce unnecessary boilerplate. The hand-crafted
pom.xmlcontains exactly three plugins and one test dependency, keeping configuration minimal and auditable.Separation of I/O from parsing logic — The Python script mixes
input()/print()with@-splitting in a single file. The Java version separatesMain(I/O) fromEmailSlicer(pure logic), making the parsing function independently testable without system-in/system-out capture.Java 17
recordfor result type —EmailSlicerResultis defined as arecordrather than a POJO, leveraging Java 17's concise syntax for immutable data carriers. This eliminates boilerplate while providing correctequals()/hashCode()semantics.Optionalreturn type over null —EmailSlicer.slice()returnsOptional<EmailSlicerResult>to explicitly represent invalid input at the type level, avoiding null-pointer errors and making the API self-documenting.Centralized
Messagesclass — All user-facing strings are extracted intoMessages.javaconstants, following the project's error handling guidelines and enabling Milestone 2 to add validation messages without scattering strings across classes.Suggested Order of Review
pom.xml— Build configuration, dependencies, plugins; establishes the project foundationsrc/main/java/com/emailslicer/EmailSlicerResult.java— Therecordtype; simplest file, introduces the data modelsrc/main/java/com/emailslicer/EmailSlicer.java— Core parsing logic; consumes the result recordsrc/main/java/com/emailslicer/Messages.java— String constants used byMainsrc/main/java/com/emailslicer/Main.java— Console entry point; ties togetherEmailSlicerandMessagessrc/test/java/com/emailslicer/EmailSlicerTest.java— Unit tests validating the core logicREADME.md— Updated documentation.gitignore— Housekeeping