Skip to content

generatesFiles() reports incorrect message if file is present but content doesn't match #182

Open

Description

@ZacSweers

If a matching file is found but the content just doesn't match, generatesFiles() will report that no matching file was found. While maybe technically correct if "matching" in this case includes the content, it's misleading in practice since the target file name was found and the content mismatch is the interesting bit.

Activity

  1. netdpb commented on May 24, 2021

    @netdpb
    Member

    Have you tried using the newer API? Instead of

    assertThat(source1, source2).compilesWithoutWarnings().and().generatesFiles(expected1, expected2);

    try

    Compilation compilation = javac().compile(source1, source2);
    assertThat(compilation).generatedFile(SOURCE_OUTPUT, "path/to/file").contentsAsUtfString().isEqualTo(expected);

    (or one of the other APIs to check the contents of the files).

  2. self-assigned this
    on May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3type=defectBug, not working as expected

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions