What they’re really asking
If you only remember one thing, say this in the first minute: “There’s nobody to ask in an online assessment, so I’ll turn the requirements into tests first, one test per requirement, and write my assumptions down. Then I’ll run them, so each bug shows up as one red test. I’ll fix each one with the smallest change, without breaking the tests that already pass. If I use the built-in assistant, I’ll ask it narrow questions and confirm every answer by running a test.”
The rest of this page explains each part of that answer.
The assessment wants to know whether you can get into an unfamiliar backend and fix its behaviour against stated requirements, quickly and alone.
That last word is what makes it different from an interview. In an online assessment (an OA, a timed coding test you take on your own before the interviews) there is no interviewer to ask what “partial match” means. The grading usually comes from automated tests you may not fully see. So the skill is turning a short list of requirements into checks you can run, and writing down every assumption where a reviewer will find it.
The second difference is the codebase. It is a working app, not a puzzle: a Spring Boot service with entities, a repository and a search endpoint. The bugs are the ordinary ones every backend engineer has shipped once: a wrong comparison, a filter in the wrong place, a relationship that isn’t saved.
Two reports describe the task. A first-hand OA (2026-10-09) had “One coding question and one AI Debug”, a Jira-like app where “creating an Issue and a sub-issue is broken” (PracHub). A PracHub write-up describes “Fix bugs in a Movie search backend”, with five requirements (PracHub). Neither names the AI tool. Amazon’s careers page says its SDE assessment includes an interactive AI assistant (Amazon). Business Insider reported that Amazon’s interview guidelines bar GenAI tools “unless explicitly permitted” (as quoted by ITPro, ITPro), so use the assistant only inside the assessment, where it is offered.
Clarify first
An OA gives you no one to ask, so write your assumptions into the code as comments or into a short note:
- Which tests run on submit? Read the existing tests first; they define the grading.
- Does “partial match” mean substring? Assume a substring, ignoring case.
- Does “ALL” mean title OR stars? Assume OR.
- Popularity sort: highest first, with ties broken by title? Assume yes.
- Should the “published” filter apply before paging? Assume yes.
Write it like this, at the top of your test file: “Assumptions: partial = case-insensitive substring; ALL = title OR stars; popularity descending, ties by title; published filter before paging.”
Answer
The example: the movie search, requirement by requirement
The movie-search task gives five requirements. Turn each into one test before you read the query code, so each bug shows up as exactly one red line. This table is the plan:
| Requirement | Test to write | Typical bug it catches | What to say |
|---|---|---|---|
| Partial match | Search “god” finds “The Godfather” | equals where contains is needed | ”Partial means substring.” |
| Ignore case | Search “GOD” finds the same movie | Only one side lower-cased | ”Both sides must be folded.” |
| Title, stars or ALL | ALL finds a movie matching only by star | && instead of || for ALL | ”ALL means either field.” |
| Popularity order | Results come back highest first | Ascending comparator | ”Descending, ties by title.” |
| Published only | An unpublished match never appears | Filter missing, or applied after paging | ”Filter first, then page.” |
The last row needs one more sentence. Paging means returning results a page at a time (say, 20 per page). If the code fetches a page of 20 first and then drops the unpublished movies, a page can come back with fewer than 20 results even when more matches exist. Users see short pages and missing results.
A reference version to compare against
This is what correct code looks like for all five requirements, written in plain Java streams so each requirement is one visible line:
static List<Movie> search(List<Movie> movies, String q, Field field) {
String needle = q.toLowerCase(Locale.ROOT); // case-insensitive
return movies.stream()
.filter(Movie::published) // only published movies
.filter(m -> matches(m, needle, field))
.sorted(Comparator.comparingDouble(Movie::popularity).reversed()
.thenComparing(Movie::title)) // stable tie-break
.collect(Collectors.toList());
}
static boolean matches(Movie m, String needle, Field field) {
boolean inTitle = m.title().toLowerCase(Locale.ROOT).contains(needle); // partial match
boolean inStars = m.stars().stream()
.anyMatch(s -> s.toLowerCase(Locale.ROOT).contains(needle));
return switch (field) {
case TITLE -> inTitle;
case STARS -> inStars;
case ALL -> inTitle || inStars;
};
}
This reference version, with four checks (case-insensitive title, popularity order on stars, ALL as OR, STARS ignoring titles), compiled and passed on OpenJDK 20 on 2026-10-12.
In the real assessment, compare the given code with each line. Look for equals where contains is needed,
lower-casing only one side, && for ALL, an ascending comparator, and the published filter missing or applied
after pagination. Two Spring Data checks are worth a minute:
- Derived query names. Spring Data builds a query from the method name, so
findByTitleContainingIgnoreCasedoes a case-insensitive substring match, andfindByTitledoes an exact one. A wrong word in the name is a bug. Pageablesorting. A sort passed in the page request can override the sort you wrote.
The other variant: issue and sub-issue
The Jira-like report gives only a symptom: creating an issue with a sub-issue is broken. Start by reproducing it with a test that creates a parent, creates a child pointing at it, and reads both back. Then follow the write path:
create parent ──► save parent ──► parent gets its id
│
create child ──► child.setParent(parent) ──► save child (foreign key = parent id)
│
read parent ──► join children by parent id
Three places on that path commonly break. These are hypotheses to check, not reported causes:
- Order of ids. If the database generates ids, saving the child before the parent is written gives the child a null foreign key (the column that points at the parent).
- The owning side. In JPA (the Java standard for mapping objects to tables), only one side of a
relationship writes the foreign key; that side is called the owning side. Adding the child to
parent.getChildren()without callingchild.setParent(parent)stores nothing when the child owns the key. - Cascade and transaction. Is saving the parent set to also save its children (a cascade), and does it all happen in one transaction?
Say it like this: “The report only gives me the symptom, so I’ll prove it with a test, then check the three usual causes in order: id timing, owning side, cascade.”
Using the assistant
Ask it narrow questions you can check quickly: “Which side owns this relationship?” “Where is the sort applied?” Then confirm each answer by running a test. Don’t paste the code and ask what is wrong; it will give you a fluent list that mixes real bugs with invented ones.
Senior vs Staff
OA debug task
Senior
- Writes requirement tests first, finds each mismatch, and fixes it minimally without breaking existing tests.
Staff
- Also moves the filtering and matching into the query (with the right index) instead of filtering findAll() in memory, and notes the paging-after-filter bug class.
In plain words: Senior makes the five requirements pass. Staff also notices that loading every row and filtering in memory gets slower as the table grows, and moves that work into the database.
Small-team version
Turning requirements into tests is the cheapest guard against agent-written CRUD code that looks finished. When a product owner gives five bullet points, those five bullets become five tests before any code is generated.
The cost is minutes. Five tests are perhaps 15 minutes of review. An agent session to draft them costs a few dollars at list prices: the drive-an-agent walkthrough’s assumed 40-step session is about $6.84 uncached and $1.22 with prompt caching (a discount when the start of a prompt repeats a recent one). A missed requirement that ships costs a support ticket and a hotfix. Skip this only for throwaway prototypes.
Pitfalls
- Reading the whole codebase before running a single test. The tests tell you where to look; reading everything first wastes the clock.
- Fixing case on the query string but not on the stored fields. “GOD” lower-cased still won’t match “Godfather” if the title isn’t lower-cased too.
- Filtering published movies after paging. Pages come back short, and some matches never appear.
- Using the assistant’s explanation of the ORM without testing it. An ORM (object-relational mapper, such as JPA) has subtle rules, and a confident wrong answer costs more time than a test.
Go deeper
- Family walkthrough: Read, explain and fix code you didn’t write, the method and the requirement-test habit.
- Read a panic back to its cause: Build Your Own Message Queue (SQS-lite)Partial.
- Assessments with an assistant: AI-assisted coding in a provided codebase.