@Test @WithMockUser(roles = "Tutor") public void multiplePaidBills() throws Exception { Bill testBill1 = new Bill(); Bill testBill2 = new Bill(); testBill1.setTutor(TestUtility.testUser); testBill1.setPaymentStatus(PaymentStatus.PAID); testBill1.setAmount(BigDecimal.TEN); testBill1.setMonthValue(1); testBill1.setMonth("January"); testBill1.setPercentage(ConstantVariables.PERCENTAGE); testBill1.setTotal(BigDecimal.TEN); testBill1.setYear(2015); testBill1 = billDao.save(testBill1); testBill2.setTutor(TestUtility.testUser); testBill2.setPaymentStatus(PaymentStatus.PAID); testBill2.setAmount(BigDecimal.TEN); testBill2.setMonthValue(2); testBill2.setMonth("February"); testBill2.setPercentage(ConstantVariables.PERCENTAGE); testBill2.setTotal(BigDecimal.TEN); testBill2.setYear(2015); testBill2 = billDao.save(testBill2); ArrayList<Bill> testList = new ArrayList<Bill>(); testList.add(testBill1); testList.add(testBill2); mockMvc .perform(get("/bill").principal(this.authUser)) .andExpect(model().attribute("PaidBills", testList)); }