Skip to content

Instantly share code, notes, and snippets.

@singun
Created April 17, 2019 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singun/6607e0004e1c271a6e7047cb40fbb1b9 to your computer and use it in GitHub Desktop.
Save singun/6607e0004e1c271a6e7047cb40fbb1b9 to your computer and use it in GitHub Desktop.
@ExtendWith(MockitoExtension.class)
class OwnerControllerTest {
@InjectMocks
OwnerController ownerController;
MockMvc mockMvc;
@BeforeEach
void setUp() {
mockMvc = MockMvcBuilders.standaloneSetup(ownerController).build();
}
@Test
void initCreationForm() throws Exception {
mockMvc.perform(get("/owners/new"))
.andExpect(status().isOk())
.andExpect(model().attributeExists("owner"))
.andExpect(view().name("owners/createOrUpdateOwnerForm"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment