@Test @DisplayName("顧客の追加ができてindex画面にリダイレクトする") @Transactional public void insertCompleteTest2() { CustomerForm customerForm = new CustomerForm("絵梨花", "生田", "eikuta@nogi.com", LocalDate.of(1997, 1, 22)); BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(customerForm, "customerForm"); String logicalViewName = customerController.insertComplete(customerForm, bindingResult); int rows = JdbcTestUtils.countRowsInTableWhere(jdbcTemplate, "customer", "email = '" + customerForm.getEmail() + "'"); assertAll( () -> assertEquals(1, rows), () -> assertEquals("redirect:/", logicalViewName) ); }
public String insertComplete( CustomerForm customerForm, BindingResult bindingResult) { Customer customer = customerForm.convertToEntity(); return "redirect:/"; }
CustomerController { public String insertComplete( CustomerForm customerForm, BindingResult bindingResult) { Customer customer = customerForm.convertToEntity(); return "redirect:/"; } }
CustomerController { public String insertComplete( CustomerForm customerForm, BindingResult bindingResult) { Customer customer = customerForm.convertToEntity(); return "redirect:/"; }  }
CustomerController { public String insertComplete( CustomerForm customerForm, BindingResult bindingResult) { Customer customer = customerForm.convertToEntity(); return "redirect:/"; }  String index(Model model); @GetMapping("/insertMain") String insertMain(Model model); String insertComplete(
            // Bean Validationを実行するアノテーションを付加する
               CustomerForm customerForm,
            BindingResult bindingResult); }
CustomerController { public String insertComplete( CustomerForm customerForm, BindingResult bindingResult) { Customer customer = customerForm.convertToEntity(); return "redirect:/"; }  String index(Model model); @GetMapping("/insertMain") String insertMain(Model model); String insertComplete(
            // Bean Validationを実行するアノテーションを付加する
               CustomerForm customerForm,
            BindingResult bindingResult);  }