Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

springboot mongodb test

@RunWith(SpringRunner.class)
@DataMongoTest
public class FooRepositoryTest {

    @Autowired
    FooRepository fooRepository;

    @Before
    public void setUp() throws Exception {
        fooRepository.save(new Foo());
    }

    @Test
    public void shouldBeNotEmpty() {
        assertThat(fooRepository.findAll()).isNotEmpty();
    }
}



Dependencies

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
    <groupId>de.flapdoodle.embed</groupId>
    <artifactId>de.flapdoodle.embed.mongo</artifactId>
    <scope>test</scope>
</dependency>
Comment

PREVIOUS NEXT
Code Example
Java :: java long to integer 
Java :: how to return array in java 
Java :: java enum length 
Java :: runtime intalize array in java 
Java :: java solid principles 
Java :: java stream get all max values 
Java :: java string to number 
Java :: java math power 
Java :: java clone matrix 
Java :: pointers in java 
Java :: worldedit api paste schematic 
Java :: replace character in string java 
Java :: armstrong number in java 
Java :: java sort int array 
Java :: android studio edittext enter pressed 
Java :: como ordenar un arraylist alfabeticamente en java 
Java :: java variables 
Java :: java look and feel system 
Java :: java sample code 
Java :: java exception list 
Java :: quicksort for arraylist 
Java :: check if char is a space java 
Java :: android java get value from listview item 
Java :: character types java 
Java :: check first character of string is number java 
Java :: read wss endpoint java 
Java :: how to use a combo box in java with if else 
Java :: java get current index in for loop 
Java :: arraylist index java 
Java :: room library android 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =