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
{ | |
"basics": { | |
"name": "Tester FOO", | |
"picture": "https://avataaar.welovedevs.com/png/?accessoriesType=Blank&eyeType=Wink&eyebrowType=DefaultNatural&facialHairColor=BrownDark&facialHairType=BeardMedium&mouthType=Smile&skinColor=Tanned&topType=NoHair&clotheType=GraphicShirt&clotheColor=W3D&graphicType=W3DLogo", | |
"title": "Auxiliaire de pilotage", | |
"summary": "Je suis un Tester FOO", | |
"location": { | |
"countryCode": "BR" | |
} | |
}, |
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
use std::collections::HashMap; | |
fn main() { | |
println!("Hello, world!"); | |
} | |
struct Dependencies { | |
deps : HashMap<String, Vec<String>> | |
} |
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
WITH upd AS ( | |
UPDATE target t | |
SET counter = t.counter + s.counter, | |
FROM source s | |
WHERE t.id = s.id | |
RETURNING s.id | |
) | |
INSERT INTO target(id, counter) | |
SELECT id, sum(counter) | |
FROM source s LEFT JOIN upd t USING(id) |
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
BEGIN; | |
DROP TABLE critical_data; | |
ROLLBACK; |
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
@SpringBootTest | |
@RunWith(SpringRunner.class) | |
public class ProductRepositoryTest { | |
@Autowired | |
private ProductRepository productRepo; | |
@SpyBean | |
private MongoTemplate mongoTemplate; | |
@Test |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
[...] | |
<dependency> | |
<groupId>de.flapdoodle.embed</groupId> | |
<artifactId>de.flapdoodle.embed.mongo</artifactId> | |
<scope>test</scope> | |
</dependency> | |
[...] |
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
ava.lang.AssertionError: | |
Expected size:<0> but was:<1> in: | |
<[Product(id=599cb8cde50e2262d67575c1, code=CODE, label=LABEL, description=DESCRIPTION, price=1234.0)]> | |
at com.github.lhauspie.mongodb.junit.demo.repository.ProductRepositoryIntegrationTest.searchProductTest(ProductRepositoryIntegrationTest.java:32) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
... |
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
@SpringBootTest | |
@RunWith(SpringRunner.class) | |
public class ProductRepositoryIntegrationTest { | |
@Autowired | |
private ProductRepository productRepo; | |
@Autowired | |
private MongoTemplate mongoTemplate; | |
@Test |
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
@TestConfiguration | |
public class MockedMongoConfig { | |
@Bean | |
public MongoTemplate mongoTemplate() { | |
MongoMappingContext mappingContext = new MongoMappingContext(); | |
MongoConverter mongoConverter = Mockito.mock(MongoConverter.class); | |
Mockito.when(mongoConverter.getMappingContext()).then(ignoredInvocation -> mappingContext); |
NewerOlder