"Simon says..." is a speech-like fluent Assertion utility for Java.
Find a file
2026-08-10 12:08:32 +09:00
.idea Update IDE configuration: set languageLevel to JDK_21, add simon module definitions 2026-08-10 11:33:23 +09:00
build-logic Initialize project structure with core modules, build configurations, and assertion implementations. 2026-07-15 10:24:36 +09:00
example 1.4.0: Add epsilon-based shouldBe and shouldNotBe methods in NumberAssertion, update application mainClass, bump JDK to 25, upgrade dependencies, refine build logic, and increment version. 2026-08-10 11:23:16 +09:00
gradle 1.4.0: Add epsilon-based shouldBe and shouldNotBe methods in NumberAssertion, update application mainClass, bump JDK to 25, upgrade dependencies, refine build logic, and increment version. 2026-08-10 11:23:16 +09:00
simon 1.4.1: Add float-epsilon-based shouldBe and shouldNotBe methods in NumberAssertion, update version to 1.4.1 2026-08-10 12:08:32 +09:00
.gitattributes Initialize project structure with core modules, build configurations, and assertion implementations. 2026-07-15 10:24:36 +09:00
.gitignore Initialize project structure with core modules, build configurations, and assertion implementations. 2026-07-15 10:24:36 +09:00
build.gradle.kts 1.4.1: Add float-epsilon-based shouldBe and shouldNotBe methods in NumberAssertion, update version to 1.4.1 2026-08-10 12:08:32 +09:00
gradle.properties Initialize project structure with core modules, build configurations, and assertion implementations. 2026-07-15 10:24:36 +09:00
gradlew Initialize project structure with core modules, build configurations, and assertion implementations. 2026-07-15 10:24:36 +09:00
gradlew.bat Initialize project structure with core modules, build configurations, and assertion implementations. 2026-07-15 10:24:36 +09:00
LICENSE Add Apache 2.0 license, upgrade dependencies, and refactor code for PrimitiveArrays integration. 2026-07-17 09:08:21 +09:00
README.md 1.3.5: Update ArrayAssertion 2026-07-23 23:44:39 +09:00
REQUIREMENTS.md Initialize project structure with core modules, build configurations, and assertion implementations. 2026-07-15 10:24:36 +09:00
settings.gradle.kts 1.4.0: Add epsilon-based shouldBe and shouldNotBe methods in NumberAssertion, update application mainClass, bump JDK to 25, upgrade dependencies, refine build logic, and increment version. 2026-08-10 11:23:16 +09:00
simon-says-2.png 1.3.5: Update ArrayAssertion 2026-07-23 23:44:39 +09:00
simon-says.png Remove AbstractVerificationMode and Util classes, refine multi-target assertions with alsoSays, enhance SoftVerificationMode verbosity toggle, update Simon methods to support explicit modes, improve localization, and increment version to 1.3.0. 2026-07-21 14:19:21 +09:00

Simon Says

Simon Says는 Java를 위한 직관적이고 읽기 쉬운 Fluent Assertion 라이브러리입니다. "Simon Says" 게임처럼, Simon이 말하는 규칙을 객체가 잘 따르고 있는지 재미있고 명확하게 검증할 수 있습니다.

SIMON SAYS

주요 특징

  • Fluent API: 자연어에 가까운 문장 흐름으로 테스트 코드를 작성할 수 있습니다.
  • 상세한 에러 리포트: 실패 시 박스 형태의 가독성 높은 테이블로 규칙, 기대값, 실제값, 그리고 실패 위치를 보여줍니다.
  • 다국어 지원: 한국어와 영어를 지원하며, 시스템 설정에 따라 적절한 메시지를 출력합니다.
  • Soft Assertion: 여러 검증을 한 번에 수행하고 마지막에 모든 실패 내역을 모아서 보고할 수 있습니다.
  • 다양한 타입 지원: 기본 타입, 컬렉션, 맵, 배열, 파일 경로(Path), 예외(Throwable), 날짜/시간(java.time) 등을 지원합니다.

설치 방법 (Gradle)

build.gradle 파일에 다음 의존성을 추가하세요:

repositories {
    maven {
        name = "Elex Repository"
        url = "https://artifacts.elex-project.com/repository/maven/"
    }
}
dependencies {
    testImplementation("com.elex-project:simon-says:1.3.5")
}

사용법

1. 기본 검증 (Strict Mode)

Simon.says() 메서드를 통해 즉시 예외를 발생시키는 엄격한 검증을 시작할 수 있습니다.

import static com.elex_project.simon.Simon.says;

// 문자열 검증
says("Hello, World!")
    .shouldNotBeBlank()
    .shouldStartWith("Hello")
    .shouldContain("World");

// 숫자 검증
says(42)
    .shouldBeGreaterThan(40)
    .shouldBeLessThanOrEqualTo(50)
    .shouldBeBetween(10, 100);

// 예외 검증
says(() -> {
    throw new IllegalArgumentException("Invalid input");
}).shouldThrow(IllegalArgumentException.class)
  .withMessageContaining("Invalid");

2. 문장 연결 (and, alsoSays)

하나의 객체에 대해 여러 검증을 이어가거나, 다른 객체에 대한 검증을 연속해서 수행할 수 있습니다.

says("Simon")
    .shouldHaveLength(5)
    .and() // 가독성을 위한 연결 어미
    .shouldStartWith("S")
    .alsoSays(123) // 다른 객체 검증 시작
    .shouldBePositive();

3. Simone Mode (Soft Assertion)

Simone 클래스를 사용하면 여러 검증 중 하나가 실패해도 멈추지 않고 끝까지 수행한 뒤, 마지막에 모든 실패 내역을 보고합니다.

import com.elex_project.simon.Simone;

Simone simone = new Simone();

simone.says("Apple").shouldBe("Banana"); // 실패하지만 계속 진행
simone.says(10).shouldBeZero();          // 실패하지만 계속 진행
simone.says(true).shouldBeTrue();       // 성공

// 마지막에 누적된 모든 실패를 리포트
simone.reportAll(); 

실패 리포트 예시

검증 실패 시 다음과 같이 명확한 테이블 형태로 출력됩니다:

┌────────────────────────────────────────────────────────────────────────────┐
│ [Rule] String should be equal to                                           │
├──────────┬─────────────────────────────────────────────────────────────────┤
│ Expected │ "Banana"                                                        │
├──────────┼─────────────────────────────────────────────────────────────────┤
│ Actual   │ "Apple"                                                         │
├──────────┼─────────────────────────────────────────────────────────────────┤
│ Location │ com.example.MyTest.myTestMethod(MyTest.java:42)                 │
└──────────┴─────────────────────────────────────────────────────────────────┘

Copyright © 2026 Elex Project. All rights reserved.

https://www.elex-project.com/