-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from AntonBabychP1T/test-impementation
Add test to BookService, CategoryService, BookController and Category…
- Loading branch information
Showing
24 changed files
with
1,109 additions
and
26 deletions.
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
6 changes: 2 additions & 4 deletions
6
src/main/java/store/bookstoreapp/dto/book/BookDtoWithoutCategoryIds.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
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
32 changes: 32 additions & 0 deletions
32
src/test/java/store/bookstoreapp/config/CustomMySqlContainer.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,32 @@ | ||
package store.bookstoreapp.config; | ||
|
||
import org.testcontainers.containers.MySQLContainer; | ||
|
||
public class CustomMySqlContainer extends MySQLContainer<CustomMySqlContainer> { | ||
private static final String DB_IMAGE = "mysql:8"; | ||
private static CustomMySqlContainer mySqlContainer; | ||
|
||
private CustomMySqlContainer() { | ||
super(DB_IMAGE); | ||
} | ||
|
||
public static synchronized CustomMySqlContainer getInstance() { | ||
if (mySqlContainer == null) { | ||
mySqlContainer = new CustomMySqlContainer(); | ||
} | ||
return mySqlContainer; | ||
} | ||
|
||
@Override | ||
public void start() { | ||
super.start(); | ||
System.setProperty("TEST_DB_URL", mySqlContainer.getJdbcUrl()); | ||
System.setProperty("TEST_DB_USERNAME", mySqlContainer.getUsername()); | ||
System.setProperty("TEST_DB_PASSWORD", mySqlContainer.getPassword()); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
|
||
} | ||
} |
Oops, something went wrong.