Skip to content

Change weather client to use MET api#11

Merged
daniejoh merged 4 commits intomainfrom
change-weather-to-use-yr-api
Jun 25, 2025
Merged

Change weather client to use MET api#11
daniejoh merged 4 commits intomainfrom
change-weather-to-use-yr-api

Conversation

@daniejoh
Copy link
Contributor

This PR changes the client to use MET api directly instead of the OpenEPI Weather api.

@daniejoh daniejoh requested a review from kstigen June 23, 2025 11:58
Copy link
Contributor

@kstigen kstigen left a comment

Choose a reason for hiding this comment

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

A bit much to go into detail, but take a look at the tests.

mockResponse.setProperties(mockForecast);

when(api.getSunriseAndSunset(lat, lon, null, null)).thenReturn(mockResponse);
METJSONSunrise response = api.getSunriseAndSunset(lat, lon, null, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

This test, doesn't really test anything. You are mocking the entire call to the api.getSunriseAndSunset, so we are basically testing that that setup of the mocking code works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have now changed to mocking the server, and doing an integration test. I see that I have made the same mistake on the other api clients, but these should be changed in a different PR.

This makes it do a test of serialization and deserialization and so on.
@daniejoh daniejoh requested a review from kstigen June 25, 2025 08:04
@daniejoh daniejoh merged commit e5e46ad into main Jun 25, 2025
1 check passed
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