@Test(expected = RuntimeException.class) public void testTimeCardTransactionFailsForNonHourlyEmployee() throws Exception { int empId = 2; transaction = new AddSalariedEmployee(empId, "Bill", "Home", 2500); transaction.execute(); transaction = new TimeCardTransaction(LocalDate.of(2015, 12, 28), 8.0, empId); transaction.execute(); }
@Test public void testTimeCardTransaction() throws Exception { int empId = 2; transaction = new AddHourlyEmployee(empId, "Bill", "Home", 15.25); transaction.execute(); transaction = new TimeCardTransaction(LocalDate.of(2015, 12, 28), 8.0, empId); transaction.execute(); Employee employee = GlobalPayrollDatabase.getEmployee(empId); assertThat(employee, is(not(nullValue()))); HourlyClassification classification = (HourlyClassification) employee.getPaymentClassification(); assertThat(classification, is(not(nullValue()))); TimeCard timeCard = classification.getTimeCard(LocalDate.of(2015, 12, 28)); assertThat(timeCard, is(not(nullValue()))); assertThat(timeCard.getHours(), is(8.0)); }
@Test(expected = RuntimeException.class) public void testTimeCardTransactionFailsForNonExistingEmployee() throws Exception { int empId = 2; transaction = new TimeCardTransaction(LocalDate.of(2015, 12, 28), 8.0, empId); transaction.execute(); }