MCPcopy Index your code
hub / github.com/dmcg/okey-doke

github.com/dmcg/okey-doke @okeydoke-2.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release okeydoke-2.0.3 ↗ · + Follow
477 symbols 1,306 edges 95 files 18 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Download

okey-doke

An Approval Testing library for Java and JUnit - like Llewellyn Falco's but more Java'y.

A helping hand for many testing problems.

Version 2

If you are upgrading from verions 1.x to version 2.x - JUnit 4 support has been moved from com.oneeyedmen.junit to com.oneeyedmen.junit4.

In return, you no longer need to specify whether your are using Java or Kotlin

JUnit 5

public class ApprovalsExtensionTest {

    // Initialise okey-doke.
    @RegisterExtension ApprovalsExtension approvals = new ApprovalsExtension();
        // See other constructors to change where the files are stored,
        // or change the extension

    @Test
    public void something_that_we_want_to_be_the_same_next_time(
            Approver approver // approver will be injected
    ) {
        Object result = doSomeCalculation(42, "banana");
        approver.assertApproved(result); // check that the result is as approved
    }
}

The first time you run this test it will fail, but the result of doSomeCalculation will be written into a file next to the test, named ApprovalsExtensionTest.something_that_we_want_to_be_the_same_next_time.actual

You can look at this file to check that it is what you expect, and if it is, approve the test by renaming the file it to ApprovalsExtensionTest.something_that_we_want_to_be_the_same_next_time.approved (or ask the plugin to do it for you).

From then on the test will pass provided the result of doSomeCalculation doesn't change. If it does change then you can either fix the code if it shouldn't have, or approve the new version.

IntelliJ

There is an IntelliJ plugin (thanks @s4nchez) to help approve your output.

JUnit 4

We still support JUnit 4 with a Rule - ApprovalsRuleTest

    @Rule public final ApprovalsRule approver = ApprovalsRule.usualRule();

    @Test
    public void something_that_we_want_to_be_the_same_next_time(
    ) {
        Object result = doSomeCalculation(42, "banana");
        approver.assertApproved(result); // check that the result is as approved
    }

Here you can use the ApprovalsRule as a approver.

Extension points exported contracts — how you extend this code

Formatter (Interface)
Formats things of type T to things of type C (for comparison). Note that as the format conversion is only applied one w [3 …
src/main/java/com/oneeyedmen/okeydoke/Formatter.java
Checker (Interface)
(no doc) [4 implementers]
src/main/java/com/oneeyedmen/okeydoke/Checker.java
Transcript (Interface)
The transcript provides a way to write text into the approved output. [2 implementers]
src/main/java/com/oneeyedmen/okeydoke/Transcript.java
ApproverFactory (Interface)
(no doc) [3 implementers]
src/main/java/com/oneeyedmen/okeydoke/ApproverFactory.java
Reporter (Interface)
(no doc) [3 implementers]
src/main/java/com/oneeyedmen/okeydoke/Reporter.java

Core symbols most depended-on inside this repo

assertEquals
called by 51
src/main/java/com/oneeyedmen/okeydoke/Checker.java
assertApproved
called by 43
src/main/java/com/oneeyedmen/okeydoke/BaseApprover.java
exists
called by 34
src/main/java/com/oneeyedmen/okeydoke/Resource.java
append
called by 24
src/main/java/com/oneeyedmen/okeydoke/Transcript.java
asList
called by 22
src/main/java/com/oneeyedmen/okeydoke/util/Tabulator.java
approvedFor
called by 15
src/main/java/com/oneeyedmen/okeydoke/SourceOfApproval.java
actualFor
called by 14
src/main/java/com/oneeyedmen/okeydoke/SourceOfApproval.java
makeApproved
called by 13
src/main/java/com/oneeyedmen/okeydoke/BaseApprover.java

Shape

Method 377
Class 87
Interface 10
Enum 3

Languages

Java100%

Modules by API surface

src/main/java/com/oneeyedmen/okeydoke/util/Tabulator.java19 symbols
src/main/java/com/oneeyedmen/okeydoke/junit4/TheoryApprovalsRule.java14 symbols
src/main/java/com/oneeyedmen/okeydoke/junit4/BaseApprovalsRule.java14 symbols
src/main/java/com/oneeyedmen/okeydoke/sources/FileSystemSourceOfApproval.java13 symbols
src/main/java/com/oneeyedmen/okeydoke/BaseApprover.java13 symbols
src/main/java/com/oneeyedmen/okeydoke/util/TestDirectory.java12 symbols
src/main/java/com/oneeyedmen/okeydoke/junit5/ApprovalsExtension.java11 symbols
src/test/java/com/oneeyedmen/okeydoke/util/TabulatorTest.java10 symbols
src/main/java/com/oneeyedmen/okeydoke/sources/FileResource.java10 symbols
src/test/java/com/oneeyedmen/okeydoke/junit4/StandardTestNamerTest.java9 symbols
src/test/java/com/oneeyedmen/okeydoke/formatters/TableFormatterTest.java9 symbols
src/main/java/com/oneeyedmen/okeydoke/internal/OperatingSystem.java9 symbols

For agents

$ claude mcp add okey-doke \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page