mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 11:25:50 +00:00
* #2449 bump maven-checkstyle-plugin from 3.1.0 to 3.2.0 + resolve checkstyle issues * remove FileSelectorJFrame.java to resolve checkstyle issue * remove FileSelectorJFrame.java to resolve checkstyle issue * remove FileSelectorJFrame.java to resolve checkstyle issue * add refactored file with correct filename to resolve checkstyle issue * add the test data * change filenames from JFrame to Jframe for checkstyle * fix code smell from sonar report * add new testcases to improve the test coverage * remove code smell
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package com.iluwatar.specialcase;
|
||||
|
||||
/**
|
||||
* ApplicationServices interface to demonstrate special case pattern.
|
||||
*/
|
||||
public interface ApplicationServices {
|
||||
|
||||
ReceiptViewModel loggedInUserPurchase(String userName, String itemName);
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package com.iluwatar.specialcase;
|
||||
|
||||
/**
|
||||
* Implementation of special case pattern.
|
||||
*/
|
||||
public class ApplicationServicesImpl implements ApplicationServices {
|
||||
|
||||
private DomainServicesImpl domain = new DomainServicesImpl();
|
||||
|
||||
@@ -27,6 +27,9 @@ package com.iluwatar.specialcase;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DB class for seeding user info.
|
||||
*/
|
||||
public class Db {
|
||||
|
||||
private static Db instance;
|
||||
@@ -113,6 +116,9 @@ public class Db {
|
||||
return itemName2Product.get(itemName);
|
||||
}
|
||||
|
||||
/**
|
||||
* User class to store user info.
|
||||
*/
|
||||
public class User {
|
||||
|
||||
private String userName;
|
||||
@@ -130,6 +136,9 @@ public class Db {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Account info.
|
||||
*/
|
||||
public class Account {
|
||||
|
||||
private Double amount;
|
||||
@@ -156,6 +165,9 @@ public class Db {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Product info.
|
||||
*/
|
||||
public class Product {
|
||||
|
||||
private Double price;
|
||||
|
||||
@@ -24,5 +24,8 @@
|
||||
*/
|
||||
package com.iluwatar.specialcase;
|
||||
|
||||
/**
|
||||
* DomainServices interface.
|
||||
*/
|
||||
public interface DomainServices {
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package com.iluwatar.specialcase;
|
||||
|
||||
/**
|
||||
* Implementation of DomainServices for special case.
|
||||
*/
|
||||
public class DomainServicesImpl implements DomainServices {
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,9 @@ package com.iluwatar.specialcase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Down for Maintenance view for the ReceiptViewModel.
|
||||
*/
|
||||
public class DownForMaintenance implements ReceiptViewModel {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DownForMaintenance.class);
|
||||
|
||||
@@ -26,6 +26,9 @@ package com.iluwatar.specialcase;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* View representing insufficient funds.
|
||||
*/
|
||||
@Slf4j
|
||||
public class InsufficientFunds implements ReceiptViewModel {
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ package com.iluwatar.specialcase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Receipt View representing invalid user.
|
||||
*/
|
||||
public class InvalidUser implements ReceiptViewModel {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(InvalidUser.class);
|
||||
|
||||
@@ -27,6 +27,9 @@ package com.iluwatar.specialcase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Acquire lock on the DB for maintenance.
|
||||
*/
|
||||
public class MaintenanceLock {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MaintenanceLock.class);
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package com.iluwatar.specialcase;
|
||||
|
||||
/**
|
||||
* Represents the money transaction taking place at a given moment.
|
||||
*/
|
||||
public class MoneyTransaction {
|
||||
|
||||
private Double amount;
|
||||
|
||||
@@ -27,6 +27,9 @@ package com.iluwatar.specialcase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Receipt view for showing out of stock message.
|
||||
*/
|
||||
public class OutOfStock implements ReceiptViewModel {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OutOfStock.class);
|
||||
|
||||
@@ -27,6 +27,9 @@ package com.iluwatar.specialcase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Receipt view representing the transaction recceipt.
|
||||
*/
|
||||
public class ReceiptDto implements ReceiptViewModel {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ReceiptDto.class);
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package com.iluwatar.specialcase;
|
||||
|
||||
/**
|
||||
* ReceiptViewModel interface.
|
||||
*/
|
||||
public interface ReceiptViewModel {
|
||||
|
||||
void show();
|
||||
|
||||
Reference in New Issue
Block a user