C[O]RRECT: [O]rdering
Understand how to verify the correct ordering of data in unit tests using the CORRECT principles. This lesson guides you through testing ranked scoring in Java applications with JUnit, highlighting how to identify and fix order-related test failures for accurate results.
We'll cover the following...
[O]rdering
The order of data, or the position of one piece of data within a larger collection, represents a commonly missed piece of the CORRECTness acronym.
Let’s look at an instance where we need ordering in the iloveyouboss application. One of the application’s core features is to score a list of companies based on how well they match the criteria. Naturally, we always want to see the best match first, followed by the second-best, and so on.
The answersResultsInScoredOrder test represents the ordering need: ...