-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
19 changed files
with
365 additions
and
69 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
Binary file not shown.
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 |
---|---|---|
|
@@ -22,5 +22,4 @@ public static SessionFactory getSessionFactory() { | |
} | ||
return sessionFactory; | ||
} | ||
|
||
} |
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
4 changes: 4 additions & 0 deletions
4
src/main/java/org/longbox/persistence/stubdatabase/UserStubDbTest.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,4 @@ | ||
package org.longbox.persistence.stubdatabase; | ||
|
||
public class UserStubDbTest { | ||
} |
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,19 +1,97 @@ | ||
[{"user_id":6,"comic_book_id":1,"date_started":"2024-03-10T18:08:54.959"}, | ||
{"user_id":6,"comic_book_id":10,"date_started":"2024-03-10T18:09:11.459"}, | ||
{"user_id":6,"comic_book_id":21,"date_started":"2024-03-10T18:09:24.145"}, | ||
{"user_id":6,"comic_book_id":27,"date_started":"2024-03-10T18:09:28.183"}, | ||
{"user_id":1,"comic_book_id":5,"date_started":"2024-03-10T18:10:02.415"}, | ||
{"user_id":1,"comic_book_id":19,"date_started":"2024-03-10T18:10:22.265"}, | ||
{"user_id":1,"comic_book_id":24,"date_started":"2024-03-10T18:10:28.782"}, | ||
{"user_id":1,"comic_book_id":35,"date_started":"2024-03-10T18:10:44.147"}, | ||
{"user_id":4,"comic_book_id":5,"date_started":"2024-03-10T18:11:25.824"}, | ||
{"user_id":4,"comic_book_id":16,"date_started":"2024-03-10T18:11:34.679"}, | ||
{"user_id":4,"comic_book_id":24,"date_started":"2024-03-10T18:11:38.495"}, | ||
{"user_id":4,"comic_book_id":33,"date_started":"2024-03-10T18:11:53.08"}, | ||
{"user_id":2,"comic_book_id":15,"date_started":"2024-03-10T18:12:57.025"}, | ||
{"user_id":2,"comic_book_id":22,"date_started":"2024-03-10T18:13:00.802"}, | ||
{"user_id":2,"comic_book_id":8,"date_started":"2024-03-10T18:13:15.79"}, | ||
{"user_id":3,"comic_book_id":7,"date_started":"2024-03-10T18:13:55.67"}, | ||
{"user_id":3,"comic_book_id":18,"date_started":"2024-03-10T18:14:05.857"}, | ||
{"user_id":3,"comic_book_id":25,"date_started":"2024-03-10T18:14:13.846"}, | ||
{"user_id":3,"comic_book_id":31,"date_started":"2024-03-10T18:14:16.45"}] | ||
[ | ||
{ | ||
"user_id": 6, | ||
"comic_book_id": 1, | ||
"date_started": "2024-03-10T18:08:54.959" | ||
}, | ||
{ | ||
"user_id": 6, | ||
"comic_book_id": 10, | ||
"date_started": "2024-03-10T18:09:11.459" | ||
}, | ||
{ | ||
"user_id": 6, | ||
"comic_book_id": 21, | ||
"date_started": "2024-03-10T18:09:24.145" | ||
}, | ||
{ | ||
"user_id": 6, | ||
"comic_book_id": 27, | ||
"date_started": "2024-03-10T18:09:28.183" | ||
}, | ||
{ | ||
"user_id": 1, | ||
"comic_book_id": 5, | ||
"date_started": "2024-03-10T18:10:02.415" | ||
}, | ||
{ | ||
"user_id": 1, | ||
"comic_book_id": 19, | ||
"date_started": "2024-03-10T18:10:22.265" | ||
}, | ||
{ | ||
"user_id": 1, | ||
"comic_book_id": 24, | ||
"date_started": "2024-03-10T18:10:28.782" | ||
}, | ||
{ | ||
"user_id": 1, | ||
"comic_book_id": 35, | ||
"date_started": "2024-03-10T18:10:44.147" | ||
}, | ||
{ | ||
"user_id": 4, | ||
"comic_book_id": 5, | ||
"date_started": "2024-03-10T18:11:25.824" | ||
}, | ||
{ | ||
"user_id": 4, | ||
"comic_book_id": 16, | ||
"date_started": "2024-03-10T18:11:34.679" | ||
}, | ||
{ | ||
"user_id": 4, | ||
"comic_book_id": 24, | ||
"date_started": "2024-03-10T18:11:38.495" | ||
}, | ||
{ | ||
"user_id": 4, | ||
"comic_book_id": 33, | ||
"date_started": "2024-03-10T18:11:53.08" | ||
}, | ||
{ | ||
"user_id": 2, | ||
"comic_book_id": 15, | ||
"date_started": "2024-03-10T18:12:57.025" | ||
}, | ||
{ | ||
"user_id": 2, | ||
"comic_book_id": 22, | ||
"date_started": "2024-03-10T18:13:00.802" | ||
}, | ||
{ | ||
"user_id": 2, | ||
"comic_book_id": 8, | ||
"date_started": "2024-03-10T18:13:15.79" | ||
}, | ||
{ | ||
"user_id": 3, | ||
"comic_book_id": 7, | ||
"date_started": "2024-03-10T18:13:55.67" | ||
}, | ||
{ | ||
"user_id": 3, | ||
"comic_book_id": 18, | ||
"date_started": "2024-03-10T18:14:05.857" | ||
}, | ||
{ | ||
"user_id": 3, | ||
"comic_book_id": 25, | ||
"date_started": "2024-03-10T18:14:13.846" | ||
}, | ||
{ | ||
"user_id": 3, | ||
"comic_book_id": 31, | ||
"date_started": "2024-03-10T18:14:16.45" | ||
} | ||
] |
48 changes: 48 additions & 0 deletions
48
src/test/java/org/longbox/integration/persistence/dao/ComicBookFavoritesListDaoImplTest.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,48 @@ | ||
package org.longbox.integration.persistence.dao; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.longbox.businesslogic.exception.UserIDDoesNotExistException; | ||
import org.longbox.persistence.dao.ComicBookFavouritesListDaoImpl; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class ComicBookFavoritesListDaoImplTest { | ||
|
||
ComicBookFavouritesListDaoImpl favouritesListDao; | ||
|
||
@BeforeEach | ||
void setup() { | ||
favouritesListDao = new ComicBookFavouritesListDaoImpl(); | ||
favouritesListDao.removeFromFavorites(5L,30L); | ||
} | ||
|
||
@Test | ||
void saveToFavoritesTest() { | ||
try { | ||
favouritesListDao.removeFromFavorites(6L,20L); | ||
favouritesListDao.saveToFavorites(6L,20L); | ||
} catch (UserIDDoesNotExistException e) { | ||
throw new RuntimeException(e); | ||
} | ||
assertTrue(favouritesListDao.doesRecordExist(6L,20L)); | ||
} | ||
|
||
@Test | ||
void removeFromFavoritesTest() { | ||
try { | ||
favouritesListDao.saveToFavorites(5L,30L); | ||
favouritesListDao.removeFromFavorites(5L,30L); | ||
} catch (UserIDDoesNotExistException e) { | ||
throw new RuntimeException(e); | ||
} | ||
assertFalse(favouritesListDao.doesRecordExist(5L,30L)); | ||
} | ||
|
||
@Test | ||
void doesRecordExistTest() { | ||
assertFalse(favouritesListDao.doesRecordExist(5L,30L)); | ||
} | ||
|
||
} |
70 changes: 70 additions & 0 deletions
70
src/test/java/org/longbox/integration/persistence/dao/ComicBookFinishedListDaoImplTest.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,70 @@ | ||
package org.longbox.integration.persistence.dao; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.longbox.businesslogic.exception.UserIDDoesNotExistException; | ||
import org.longbox.persistence.dao.ComicBookFinishedListDaoImpl; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class ComicBookFinishedListDaoImplTest { | ||
ComicBookFinishedListDaoImpl finishedListDao; | ||
|
||
@BeforeEach | ||
void setup() { | ||
finishedListDao = new ComicBookFinishedListDaoImpl(); | ||
} | ||
|
||
/* | ||
* This test should always pass | ||
* The first run will not have an exception | ||
* The second run will not insert as it is already inserted but insertion will pass | ||
*/ | ||
@Test | ||
void saveToFinishedTest() { | ||
Long userId = 1L; | ||
Long comicId = 1L; | ||
try { | ||
finishedListDao.removeFromFinished(userId,comicId); | ||
finishedListDao.saveToFinished(userId, comicId); | ||
} catch (UserIDDoesNotExistException e) { | ||
throw new RuntimeException(e); | ||
} | ||
assertTrue(finishedListDao.doesRecordExist(userId,comicId)); | ||
} | ||
|
||
/* | ||
* This test should always pass | ||
* The first run will not have an exception | ||
* The second run will not insert as it is already inserted but insertion will pass | ||
*/ | ||
@Test | ||
void removeFromFinishedTest() { | ||
Long userId = 1L; | ||
Long comicId = 1L; | ||
try { | ||
finishedListDao.saveToFinished(userId, comicId); | ||
finishedListDao.removeFromFinished(userId,comicId); | ||
} catch (UserIDDoesNotExistException e) { | ||
throw new RuntimeException(e); | ||
} | ||
assertFalse(finishedListDao.doesRecordExist(userId,comicId)); | ||
} | ||
|
||
@Test | ||
void removeFromFinishedListNoRecord() { | ||
Long userId = 20L; | ||
Long comicId = 100L; | ||
finishedListDao.removeFromFinished(userId,comicId); | ||
assertTrue(true); | ||
} | ||
|
||
@Test | ||
void doesRecordExistNoRecord() { | ||
Long userId = 20L; | ||
Long comicId = 100L; | ||
assertFalse(finishedListDao.doesRecordExist(userId,comicId)); | ||
} | ||
|
||
} |
Oops, something went wrong.