use of edu.hawaii.its.groupings.type.Feedback in project uhgroupings by uhawaii-system-its-ti-iam.
the class HomeController method feedbackError.
@PreAuthorize("isAuthenticated()")
@GetMapping("/feedback/{error}")
public String feedbackError(RedirectAttributes redirectAttributes, @PathVariable String error) {
Feedback feedback = new Feedback(error);
redirectAttributes.addFlashAttribute("feedback", feedback);
return "redirect:/feedback";
}
use of edu.hawaii.its.groupings.type.Feedback in project uhgroupings by uhawaii-system-its-ti-iam.
the class HomeControllerTest method feedbackSubmit.
@Test
@WithMockUhUser
public void feedbackSubmit() throws Exception {
MvcResult mvcResult = mockMvc.perform(post("/feedback").with(csrf()).flashAttr("feedback", new Feedback())).andExpect(status().is3xxRedirection()).andExpect(redirectedUrl("/feedback")).andExpect(flash().attribute("success", equalTo(true))).andReturn();
assertNotNull(mvcResult);
}
use of edu.hawaii.its.groupings.type.Feedback in project uhgroupings by uhawaii-system-its-ti-iam.
the class EmailServiceTest method sendFeedbackWithMailExceptionThrown.
@Test
public void sendFeedbackWithMailExceptionThrown() {
JavaMailSender senderWithException = new MockJavaMailSender() {
@Override
public void send(SimpleMailMessage mailMessage) throws MailException {
wasSent = false;
throw new MailSendException("Exception");
}
};
EmailService emailServiceWithException = new EmailService(senderWithException);
emailServiceWithException.setEnabled(true);
Feedback feedback = createBaseFeedback();
emailServiceWithException.send(feedback);
assertThat(wasSent, is(false));
}
use of edu.hawaii.its.groupings.type.Feedback in project uhgroupings by uhawaii-system-its-ti-iam.
the class EmailServiceTest method sendFeedbackWithNoExceptionMessage.
@Test
public void sendFeedbackWithNoExceptionMessage() {
Feedback feedback = createBaseFeedback();
emailService.send(feedback);
assertThat(wasSent, is(true));
assertThat(messageSent.getSubject(), containsString("problem"));
assertThat(messageSent.getText(), containsString("John Doe"));
assertThat(messageSent.getText(), containsString("jdoe@hawaii.edu"));
assertThat(messageSent.getText(), containsString("Some problem happened."));
assertThat(messageSent.getText(), not(containsString("Stack Trace:")));
}
use of edu.hawaii.its.groupings.type.Feedback in project uhgroupings by uhawaii-system-its-ti-iam.
the class ErrorRestControllerTest method httpPostFeedbackError.
@Test
public void httpPostFeedbackError() throws Exception {
HttpSession session = mockMvc.perform(post("/feedback/error").contentType(MediaType.APPLICATION_JSON).content("{\"exceptionMessage\":\"exception\"}")).andExpect(status().isNoContent()).andReturn().getRequest().getSession();
assertNotNull(session.getAttribute("feedback"));
Feedback feedback = (Feedback) session.getAttribute("feedback");
assertThat(feedback.getExceptionMessage(), equalTo("exception"));
}
Aggregations