Package br.com.caelum.vraptor.environment

Examples of br.com.caelum.vraptor.environment.DefaultEnvironment


    request = new ExceptionData(exception(), "/test", new FakeUser(), "test=true", "");
  }

  @Test
  public void should_build_error_mail_using_request_and_environment() throws IOException, EmailException {
    ErrorMailFactory factory = new ErrorMailFactory(request, new DefaultEnvironment(TEST));
    ErrorMail errorMail = factory.build();
    assertThat(errorMail.getMsg(), startsWith(expectedMSG()));
  }
View Full Code Here


    assertThat(errorMail.getMsg(), startsWith(expectedMSG()));
  }
 
  @Test(expected = NoSuchElementException.class)
  public void should_not_run_without_from() throws IOException, EmailException {
    ErrorMailFactory factory = new ErrorMailFactory(request, new DefaultEnvironment(PRODUCTION));
    factory.build();
  }
View Full Code Here

    factory.build();
  }
 
  @Test
  public void should_work_with_fake_request() throws Exception {
    DefaultEnvironment env = new DefaultEnvironment(TEST);
   
    ExceptionData req = new ExceptionData(new Exception("test"), null, null, null, null);
   
    ErrorMail mail = new ErrorMailFactory(req, env).build();
    assertNotNull(mail);
View Full Code Here

    assertNotNull(mail);
  }
   
  @Test
  public void should_use_default_subject_if_doesnt_exist_in_environment() throws IOException, EmailException {
    ErrorMailFactory factory = new ErrorMailFactory(request, new DefaultEnvironment(DEVELOPMENT));
    ErrorMail email = factory.build();
    assertThat(email.toSimpleMail().getSubject(), equalTo(DEFAULT_SUBJECT));
  }
View Full Code Here

    assertThat(email.toSimpleMail().getSubject(), equalTo(DEFAULT_SUBJECT));
  }
 
  @Test
  public void should_use_provided_subject_if_exists_in_environment() throws IOException, EmailException {
    DefaultEnvironment env = new DefaultEnvironment(TEST);
    ErrorMailFactory factory = new ErrorMailFactory(request, env);
    ErrorMail email = factory.build();
    String pattern = forPattern(env.get(ERROR_DATE_PATTERN)).print(DateTime.now());
    assertThat(email.toSimpleMail().getSubject(), equalTo("Error at 'cat' project" + " - " + pattern));
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.environment.DefaultEnvironment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.