Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.95 KB

File metadata and controls

65 lines (45 loc) · 1.95 KB

observer-java-junit5

Optional JUnit 5 bridge for the Observer Java SDK.

This module exists for teams that already have JUnit 5 test classes and want to export them through Observer without rewriting everything into the core Observer.* DSL on day one.

The bridge is intentionally narrow and deterministic:

  • it collects ordinary zero-argument @Test methods
  • it runs @BeforeEach and @AfterEach around each exported method target
  • it derives exported ids from fully.qualified.ClassName#methodName
  • it only changes the exported id when you opt into @ObserverId
  • it treats @DisplayName as authored title sugar rather than the exported target contract

That gives Java teams a natural adoption path while keeping Observer's deterministic boundary explicit.

Usage

import io.frogfish.observer.junit5.ObserverJunit5;

var tests = ObserverJunit5.collectTests(LedgerTests.class);
hostMain("java", tests, args);
import io.frogfish.observer.junit5.ObserverId;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

final class LedgerTests {
    @Test
    @DisplayName("smoke")
    @ObserverId("app::smoke")
    void smoke() {
        System.out.print("consumer ok\n");
    }
}

Build Files

  • pom.xml: publish-ready Maven metadata for the bridge artifact
  • build.gradle: publish-ready Gradle metadata for the bridge artifact
  • Makefile: repo-local compile and self-test flow using plain javac

Repo Validation

Inside this repository the bridge is validated without installing JUnit itself.

The self-test compiles tiny annotation stubs under the real org.junit.jupiter.api package names and exercises the bridge behavior with plain javac.

Run it with:

cd lib/java-junit5
make test

External Consumer Examples

See:

  • ../../examples/java-consumer-maven/ for a Maven-shaped core Java consumer
  • ../../examples/java-consumer-gradle/ for a Gradle-shaped Java consumer using this JUnit 5 bridge