Skip to content

Conversation

@SelahattinSert
Copy link
Owner

Add location object without unit tests

@SelahattinSert SelahattinSert self-assigned this Oct 30, 2024
@SelahattinSert SelahattinSert requested a review from ozgen October 30, 2024 13:08
Copy link
Collaborator

@ozgen ozgen left a comment

Choose a reason for hiding this comment

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

I added few comments @SelahattinSert

@SelahattinSert
Copy link
Owner Author

Would it be better if i add new service for the location and handle the write operation to the database separately? @ozgen

@ozgen
Copy link
Collaborator

ozgen commented Oct 31, 2024

Would it be better if i add new service for the location and handle the write operation to the database separately? @ozgen

no could you read the documentations @SelahattinSert

ref: https://docs.spring.io/spring-framework/reference/data-access/transaction/declarative/annotations.html

https://www.geeksforgeeks.org/spring-boot-transaction-management-using-transactional-annotation/

@SelahattinSert SelahattinSert requested a review from ozgen November 4, 2024 18:42
@SelahattinSert
Copy link
Owner Author

I am sorry about commit mess @ozgen

Copy link
Collaborator

@ozgen ozgen left a comment

Choose a reason for hiding this comment

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

I didn't find any problem in your code @SelahattinSert,
you can start to write unit tests.

@SelahattinSert
Copy link
Owner Author

I added unit tests @ozgen

Copy link
Collaborator

@ozgen ozgen left a comment

Choose a reason for hiding this comment

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

looks good to me @SelahattinSert

I am very busy in these days, I will create another issue when I am available,
thanks for your patience

Location location = updatedCamera.getLocation();

// assert
Assertions.assertThat(location).isNotNull();
Copy link
Collaborator

Choose a reason for hiding this comment

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

your assert usage is okay for me, however, you can also use it like this:

assertThat(location)
    .isNotNull()
    .satisfies(loc -> {
        assertThat(loc.getLatitude())
            .as("Check Latitude")
            .isNotNull()
            .isEqualTo(LATITUDE);

        assertThat(loc.getLongitude())
            .as("Check Longitude")
            .isNotNull()
            .isEqualTo(LONGITUDE);

        assertThat(loc.getAddress())
            .as("Check Address")
            .isNotNull()
            .isEqualTo(ADDRESS);
    });

Because this approach allows chains multiple assertions directly related to the location. This reduces redundancy and improves readability.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I was busy too, this week and the following week are my midterm weeks. Sorry if i took so long and thanks for your patience too @ozgen

@SelahattinSert SelahattinSert merged commit e7ace00 into master Nov 14, 2024
@SelahattinSert SelahattinSert deleted the task/add-location-object branch November 20, 2024 13:24
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.

3 participants