-
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.
- Loading branch information
Showing
8 changed files
with
96 additions
and
9 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
38 changes: 38 additions & 0 deletions
38
src/test/java/dev/migwel/sts/domain/service/FromServiceFactoryTest.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,38 @@ | ||
package dev.migwel.sts.domain.service; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import dev.migwel.sts.Application; | ||
import dev.migwel.sts.domain.model.FromRequest; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; | ||
|
||
@SpringJUnitConfig(Application.class) | ||
class FromServiceFactoryTest { | ||
|
||
private final FromServiceFactory serviceFactory; | ||
|
||
@Autowired | ||
FromServiceFactoryTest(FromServiceFactory serviceFactory) { | ||
this.serviceFactory = serviceFactory; | ||
} | ||
|
||
@Test | ||
void getFromService() { | ||
Class<?>[] permittedSearchRequests = FromRequest.class.getPermittedSubclasses(); | ||
for (Class<?> permittedSearchRequest : permittedSearchRequests) { | ||
try { | ||
serviceFactory.getFromService( | ||
(Class<? extends FromRequest>) permittedSearchRequest); | ||
} catch (IllegalArgumentException e) { | ||
fail( | ||
"Exception occurred while trying to get from service for request: " | ||
+ permittedSearchRequest | ||
+ ". Reason: " | ||
+ e.getMessage()); | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...v/migwel/sts/service/FromServiceTest.java → ...l/sts/domain/service/FromServiceTest.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
38 changes: 38 additions & 0 deletions
38
src/test/java/dev/migwel/sts/domain/service/ToServiceFactoryTest.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,38 @@ | ||
package dev.migwel.sts.domain.service; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import dev.migwel.sts.Application; | ||
import dev.migwel.sts.domain.model.FromRequest; | ||
|
||
import dev.migwel.sts.domain.model.ToRequest; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; | ||
|
||
@SpringJUnitConfig(Application.class) | ||
class ToServiceFactoryTest { | ||
|
||
private final ToServiceFactory serviceFactory; | ||
|
||
@Autowired | ||
ToServiceFactoryTest(ToServiceFactory serviceFactory) { | ||
this.serviceFactory = serviceFactory; | ||
} | ||
|
||
@Test | ||
void getFromService() { | ||
Class<?>[] permittedSearchRequests = ToRequest.class.getPermittedSubclasses(); | ||
for (Class<?> permittedSearchRequest : permittedSearchRequests) { | ||
try { | ||
serviceFactory.getToService((Class<? extends ToRequest>) permittedSearchRequest); | ||
} catch (IllegalArgumentException e) { | ||
fail( | ||
"Exception occurred while trying to get to service for request: " | ||
+ permittedSearchRequest | ||
+ ". Reason: " | ||
+ e.getMessage()); | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...dev/migwel/sts/service/ToServiceTest.java → ...wel/sts/domain/service/ToServiceTest.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