mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 14:59:21 +00:00
Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.
This commit is contained in:
@@ -21,7 +21,7 @@ import org.apache.log4j.Logger;
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(App.class);
|
||||
private static Logger log = Logger.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
@@ -30,17 +30,17 @@ public class App {
|
||||
*/
|
||||
public static void main(final String[] args) {
|
||||
final CustomerDaoImpl customerDao = new CustomerDaoImpl(generateSampleCustomers());
|
||||
LOGGER.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
LOGGER.info("customerDao.getCusterById(2): " + customerDao.getCustomerById(2));
|
||||
log.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
log.info("customerDao.getCusterById(2): " + customerDao.getCustomerById(2));
|
||||
final Customer customer = new Customer(4, "Dan", "Danson");
|
||||
customerDao.addCustomer(customer);
|
||||
LOGGER.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
log.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
customer.setFirstName("Daniel");
|
||||
customer.setLastName("Danielson");
|
||||
customerDao.updateCustomer(customer);
|
||||
LOGGER.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
log.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
customerDao.deleteCustomer(customer);
|
||||
LOGGER.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
log.info("customerDao.getAllCustomers(): " + customerDao.getAllCustomers());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,9 @@ public class Customer {
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Customer(final int id, final String firstName, final String lastName) {
|
||||
this.id = id;
|
||||
this.firstName = firstName;
|
||||
@@ -54,8 +57,9 @@ public class Customer {
|
||||
isEqual = true;
|
||||
} else if (o != null && (getClass() == o.getClass())) {
|
||||
final Customer customer = (Customer) o;
|
||||
if (getId() == customer.getId())
|
||||
if (getId() == customer.getId()) {
|
||||
isEqual = true;
|
||||
}
|
||||
}
|
||||
return isEqual;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user