refactoring #1012: Format specifiers should be used instead of string concatenation. (#2715)

* refactoring #1012: Format specifiers should be used instead of string concatenation.

* refactoring #1012: Format specifiers should be used instead of string concatenation.

* refactoring #1012: Remove isInfoEnabled check
This commit is contained in:
kongleong86
2023-12-02 12:25:00 +00:00
committed by GitHub
parent a82966f202
commit 301317533e
9 changed files with 19 additions and 19 deletions
@@ -42,6 +42,6 @@ public class InvalidUser implements ReceiptViewModel {
@Override
public void show() {
LOGGER.info("Invalid user: " + userName);
LOGGER.info(String.format("Invalid user: %s", userName));
}
}
@@ -55,6 +55,6 @@ public class MaintenanceLock {
public void setLock(boolean lock) {
this.lock = lock;
LOGGER.info("Maintenance lock is set to: ", lock);
LOGGER.info("Maintenance lock is set to: {}", lock);
}
}
@@ -34,8 +34,8 @@ public class OutOfStock implements ReceiptViewModel {
private static final Logger LOGGER = LoggerFactory.getLogger(OutOfStock.class);
private String userName;
private String itemName;
private final String userName;
private final String itemName;
public OutOfStock(String userName, String itemName) {
this.userName = userName;
@@ -44,6 +44,6 @@ public class OutOfStock implements ReceiptViewModel {
@Override
public void show() {
LOGGER.info("Out of stock: " + itemName + " for user = " + userName + " to buy");
LOGGER.info(String.format("Out of stock: %s for user = %s to buy", itemName, userName));
}
}
@@ -34,7 +34,7 @@ public class ReceiptDto implements ReceiptViewModel {
private static final Logger LOGGER = LoggerFactory.getLogger(ReceiptDto.class);
private Double price;
private final Double price;
public ReceiptDto(Double price) {
this.price = price;
@@ -46,6 +46,6 @@ public class ReceiptDto implements ReceiptViewModel {
@Override
public void show() {
LOGGER.info("Receipt: " + price + " paid");
LOGGER.info(String.format("Receipt: %s paid", price));
}
}