https://github.com/mick-j/unittestingweatherapi
Testing Weather REST API With Wiremock
https://github.com/mick-j/unittestingweatherapi
java rest-api testing weather-api wiremock
Last synced: about 1 year ago
JSON representation
Testing Weather REST API With Wiremock
- Host: GitHub
- URL: https://github.com/mick-j/unittestingweatherapi
- Owner: Mick-J
- Created: 2025-03-05T22:28:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-05T22:40:33.000Z (over 1 year ago)
- Last Synced: 2025-03-05T23:28:04.567Z (over 1 year ago)
- Topics: java, rest-api, testing, weather-api, wiremock
- Language: Java
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Testing Weather REST API With Wiremock
In this project we :
- create a REST API on weather data source
- test the service part of the REST API using wiremock
#### 1.Weather API call
In the Restcontroller We fetch data from 3 endpoints:
- /current.json : provide weather data
- /astronomy.json : provide weather data
- /alerts.json : provide alerts data
curl can be used to fetch data from endpoints:
```
curl -X GET --location "http://localhost:8080/current.json?city=Paris"
curl -X GET --location "http://localhost:8080/alerts.json?city=new+york"
curl -X GET --location "http://localhost:8080/astronomy.json?city=Brussels"
```
All API call by our REST controller were successful as shown below:

#### 2.Testing whith Wiremock
For testing we mock, GET requests in json file as well as return data to check.
We have tested also 404 response cases for each endpoints.
all tests was successful as shown below:

#### 3.Tech Stack
- Java 21
- JUnit 5 (for unit testing)
- WireMock (for mocking external APIs)
- Spring Boot
- Maven(for dependency management)
`Link Weather Service`:
WeatherAPI.com