Created
August 26, 2022 21:20
-
-
Save adgadev/61c9ff64ecec82c8260fec96f64564ea to your computer and use it in GitHub Desktop.
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
@Testcontainers | |
@SpringBootTest | |
@ActiveProfiles("dev") | |
class DevProfileDemoApplicationTest { | |
@Container | |
static MongoDBContainer mongoDBContainer = new MongoDBContainer("mongo:4.4.2"); | |
@DynamicPropertySource | |
static void setProperties(DynamicPropertyRegistry registry) { | |
registry.add("spring.data.mongodb.uri", mongoDBContainer::getReplicaSetUrl); | |
} | |
@Autowired | |
private HaloService haloService; | |
@Test | |
void shouldExecuteOperationOnMongo() { | |
HaloEntity haloEntity = haloService.addHalo("some name"); | |
assertNotNull(haloService.getHalo(haloEntity.getId())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment