How to test cookie values using Spring mockMvc

For a given method in your controller:

  @RequestMapping(value = “/sampleSite/home”, method = RequestMethod.GET)

    public String getHomePage(HttpServletRequest request, Model model,

            @Configuration ConfigurationEntity configEntity,

            @CookieValue(value = “iIes”, required = false) String someCookie)

            throws ErrorException {

Some Code


You can test the @CookieValue parameter using Spring’s MVC Test Framework like so:


    public void test_invalidPaymentSessionCookie() throws Exception {

        // Put the cookie in the request

        final String cookieValue = “some value”;

        final Cookie someInformationCookie = new Cookie(“iIes”, someCookie);


        MvcResult result = mockMvc



                .param(“configEntity”, “configEntity”))



        assertThat(<getCookieFromRequest>, is(cookieValue));


How to test cookie values using Spring mockMvc

Remove toolbar icons in eclipse

When I travel I often work from my laptop which has a small screen. This can sometimes get in the way of productivity as I have to scroll more (and I generally start to doubt whether I should have bought a larger laptop). Here are a few things I do in eclipse to maximise screen real estate when working with eclipse:

Eclipse starting point

Remove unnecessary toolbars:

In eclipse I can hide the whole toolbar (especially if I have no need to change perspective).


And Hey presto! I have saved 3 rows of screen space.

However, sometimes I still need the icons. In this case I edit the toolbars that are visible.

Window > Customise Perspective…


On the right are all the toolbar icons that are displayed, simply uncheck away all the pointless toolbars and we have saved space, and while I am at it, I also close the perspectives I am not using:




Remove toolbar icons in eclipse

Hello World!

After blogging internally at work I decided to take the plunge and create a public blog. The reason I decided to do this is:

I want to go from someone who reads other peoples blogs to someone who engages with other bloggers and shares ideas.  While I am talking about sharing, on rare occasions I have the answer someone was looking for but when I think about logging in and writing a proper post I lose the enthusiasm.

I have been working on semi-agile (aka water-scrum-fall and agile with a little almost feint ‘a’) projects and I need somewhere to share my experiences (and rant).

I travel quite a lot (3-4-5) for work and i hope to help others who are working in software development/ Tech Consulting who are doing similar things.

Most of all I hope to have a journal to look back on and see how far I have come. In the last 5 years of technology consulting I have learnt so much but not so much as I have learnt whilst in a development role. It’s a very exciting area to be in at the moment and there is a wealth of exciting opportunities for developers out there.

Anyway, enough blabbering from me. If you happen upon my little corner of the internet, stop by and say Hi.

Hello World!