Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task accomplished #1071

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Task accomplished #1071

wants to merge 1 commit into from

Conversation

AriohDK
Copy link

@AriohDK AriohDK commented Jan 8, 2025

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on your implementation! 🎉 The core functionality of your code is intact, and the issues identified are mostly minor and related to improving clarity and professionalism in your logging messages. Here are a few suggestions to enhance your code further:

  1. Log Message Clarity: Consider updating the misleading log message in OrderServiceImpl.java to reflect that the data is generated for testing rather than fetched from a database.

  2. Grammar Correction: In AuthenticationServiceImpl.java, correct the grammar in the exception message to 'Username or password is incorrect'.

  3. Informative Error Logs: Enhance the error log message to provide more context, such as including the username involved in the authentication failure.

  4. Typo Fix: Correct the typo in Main.java to improve the readability and professionalism of your logs.

These improvements will make your code even more robust and maintainable. Keep up the great work! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

public static void main(String[] args) {
AuthenticationService authenticationService = new AuthenticationServiceImpl();
User user;
try {
logger.info("User try ro authenticate");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in the log message: 'User try ro authenticate'. It should be 'User tries to authenticate' or 'User is trying to authenticate'.

user = authenticationService.login("bob", "1234");
} catch (AuthenticationException e) {
e.printStackTrace();
logger.error("Authentication error, {}", String.valueOf(e));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error log message could be more informative. Consider including more context about the error, such as 'Authentication failed for user bob: {}', to make it clearer what the error relates to.

@Override
public User login(String login, String password) throws AuthenticationException {
//TODO: add corresponding log message about method login was called
logger.info("Method login was called with params: Login= {}",login);
User user = findByLogin(login);
if (!user.getPassword().equals(password)) {
throw new AuthenticationException("Username or password are incorrect");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception message 'Username or password are incorrect' should be 'Username or password is incorrect' for grammatical correctness.

@@ -24,7 +28,7 @@ private List<Product> getAllProductsFromShoppingCart(Long userId) {
Product macBook = new Product("MacBook Air 2020", BigDecimal.valueOf(1399));
Product xiaomi = new Product("Xiaomi 12", BigDecimal.valueOf(499));
List<Product> products = List.of(iphone, macBook, xiaomi);
// TODO: add log message about successful fetched data from DB
logger.info("Data successfully found in the database");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message 'Data successfully found in the database' is misleading because the data is not actually fetched from a database. Consider changing it to 'Dummy data generated for testing' to accurately reflect the current implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants