Skip to main content

Mini Project: MockMvc Assertions: What You Can Check

Learn Mini Project: MockMvc Assertions: What You Can Check (Spring MVC Testing, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Mini Real-Time Project: MockMvc Assertions: What You Can Check Problem A team wants to test its web layer without a server. Show every kind of check MockMvc offers (status, headers, JSON, view, model, redirect, flash, cookie) and what a failing check looks like. Requirements Test a REST endpoint: status, content type, header and JSON fields. Test a page endpoint: view name, model attributes, forward. Test a redirect with a flash attribute and a cookie. Show one deliberately failing check and its message. Show how a service is replaced by a mock in a controller test. Concepts Used MockMvc and...

More lessons in Spring MVC Testing