У меня есть следующее [code]@RequestMapping public interface ExcludesOverriddenController {
@RequestMapping(value = "excludes/overridden", method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK) @ResponseBody @CsrfExempt String foo(); } public class ExcludesOverriddenControllerImpl implements ExcludesOverriddenController {
@Override public String foo() { return "Included due to excludes overridden property"; } } [/code] и следующий тест [code]@Category(IntegrationTest.class) @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = {TestExcludesOverriddenControllerConfig.class}) public class ExcludesOverriddenControllerIntegrationTest {
... @Before public void before() { ... when(exclOverriddenCtrlMock.foo()).thenReturn("Included due to excludes overridden property"); } @Test public void testAccess() throws Exception { mockMvc.perform(get("/excludes/overridden")).andExpect(status().isOk()).andExpect(content().string("Included due to excludes overridden property")); } } @Configuration @LocalProfile @Import(value = {WebMvcConfig.class, RootConfig.class, OtherConfiguration.class}) public class TestExcludesOverriddenControllerConfig {
@Bean public Application application() { return new TestApplication(); }
@Bean public ExcludesOverriddenControllerImpl getExcludesOverriddenControllerImpl() { return mock(ExcludesOverriddenControllerImpl.class); }
... } [/code] Когда я запускаю Mockito 4, он работает нормально и проходит, но в версии 5 содержимое представляет собой пустую строку. Что мне не хватает?
У меня есть ViewModel, куда мне нужно во время выполнения добавить некоторые параметры, но также и в этой ViewModel мне нужен репозиторий. Не уверен, что с помощью рукояти кинжала можно совместить Assisted Inject и Inject. Если я попытаюсь...
I need a little explanation of how Vite JS works on the build.
I'll tell you what it's about. I have a project with a CSS, images and JS folder in the resources folder. I also have a vendors folder where I have various JS and CSS libraries as well...