Previously we discovered how to setup test environment in Play Framework. Now we can focus on more pragmatic aspect, test writing.
Until now we were writing our store without tests, in the goal to quickly discover some of Play basic features. However, a code without tests is as a car without wheels. It will exist but will be driveless. The code without tests exists too, but it less evolutionary than the code well covered by the tests.
If you're following well the article about authentication and authorization in Play Framework, you could see that @Authorize annotation is accompanied by another annotation, @With. Thanks to it, the @Authorized is evaluated with the class specified inside @With annotation.
If you remember well our previous article, we introduced the concept of forms and validation. To illustrate it, we used the register form case. Now, when user can register, he also should be able to login.
Previous article presented forms and validation in Play Framework. But we didn't described how to display and format forms in the templates.
When user can't interact with the application, he loses the interest for it. It's why forms and other input methods are a useful to satisfy the final user demand. Play Framework also supports operations on forms, as generation from POJO or dynamic validation with annotations.
In our's Play application, user can navigate on the site, add several products to his shopping cart and, at the end, terminate his shopping. As in all "classical" web applications, in Play this persistence is possible thanks to sessions.
E-commerce store with static URLs would kill even the most powerful server. It's why, to resolve dynamic behavior, we use HTTP parameters. GET ones are particularly useful.
The next step in Play Framework discovery is the work with database data. Thanks to it, we can use centralized and dynamically managed data.
When we build webapps, we can think that all of them can be constructed with Spring framework and its related projects. It's right, but which programmer is satisfied by knowing only one framework or only one programming language ? It's why we'll explore here another way to deploying web applications, the deploying with Play Framework.