-
Notifications
You must be signed in to change notification settings - Fork 6
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
Test/eKeiran #7
Open
eKeiran
wants to merge
3
commits into
gamedoora:main
Choose a base branch
from
eKeiran:test/eKeiran
base: main
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
Test/eKeiran #7
Changes from all commits
Commits
Show all changes
3 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 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,7 +1,6 @@ | ||
debug=false | ||
configserver.port=8082 | ||
spring.application.name=studioservice | ||
spring.application.name=studioservices | ||
spring.config.import=configserver:${CONFIG_SERVER} | ||
spring.jpa.open-in-view=false | ||
spring.flyway.baseline-on-migrate = true | ||
|
||
spring.flyway.baseline-on-migrate = true |
40 changes: 40 additions & 0 deletions
40
src/test/java/com/gamedoora/backend/studioservices/repository/StudioRepositoryTest.java
This file contains 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,40 @@ | ||
package com.gamedoora.backend.studioservices.repository; | ||
import com.gamedoora.model.dao.*; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
|
||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
@DataJpaTest(properties = {"spring.cloud.config.enabled=false"}) | ||
public class StudioRepositoryTest { | ||
|
||
@Autowired | ||
public StudioRepository studioRepository; | ||
|
||
@Test | ||
public void testFindByRegistration() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test looks good, just one addition, since it is a list, the recommended way is adding more than one object into the repository and then fetching them into the list and verify the size and properties of those studio object using assertEquals. |
||
Studios studio1 = Studios.builder().id(42).name("keera").registration(true).build(); | ||
Studios studio2 = Studios.builder().id(43).name("john").registration(true).build(); | ||
studioRepository.saveAll(List.of(studio1, studio2)); | ||
|
||
List<Studios> registeredStudios = studioRepository.findByRegistration(true); | ||
assertThat(registeredStudios).isNotEmpty(); | ||
assertEquals(2, registeredStudios.size()); | ||
} | ||
|
||
@Test | ||
public void testFindByVisibility() { | ||
Studios studio1 = Studios.builder().id(14).name("hd").visibility(true).build(); | ||
Studios studio2 = Studios.builder().id(15).name("smith").visibility(true).build(); | ||
studioRepository.saveAll(List.of(studio1, studio2)); | ||
|
||
List<Studios> visibleStudios = studioRepository.findByVisibility(true); | ||
assertThat(visibleStudios).isNotEmpty(); | ||
assertEquals(2, visibleStudios.size()); | ||
} | ||
|
||
} |
This file contains 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,15 @@ | ||
db.primary.url=jdbc:h2:mem:testdb1;MODE=PostgreSQL | ||
db.primary.password=pass | ||
db.primary.driver=org.h2.Driver | ||
db.primary.hbm2ddl.auto=create-drop | ||
db.primary.user=dh | ||
db.primary.hibernate.dialect=org.hibernate.dialect.H2Dialect | ||
|
||
spring.h2.console.enabled=true | ||
spring.jpa.hibernate.ddl-auto=create-drop | ||
spring.flyway.enabled=false | ||
keycloak.server.url=http://127.0.0.1:8082/u/auth | ||
keycloak.server.username=admin | ||
keycloak.server.password=admin | ||
keycloak.server.clientid= | ||
keycloak.server.realm=master |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain this change made in the assembler class, think of it this way: when I request findById() from the repository, Ids are unique so using a single object of Studio seems better than using list as there always going to be one object, it might be the case that I have missed out something so please update me if I missed out on anything