-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DC-1055: More Junit 5 migrations (#1677)
Migrate more unit tests to JUnit 5 - migrate all unit tests except for embedded database tests - where possible, tests were changed to not use a spring context - spring context tests were changed to use `@ContextConfiguration` to limit the number of autowired components
- Loading branch information
1 parent
d631a36
commit b9ff77b
Showing
25 changed files
with
1,107 additions
and
920 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
28 changes: 28 additions & 0 deletions
28
src/test/java/bio/terra/common/fixtures/UnitTestConfiguration.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,28 @@ | ||
package bio.terra.common.fixtures; | ||
|
||
import bio.terra.app.configuration.ApplicationConfiguration; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
@Profile("unittest") | ||
@Configuration | ||
public class UnitTestConfiguration { | ||
|
||
private final ObjectMapper objectMapper = new ApplicationConfiguration().objectMapper(); | ||
|
||
@Bean("tdrServiceAccountEmail") | ||
public String tdrServiceAccountEmail() { | ||
// Provide a default value for the service account email when running a spring-context aware | ||
// unit test to avoid having to set it in the test environment. | ||
return ""; | ||
} | ||
|
||
@Bean("objectMapper") | ||
public ObjectMapper objectMapper() { | ||
// Provide the same objectmapper that the application configuration provides. Without this, | ||
// the default Jackson objectmapper is used, which is configured differently. | ||
return objectMapper; | ||
} | ||
} |
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
Oops, something went wrong.