Ignore file order in test assertion (#1755)
This unit test asserts that a SHA file for a groovy dependency gets created. However, a SHA file for javaparser-core also gets created in the same directory. For some reason, builds were failing on my machine because `Files::list` was returning the javaparser-core file first. I don't believe there are any ordering guarantees with that API, so I relaxed the assertion to not depend on ordering. Signed-off-by: Andrew Ross <andrross@amazon.com>
This commit is contained in:
parent
ca27c8fd4f
commit
ca40ba9c64
|
@ -91,9 +91,10 @@ public class UpdateShasTaskTests extends GradleUnitTestCase {
|
|||
getLicensesDir(project).mkdir();
|
||||
task.updateShas();
|
||||
|
||||
Path groovySha = Files.list(getLicensesDir(project).toPath()).findFirst().get();
|
||||
|
||||
assertTrue(groovySha.toFile().getName().startsWith("groovy-"));
|
||||
assertTrue(
|
||||
"Expected a sha file to exist with a name prefix of 'groovy-",
|
||||
Files.list(getLicensesDir(project).toPath()).anyMatch(sha -> sha.toFile().getName().startsWith("groovy-"))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue