Skip to content

Commit 0b765c1

Browse files
Merge pull request #3 from EficodeDemoOrg/demo
Fix test package importation
2 parents 2d05d58 + c00f645 commit 0b765c1

File tree

7 files changed

+65
-7
lines changed

7 files changed

+65
-7
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,66 @@ The project includes unit and integration tests.
105105
mvn verify
106106
```
107107

108+
## Linting and Code Style
109+
110+
This project uses [Checkstyle](https://checkstyle.org/) to enforce consistent code style and formatting.
111+
112+
* **Configuration:** The Checkstyle rules are defined in `checkstyle.xml` at the root of the repository.
113+
* **Key rules enforced:**
114+
- Maximum line length: 120 characters
115+
- Indentation: 4 spaces (no tabs)
116+
- Braces required for all control structures
117+
- Javadoc required for classes and methods
118+
- Naming conventions for variables, methods, constants, and packages
119+
* **How to run Checkstyle:**
120+
1. Make sure you are in the project root directory.
121+
2. Run the following Maven command:
122+
```bash
123+
mvn checkstyle:check
124+
```
125+
3. The build will fail if there are any style violations. To see a detailed report, run:
126+
```bash
127+
mvn checkstyle:checkstyle
128+
open target/site/checkstyle.html
129+
```
130+
4. Fix any reported issues before submitting code or opening a pull request.
131+
132+
## Continuous Integration / Continuous Delivery (CI/CD)
133+
134+
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:
135+
136+
1. **Build:**
137+
- Compile the code using Maven.
138+
2. **Lint:**
139+
- Run Checkstyle to enforce code style (`mvn checkstyle:check`).
140+
3. **Test:**
141+
- Run all unit and integration tests (`mvn verify`).
142+
143+
If you use GitHub Actions, GitLab CI, Jenkins, or another CI/CD tool, ensure your pipeline includes these steps. Example GitHub Actions workflow snippet:
144+
145+
```yaml
146+
name: Java CI
147+
on: [push, pull_request]
148+
jobs:
149+
build:
150+
runs-on: ubuntu-latest
151+
steps:
152+
- uses: actions/checkout@v3
153+
- name: Set up JDK 17
154+
uses: actions/setup-java@v3
155+
with:
156+
java-version: '17'
157+
distribution: 'temurin'
158+
- name: Build with Maven
159+
run: mvn clean package
160+
- name: Run Checkstyle
161+
run: mvn checkstyle:check
162+
- name: Run Tests
163+
run: mvn verify
164+
```
165+
166+
> **Note:** Update the workflow as needed for your CI/CD environment. Always ensure that code style and tests pass before merging changes.
167+
108168
## Project Structure
109169

110170
The project follows standard Maven directory layout:

src/main/java/com/weather/app/WeatherApp.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ public static void main(String[] args) {
6363
return;
6464
}
6565

66-
67-
6866
// Get the city name from command line arguments
6967
String city = args[0];
7068
LOGGER.log(Level.INFO, "Weather request for city: {0}", city);

src/test/java/com/weather/app/ConfigUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test.java.com.weather.app;
1+
package com.weather.app;
22

33
import org.junit.jupiter.api.Test;
44
import org.junit.jupiter.api.BeforeEach;

src/test/java/com/weather/app/OpenWeatherMapClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test.java.com.weather.app;
1+
package com.weather.app;
22

33
import org.junit.jupiter.api.BeforeEach;
44
import org.junit.jupiter.api.Test;

src/test/java/com/weather/app/WeatherAppTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test.java.com.weather.app;
1+
package com.weather.app;
22

33
import org.junit.jupiter.api.Test;
44
import org.junit.jupiter.api.BeforeEach;

src/test/java/com/weather/app/WeatherAppTestSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test.java.com.weather.app;
1+
package com.weather.app;
22

33
import org.junit.platform.suite.api.SelectPackages;
44
import org.junit.platform.suite.api.Suite;

src/test/java/com/weather/app/WeatherServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test.java.com.weather.app;
1+
package com.weather.app;
22

33
import org.junit.jupiter.api.Test;
44
import org.junit.jupiter.api.BeforeEach;

0 commit comments

Comments
 (0)