Получение groovy.lang.MissingPropertyException при попытке запустить тест junit - PullRequest
0 голосов
/ 14 марта 2019

Это тест, который я запускаю, однако после выполнения кода он не проходит и выдает исключение для отсутствующего свойства.

package travelTests

import org.springframework.beans.factory.annotation.Autowired

import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.ResultActions
import org.springframework.web.context.WebApplicationContext
import static     org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get

import spock.lang.Shared
import spock.lang.Specification
import travel.TravelApp
import travel.controller.PlaceController
import travel.repository.RoleRepository
import travel.repository.StatusRepository
import travel.repository.UserRepository


@SpringBootTest(classes=[TravelApp.class,PlaceController.class])
class TransTest extends Specification{
@Autowired
UserRepository userRepo;

@Autowired
RoleRepository roleRepo;

@Autowired
StatusRepository todoRepo;

@Autowired
private WebApplicationContext wac;

private MockMvc mockMvc;
private ResultActions result;

@Shared
private boolean first = true;
@Shared
private int id = -1;


def "chooseaplace"() {
    given: "the controller is setup"
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build()
    when: "when choosing a location on  /addcountry/"
        result = this.mockMvc.perform(get("/Country/"))
    then: "I should see the view 'form/Country'"
        result.andExpect(view().name('form/Country'))}
}

При запуске этого кода показывается исключение.Куда я иду не так и что значит groovy.lang.MissingPropertyException no such property: MockMvcBuilders for class:travelTests.TransTest?

Спасибо

...