Skip to content

Fix test package importation #3

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

Merged
merged 2 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,66 @@ The project includes unit and integration tests.
mvn verify
```

## Linting and Code Style

This project uses [Checkstyle](https://checkstyle.org/) to enforce consistent code style and formatting.

* **Configuration:** The Checkstyle rules are defined in `checkstyle.xml` at the root of the repository.
* **Key rules enforced:**
- Maximum line length: 120 characters
- Indentation: 4 spaces (no tabs)
- Braces required for all control structures
- Javadoc required for classes and methods
- Naming conventions for variables, methods, constants, and packages
* **How to run Checkstyle:**
1. Make sure you are in the project root directory.
2. Run the following Maven command:
```bash
mvn checkstyle:check
```
3. The build will fail if there are any style violations. To see a detailed report, run:
```bash
mvn checkstyle:checkstyle
open target/site/checkstyle.html
```
4. Fix any reported issues before submitting code or opening a pull request.

## Continuous Integration / Continuous Delivery (CI/CD)

Automated tests and code style checks are run in CI/CD pipelines to ensure code quality and reliability. A typical pipeline for this project includes:

1. **Build:**
- Compile the code using Maven.
2. **Lint:**
- Run Checkstyle to enforce code style (`mvn checkstyle:check`).
3. **Test:**
- Run all unit and integration tests (`mvn verify`).

If you use GitHub Actions, GitLab CI, Jenkins, or another CI/CD tool, ensure your pipeline includes these steps. Example GitHub Actions workflow snippet:

```yaml
name: Java CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Maven
run: mvn clean package
- name: Run Checkstyle
run: mvn checkstyle:check
- name: Run Tests
run: mvn verify
```

> **Note:** Update the workflow as needed for your CI/CD environment. Always ensure that code style and tests pass before merging changes.

## Project Structure

The project follows standard Maven directory layout:
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/weather/app/WeatherApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public static void main(String[] args) {
return;
}



// Get the city name from command line arguments
String city = args[0];
LOGGER.log(Level.INFO, "Weather request for city: {0}", city);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/weather/app/ConfigUtilTest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test.java.com.weather.app;
package com.weather.app;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test.java.com.weather.app;
package com.weather.app;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/weather/app/WeatherAppTest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test.java.com.weather.app;
package com.weather.app;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/weather/app/WeatherAppTestSuite.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test.java.com.weather.app;
package com.weather.app;

import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/weather/app/WeatherServiceTest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test.java.com.weather.app;
package com.weather.app;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
Expand Down