-
Notifications
You must be signed in to change notification settings - Fork 113
test(food): add unit tests for FoodServiceImpl #103
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
Open
kushwahshivam
wants to merge
2
commits into
rdodiya:gssoc_develop
Choose a base branch
from
kushwahshivam:gssoc_develop
base: gssoc_develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,93 +1,90 @@ | ||
| plugins { | ||
| id 'java' | ||
| id 'org.springframework.boot' version '3.2.6' // Use 3.4.1 stable version , 3.2.x is the latest fully supported version by Springdoc, Security, JPA, Actuator, etc. | ||
| id 'io.spring.dependency-management' version '1.1.7' | ||
| id 'war' | ||
| } | ||
|
|
||
| group = 'com.restroly' | ||
| version = '0.0.1-SNAPSHOT' | ||
| description = 'Demo project for Spring Boot' | ||
|
|
||
| java { | ||
| toolchain { | ||
| languageVersion = JavaLanguageVersion.of(21) | ||
| } | ||
| } | ||
|
|
||
| configurations { | ||
| compileOnly { | ||
| extendsFrom annotationProcessor | ||
| } | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| // Define versions | ||
| ext { | ||
| lombokVersion = '1.18.34' | ||
| mapstructVersion = '1.6.3' | ||
| } | ||
|
|
||
| dependencies { | ||
| // Spring Boot Starters | ||
| implementation 'org.springframework.boot:spring-boot-starter-web' | ||
| implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
| implementation 'org.springframework.boot:spring-boot-starter-validation' | ||
| implementation 'org.springframework.boot:spring-boot-starter-websocket' | ||
| implementation 'org.springframework.boot:spring-boot-starter-security' | ||
| implementation 'org.springframework.boot:spring-boot-starter-aop' | ||
| implementation 'org.springframework.boot:spring-boot-starter-actuator' | ||
| implementation 'org.springframework.boot:spring-boot-starter-tomcat' | ||
| developmentOnly 'org.springframework.boot:spring-boot-devtools' | ||
|
|
||
| // Database | ||
| runtimeOnly 'org.postgresql:postgresql:42.7.2' | ||
|
|
||
| // Lombok - ORDER MATTERS! | ||
| compileOnly "org.projectlombok:lombok:${lombokVersion}" | ||
|
|
||
| // Annotation Processors - ORDER MATTERS! | ||
| annotationProcessor "org.projectlombok:lombok:${lombokVersion}" | ||
| annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" // ADD THIS | ||
| annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}" | ||
|
|
||
| // MapStruct | ||
| implementation "org.mapstruct:mapstruct:${mapstructVersion}" | ||
|
|
||
| // QR Code Generation | ||
| implementation 'com.google.zxing:core:3.5.2' | ||
| implementation 'com.google.zxing:javase:3.5.2' | ||
|
|
||
| implementation 'com.cloudinary:cloudinary-http44:1.39.0' | ||
|
|
||
| // Testing | ||
| testCompileOnly "org.projectlombok:lombok:${lombokVersion}" | ||
| testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}" | ||
| // testImplementation 'org.springframework.boot:spring-boot-starter-test'; | ||
| testImplementation 'org.springframework.security:spring-security-test'; | ||
|
|
||
| //OpenAPI Documentation | ||
| // https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui | ||
| implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' | ||
|
|
||
| // JWT | ||
| implementation 'io.jsonwebtoken:jjwt-api:0.12.3' | ||
| runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.3' | ||
| runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.3' | ||
|
|
||
| // Logging (JSON format for production) | ||
| implementation 'ch.qos.logback.contrib:logback-json-classic:0.1.5' | ||
| implementation 'ch.qos.logback.contrib:logback-jackson:0.1.5' | ||
| } | ||
|
|
||
| tasks.named('test') { | ||
| enabled = false | ||
| } | ||
|
|
||
|
|
||
| //tasks.withType<Test> { | ||
| // useJUnitPlatform() | ||
| //} | ||
| plugins { | ||
| id 'java' | ||
| id 'org.springframework.boot' version '3.2.6' // Use 3.4.1 stable version , 3.2.x is the latest fully supported version by Springdoc, Security, JPA, Actuator, etc. | ||
| id 'io.spring.dependency-management' version '1.1.7' | ||
| id 'war' | ||
| } | ||
|
|
||
| group = 'com.restroly' | ||
| version = '0.0.1-SNAPSHOT' | ||
| description = 'Demo project for Spring Boot' | ||
|
|
||
| java { | ||
| toolchain { | ||
| languageVersion = JavaLanguageVersion.of(21) | ||
| } | ||
| } | ||
|
|
||
| configurations { | ||
| compileOnly { | ||
| extendsFrom annotationProcessor | ||
| } | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| // Define versions | ||
| ext { | ||
| lombokVersion = '1.18.34' | ||
| mapstructVersion = '1.6.3' | ||
| } | ||
|
|
||
| dependencies { | ||
| // Spring Boot Starters | ||
| implementation 'org.springframework.boot:spring-boot-starter-web' | ||
| implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
| implementation 'org.springframework.boot:spring-boot-starter-validation' | ||
| implementation 'org.springframework.boot:spring-boot-starter-websocket' | ||
| implementation 'org.springframework.boot:spring-boot-starter-security' | ||
| implementation 'org.springframework.boot:spring-boot-starter-aop' | ||
| implementation 'org.springframework.boot:spring-boot-starter-actuator' | ||
| implementation 'org.springframework.boot:spring-boot-starter-tomcat' | ||
| developmentOnly 'org.springframework.boot:spring-boot-devtools' | ||
|
|
||
| // Database | ||
| runtimeOnly 'org.postgresql:postgresql:42.7.2' | ||
|
|
||
| // Lombok - ORDER MATTERS! | ||
| compileOnly "org.projectlombok:lombok:${lombokVersion}" | ||
|
|
||
| // Annotation Processors - ORDER MATTERS! | ||
| annotationProcessor "org.projectlombok:lombok:${lombokVersion}" | ||
| annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" // ADD THIS | ||
| annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}" | ||
|
|
||
| // MapStruct | ||
| implementation "org.mapstruct:mapstruct:${mapstructVersion}" | ||
|
|
||
| // QR Code Generation | ||
| implementation 'com.google.zxing:core:3.5.2' | ||
| implementation 'com.google.zxing:javase:3.5.2' | ||
|
|
||
| implementation 'com.cloudinary:cloudinary-http44:1.39.0' | ||
|
|
||
| // Testing | ||
| testCompileOnly "org.projectlombok:lombok:${lombokVersion}" | ||
| testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}" | ||
| testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
| testImplementation 'org.springframework.security:spring-security-test' | ||
| testRuntimeOnly 'com.h2database:h2' // In-memory DB for tests — no PostgreSQL needed | ||
|
|
||
| //OpenAPI Documentation | ||
| // https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui | ||
| implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' | ||
|
|
||
| // JWT | ||
| implementation 'io.jsonwebtoken:jjwt-api:0.12.3' | ||
| runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.3' | ||
| runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.3' | ||
|
|
||
| // Logging (JSON format for production) | ||
| implementation 'ch.qos.logback.contrib:logback-json-classic:0.1.5' | ||
| implementation 'ch.qos.logback.contrib:logback-jackson:0.1.5' | ||
| } | ||
|
|
||
| tasks.named('test') { | ||
| useJUnitPlatform() // required for JUnit 5 (Jupiter) | ||
| systemProperty 'spring.profiles.active', 'test' | ||
| } |
11 changes: 11 additions & 0 deletions
11
RestroHub/src/test/java/com/restroly/qrmenu/OrderServiceImplTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // This file is intentionally empty. | ||
| // The correct test file is at: | ||
| // src/test/java/com/restroly/qrmenu/order/service/OrderServiceImplTest.java | ||
| // | ||
| // This file was placed in the wrong package — please delete it. | ||
| package com.restroly.qrmenu; | ||
|
|
||
| public class OrderServiceImplTest { | ||
| // Please delete this file — it is in the wrong package. | ||
| // The real test is at: com.restroly.qrmenu.order.service.OrderServiceImplTest | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.