Skip to content

Add Maven + JUnit 5 tests and GitHub Actions CI - #10

Merged
cursor[bot] merged 1 commit into
masterfrom
cursor/maven-junit5-ci-7272
Sep 15, 2026
Merged

cursor[bot] merged 1 commit into
masterfrom
cursor/maven-junit5-ci-7272

Conversation

@xuzongbao

Copy link
Copy Markdown
Owner

Layout

Root pom.xml with:

  • main sources: encryption/src (existing elven.encryption / elven.test packages stay put)
  • test sources: src/test/java (outside the teaching tree so Maven does not compile JUnit as main code)

Teaching main demos are not moved into src/main/java. elven.test.test* classes still compile as part of main sources and can be run from the README javac / java commands.

JDK: Maven compile/test target is 17; GitHub Actions uses 21. Demos still run with javac on JDK 11+.

How to run tests

mvn test

CI (.github/workflows/ci.yml) runs mvn -B test on push/PR to master with Temurin JDK 21.

elven.test.test* are print-to-console mains. src/test/java/**/*Test.java are JUnit 5 assertions. Do not expect mvn test to execute the teaching mains.

Coverage

Util Positive Negative / extra
Base64Util UTF-8 round-trip, known vector null / invalid Base64
SHA256Util deterministic 32-byte digest + lowercase hex empty-string FIPS vector; null
HMACUtil verify true tampered data / MAC → false
AESUtil encrypt/decrypt; fresh IV each time tampered ciphertext / wrong key → AEADBadTagException
PBKDF2Util same password+salt → same AES key wrong password cannot decrypt AES-GCM
RSAUtil OAEP encrypt/decrypt; PSS sign/verify tampered ciphertext throws; tampered data/signature fail verify
DHUtil both sides same AES-128 secret + AES round-trip (DH param gen may take a few seconds)
ECDHUtil same secret + AES round-trip ECDSA verify true/false
DESUtil / DESede light round-trip only leftover teaching algorithms

No BouncyCastle. Crypto teaching defaults unchanged. target/ remains gitignored.

Open in Web Open in Cursor 

Keep teaching sources under encryption/src and point Maven
sourceDirectory there. Add JUnit 5 coverage for the main
utils, a JDK 21 mvn test workflow, and README updates.

Co-authored-by: Elven_xu <799835984@qq.com>
@xuzongbao
xuzongbao marked this pull request as ready for review September 15, 2026 10:00
@cursor
cursor Bot merged commit 0096762 into master Sep 15, 2026
1 check passed
@cursor
cursor Bot deleted the cursor/maven-junit5-ci-7272 branch September 15, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants