@Test
  public void shouldUseTheDefaultLocale() throws ParseException {
    mockery.checking(
        new Expectations() {
          {
            one(request).getAttribute("javax.servlet.jsp.jstl.fmt.locale.request");
            will(returnValue(null));
            one(request).getSession();
            will(returnValue(session));
            one(session).getAttribute("javax.servlet.jsp.jstl.fmt.locale.session");
            will(returnValue(null));
            one(context).getAttribute("javax.servlet.jsp.jstl.fmt.locale.application");
            will(returnValue(null));
            one(context).getInitParameter("javax.servlet.jsp.jstl.fmt.locale");
            will(returnValue(null));
            one(request).getLocale();
            will(returnValue(Locale.getDefault()));
          }
        });
    DecimalFormat fmt = new DecimalFormat("##0,00");
    fmt.setMinimumFractionDigits(2);

    double theValue = 10.00d;
    String formattedValue = fmt.format(theValue);
    assertThat(
        (Double) converter.convert(formattedValue, double.class, bundle), is(equalTo(theValue)));
    mockery.assertIsSatisfied();
  }
 @Test
 public void shouldBeAbleToConvert() {
   mockery.checking(
       new Expectations() {
         {
           exactly(1).of(request).getAttribute("javax.servlet.jsp.jstl.fmt.locale.request");
           will(returnValue("pt_br"));
         }
       });
   assertThat((Double) converter.convert("8,77", double.class, bundle), is(equalTo(8.77d)));
   mockery.assertIsSatisfied();
 }
 @Test
 public void shouldThrowExceptionWhenUnableToParse() {
   mockery.checking(
       new Expectations() {
         {
           exactly(2).of(request).getAttribute("javax.servlet.jsp.jstl.fmt.locale.request");
           will(returnValue("pt_br"));
         }
       });
   try {
     converter.convert("vr3.9", double.class, bundle);
   } catch (ConversionError e) {
     assertThat(e.getMessage(), is(equalTo("vr3.9 is not a valid number.")));
   }
 }
 @Test
 public void shouldBeAbleToConvertNull() {
   assertThat((Double) converter.convert(null, double.class, bundle), is(equalTo(0d)));
   mockery.assertIsSatisfied();
 }