forked from springframeworkguru/tb2g-testing-spring
-
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.
springframeworkguru#7.2 : assignment adding properties
- Loading branch information
Michiel Van Huyck
committed
Sep 20, 2022
1 parent
21eac3c
commit 39fd847
Showing
3 changed files
with
39 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
say.word=LAUrel |
37 changes: 37 additions & 0 deletions
37
src/test/java/org/springframework/samples/petclinic/sfg/junit5/PropertiesLaurelTest.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,37 @@ | ||
package org.springframework.samples.petclinic.sfg.junit5; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.samples.petclinic.sfg.HearingInterpreter; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.TestPropertySource; | ||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* Created by jt on 2019-02-18. | ||
*/ | ||
@TestPropertySource("classpath:laurel.properties") | ||
@ActiveProfiles("laurel-properties") | ||
@SpringJUnitConfig(classes = PropertiesLaurelTest.TestConfig.class) | ||
public class PropertiesLaurelTest { | ||
|
||
@Configuration | ||
@ComponentScan("org.springframework.samples.petclinic.sfg") | ||
static class TestConfig { | ||
|
||
} | ||
|
||
@Autowired | ||
HearingInterpreter hearingInterpreter; | ||
|
||
@Test | ||
void whatIheard() { | ||
String word = hearingInterpreter.whatIheard(); | ||
|
||
assertEquals("LAUrel", word); | ||
} | ||
} |