src/test/java/com/stijndepestel/geminio/CaptureTest.java
/**
     * Test to see if persister is provided with all events.
     */
Test to see if persister is provided with all events.
Test to see if persister is provided with all events .
@Test
    public void persisterGetsJSONOfAllEvents() {
        final int numberOfEventsToGenerate = 5;
        this.capture = new Capture<>(TestHelper::serialize, x -> {
            final JSONArray jsonArray = x.getJSONArray(JSONNames.JSON_EVENTS);
            Assert.assertEquals(
                    "Same number of events should be stored as the number of events that were thrown.",
                    numberOfEventsToGenerate, jsonArray.length());
        });
        this.capture.startCapture();
        for (int i = 0; i < numberOfEventsToGenerate; i++) {
            this.capture.capture(new TestEvent());
        }
        this.capture.stopCapture();
        this.capture.saveEvents();
    }
@ Test public void persisterGetsJSONOfAllEvents ( ) { final int numberOfEventsToGenerate = 5 ; this . capture = new Capture < > ( TestHelper :: serialize , x -> { final JSONArray jsonArray = x . getJSONArray ( JSONNames . JSON_EVENTS ) ; Assert . assertEquals ( "Same number of events should be stored as the number of events that were thrown." , numberOfEventsToGenerate , jsonArray . length ( ) ) ; } ) ; this . capture . startCapture ( ) ; for ( int i = 0 ; i < numberOfEventsToGenerate ; i ++ ) { this . capture . capture ( new TestEvent ( ) ) ; } this . capture . stopCapture ( ) ; this . capture . saveEvents ( ) ; }
Test to see if persister is provided with all events.
Test to see if persister is provided with all events .