Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions jablib/src/test/java/org/jabref/logic/util/io/FileHistoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ void getFileAtTest() {
history.newFile(Path.of("cc"));
assertEquals(Path.of("bb"), history.get(1));
}

@Test
void oldestEntryIsDroppedWhenSizeExceedsLimit() {
for (int i = 1; i <= 8; i++) {
history.newFile(Path.of("file" + i));
}
assertEquals(8, history.size());

history.newFile(Path.of("file9"));

assertEquals(8, history.size());
assertEquals(Path.of("file9"), history.get(0));
assertFalse(history.contains(Path.of("file1")));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Weak contains() assertion 📘 Rule violation ≡ Correctness

The new test uses assertFalse(history.contains(...)), which is a weak predicate check and does not
assert the exact expected history contents. This can miss regressions where the list content/order
is wrong but still does not contain that one element.
Agent Prompt
## Issue description
`oldestEntryIsDroppedWhenSizeExceedsLimit()` uses a weak predicate assertion (`assertFalse(history.contains(...))`) instead of asserting the exact expected contents/order of `history`.

## Issue Context
The project requires tests to assert exact expected values/structures and avoid predicate checks like `contains(...)` that can miss regressions.

## Fix Focus Areas
- jablib/src/test/java/org/jabref/logic/util/io/FileHistoryTest.java[72-84]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

}
}


Loading