BAEL-611: Minor formatting changes (#1534)
* Add NDC and JBoss Logging to the demo application * NDC for Log4j, Log4j2 and JBoss Logging * Simplify NDC example by making it a single operation instead of two * Make NDC example as RestController, Use JBoss Logging only as a logging bridge * Fix merge conflicts in pull request - log-mdc pom.xml updated * BAEL-445 Update to Spring security SpEL example * BAEL-445: Change tabs to spaces in the updated code * BAEL-245: Add Enum Serialization exmaple * BAEL-245: Remove the folder jackson/src/test/java/com/baeldung/jackson/dtos/withEnum as the example is not used anymore * Add more enum serialization examples to align with previous example and prevent build fail * BAEL-611: Minor formatting changes * BAEL-611: Update Test case method names
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package com.baeldung.jaxws;
|
||||
|
||||
import com.baeldung.jaxws.exception.EmployeeAlreadyExists;
|
||||
import com.baeldung.jaxws.exception.EmployeeNotFound;
|
||||
import com.baeldung.jaxws.model.Employee;
|
||||
import com.baeldung.jaxws.repository.EmployeeRepository;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.ws.Service;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||
@@ -14,13 +19,10 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.ws.Service;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import com.baeldung.jaxws.exception.EmployeeAlreadyExists;
|
||||
import com.baeldung.jaxws.exception.EmployeeNotFound;
|
||||
import com.baeldung.jaxws.model.Employee;
|
||||
import com.baeldung.jaxws.repository.EmployeeRepository;
|
||||
|
||||
@RunWith(Arquillian.class)
|
||||
public class EmployeeServiceLiveTest {
|
||||
@@ -54,54 +56,54 @@ public class EmployeeServiceLiveTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenGetAllEmployees_thenCorrectNumberOfEmployeesReturned() {
|
||||
public void givenEmployees_whenGetCount_thenCorrectNumberOfEmployeesReturned() {
|
||||
int employeeCount = employeeServiceProxy.countEmployees();
|
||||
List<Employee> employeeList = employeeServiceProxy.getAllEmployees();
|
||||
assertEquals(employeeList.size(), employeeCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmployeeId_whenEmployeeExists_thenCorrectEmployeeReturned() throws EmployeeNotFound {
|
||||
public void givenEmployees_whenGetAvailableEmployee_thenCorrectEmployeeReturned() throws EmployeeNotFound {
|
||||
Employee employee = employeeServiceProxy.getEmployee(2);
|
||||
assertEquals(employee.getFirstName(), "Jack");
|
||||
}
|
||||
|
||||
@Test(expected = EmployeeNotFound.class)
|
||||
public void givenEmployeeId_whenEmployeeNotExists_thenEmployeeNotFoundExceptionReturned() throws EmployeeNotFound {
|
||||
public void givenEmployees_whenGetNonAvailableEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
|
||||
employeeServiceProxy.getEmployee(20);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAddEmployee_whenEmployeeDoesntAlreadyExist_thenEmployeeCountIncreased() throws EmployeeAlreadyExists {
|
||||
public void givenEmployees_whenAddNewEmployee_thenEmployeeCountIncreased() throws EmployeeAlreadyExists {
|
||||
int employeeCount = employeeServiceProxy.countEmployees();
|
||||
employeeServiceProxy.addEmployee(4, "Anna");
|
||||
assertEquals(employeeServiceProxy.countEmployees(), employeeCount + 1);
|
||||
}
|
||||
|
||||
@Test(expected = EmployeeAlreadyExists.class)
|
||||
public void givenAddEmployee_whenEmployeeAlreadyExist_thenEmployeeAlreadyExistsExceptionReturned() throws EmployeeAlreadyExists {
|
||||
public void givenEmployees_whenAddAlreadyExistingEmployee_thenEmployeeAlreadyExistsException() throws EmployeeAlreadyExists {
|
||||
employeeServiceProxy.addEmployee(1, "Anna");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUpdateEmployee_whenEmployeeExists_thenUpdatedEmployeeReturned() throws EmployeeNotFound {
|
||||
public void givenEmployees_whenUpdateExistingEmployee_thenUpdatedEmployeeReturned() throws EmployeeNotFound {
|
||||
Employee updated = employeeServiceProxy.updateEmployee(1, "Joan");
|
||||
assertEquals(updated.getFirstName(), "Joan");
|
||||
}
|
||||
|
||||
@Test(expected = EmployeeNotFound.class)
|
||||
public void givenUpdateEmployee_whenEmployeeNotExists_thenUpdatedEmployeeReturned() throws EmployeeNotFound {
|
||||
public void givenEmployees_whenUpdateNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
|
||||
employeeServiceProxy.updateEmployee(20, "Joan");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDeleteEmployee_whenEmployeeExists_thenCorrectStatusReturned() throws EmployeeNotFound {
|
||||
public void givenEmployees_whenDeleteExistingEmployee_thenSuccessReturned() throws EmployeeNotFound {
|
||||
boolean deleteEmployee = employeeServiceProxy.deleteEmployee(3);
|
||||
assertEquals(deleteEmployee, true);
|
||||
}
|
||||
|
||||
@Test(expected = EmployeeNotFound.class)
|
||||
public void givenDeleteEmployee_whenEmployeeNotExists_thenEmployeeNotFoundExceptionReturned() throws EmployeeNotFound {
|
||||
public void givenEmployee_whenDeleteNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
|
||||
employeeServiceProxy.deleteEmployee(20);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user