Asking a candidate to review a pull request is a good practice in a Java developer interview. Instead of asking theoretical questions whose answers can be memorized, you can discuss working code and real engineering decisions. This makes it easier to see whether the candidate has hands-on experience and how deeply they can analyze someone else’s changes.
But the quality of the exercise matters. If the PR is poorly prepared, the interview tests the candidate’s ability to guess requirements and work around problems in the exercise—not their engineering skills. Here are five mistakes to avoid.
1. There is no written description of the task
Sometimes candidates are shown a diff while the context and requirements are explained only verbally. Important details can be missed or remembered differently. The candidate has to guess what behavior is expected, while the interviewer may assess them against requirements they never saw.
Include a short description alongside the PR: what is changing, why, and which constraints are mandatory. If you need to provide additional context verbally, give it consistently to every candidate and leave time for clarifying questions.
2. The code does not compile
If the project fails to build because of an error in the exercise, the candidate cannot use tests to verify their assumptions and may waste time diagnosing someone else’s typo or broken configuration. That is reasonable only when debugging the build is an explicit goal of the exercise.
Before the interview, run the build and tests in a clean environment, using the same commands and instructions the candidate will receive. Check both the main branch and the prepared diff.
3. No other developers have tried the exercise
The author knows the context and already sees the intended defects. It is easy to underestimate how long it takes to understand the code and overestimate how clear the requirements are.
Ask several engineers to review the PR without hints and within the same time limit as the candidate. Compare what they find, where their interpretations differ, and what prevents them from getting started. This helps separate useful signals from quirks of the exercise.
4. There are too many traps
When a small PR contains many unrelated defects, the interview turns into a hunt for bugs. The candidate may find several important issues but run out of time to explain and prioritize them. The exercise ends up measuring how quickly they can scan for problems rather than the quality of their review.
Keep a small number of meaningful issues tied to the purpose of the change. Decide in advance which ones are critical, and assess the candidate’s reasoning—not the number of comments they find. Do not expect them to uncover every planted trap.
5. There are too many subtleties and unclear requirements
A trap is a defect that can be identified from the available context. A subtlety is an additional business rule or constraint that is needed to determine whether the behavior is actually wrong. If these details are numerous and undocumented, the candidate has to guess what the author intended.
For example, reviewing a payment refund may depend on whether partial refunds are allowed, how duplicate requests are handled, and what should happen if the payment gateway times out. State the necessary rules in the task description. The candidate can raise other unknowns as questions or explicit assumptions; that is useful discussion, not a reason to mark them down.
Example exercise: a PR that handles payment refunds
The code example below is very small, but it can still provide useful signals.
PR description for the candidate: “Add an API for refunding a payment. The same payment must not be refunded more than once. The refund amount must not exceed the original payment amount. Find issues in the change and prioritize your comments.”
Show the candidate the diff and ask them to leave comments as they would in a regular code review:
+ @PostMapping("/payments/{id}/refund") + public RefundResponse refund(@PathVariable UUID id, + @RequestBody RefundRequest request) { + Payment payment = paymentRepository.findById(id).orElseThrow(); + if (request.amount().compareTo(payment.amount()) > 0) { + throw new IllegalArgumentException("Amount is too large"); + } + payment.setStatus(PaymentStatus.REFUNDED); + paymentRepository.save(payment); + gateway.refund(payment.getGatewayId(), request.amount()); + return new RefundResponse("OK"); + } This example opens up discussion about several risks:
- Duplicate requests. The code does not check whether the payment is already
REFUNDED, so a repeated call may trigger another refund. How would you make the operation idempotent? - Partial refunds. The amount is checked against the original payment, not the remaining refundable balance. If partial refunds are allowed, what should happen across multiple refund requests?
- Concurrent requests. Two requests may both pass the check before either saves its changes. How would you prevent the total refund from exceeding the allowed amount?
- External call and local state. The payment gateway call and the database write are not a single atomic operation. How should the system recover if one succeeds and the other fails?
- Validation and API contract. What should happen for a zero or negative amount, an unknown payment, or a payment in an invalid state?
Do not expect the candidate to design an entire payment system. Assess whether they spot the most important risks, explain a plausible failure scenario, and suggest a way to verify it—for example, a test for duplicate requests or two concurrent refunds.
How to evaluate the answers
Agree on a simple rubric with the interviewers in advance:
| Criterion | What to look for |
|---|---|
| Correctness | Can the candidate describe a concrete scenario in which the issue occurs? |
| Prioritization | Can they distinguish a merge-blocking defect from an improvement or a requirements question? |
| Verification | Do they suggest a test that reproduces the risk? |
| Communication | Is the review comment clear, and does it explain the impact? |
| Handling uncertainty | Do they ask questions and state their assumptions? |
Do not score candidates based on whether their comments match a prepared answer key. They may identify a different important risk or make a well-reasoned case for an alternative solution.