Skip to content

Assertions with contains should fail when jfrEvents.events is empty #210

@FBibonne

Description

@FBibonne

Given a test case where no enabled event is recorded, for example :

    @Test
    @EnableEvent(FileRead.EVENT_NAME)
    void shouldFailBecauseNoFileIsRead() {
       // method to test which does not read file 
       produtionCode.doNotUseIO();
        jfrEvents.awaitEvents();
        assertThat(jfrEvents).contains(FileRead.INSTANCE);
    }

This test should fail because the method doNotUseIO in main code does not read any file so no FileRead event is recorded : the contains method should throw an AssertionError. But it does not in this case because jfrEvents.events : no event at all is recorded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions