не удается импортировать SpringBootTest и SpringExtension - PullRequest
0 голосов
/ 08 февраля 2020

Я пытаюсь спроектировать свои первые тесты на постоянство для своего проекта, однако импорт SpringBootTest и SpringExtension не будет разрешен.

Моя IDE (Eclipse) не может предложить никаких предложений, кроме как вручную отредактировать путь сборки, но мне было бы неудобно делать это самостоятельно, потому что я действительно не знал, что добавить.

    package ca.mcgill.ecse321.petshelter.dao;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;


import ca.mcgill.ecse321.projectgroup16.Client;

@ExtendWith(SpringExtension.class)
@SpringBootTest
public class ProjectGroup16ApplicationPersistenceTests {


    @Autowired
    private ClientRepository clientRepository;



    @Test
    public void testCreateClientAndFind() {

        Client u = new Client(); 
        u.setName("joseph");
        u.setEmail("joseph.bouassaf@mail.mcgill.ca"); 

        clientRepository.save(u);



        Client b = clientRepository.findClientByEmail("joseph.bouassaf@mail.mcgill.ca");
        assertNotNull(b);
        assertEquals("joseph.bouassaf@mail.mcgill.ca",b.getEmail());
    }
}
...