forked from springframeworkguru/tb2g-testing-spring
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
springframeworkguru#9: Spring web config with XML
- Loading branch information
Michiel Van Huyck
committed
Sep 20, 2022
1 parent
dc0b2cd
commit 7894543
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/test/java/org/springframework/samples/petclinic/web/OwnerControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.springframework.samples.petclinic.web; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.samples.petclinic.service.ClinicService; | ||
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; | ||
|
||
@SpringJUnitWebConfig(locations = {"classpath:spring/mvc-test-config.xml", "classpath:spring/mvc-core-config.xml"}) | ||
class OwnerControllerTest { | ||
|
||
@Autowired | ||
OwnerController ownerController; | ||
|
||
//autowired fromù XML bean mvc-test-config.xml | ||
@Autowired | ||
ClinicService clinicService; | ||
|
||
|
||
@Test | ||
void tempTest() { | ||
|
||
//ownerController | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://www.springframework.org/schema/beans" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
|
||
|
||
<bean class="org.mockito.Mockito" factory-method="mock"> | ||
<constructor-arg value="org.springframework.samples.petclinic.service.ClinicService"/> | ||
</bean> | ||
|
||
</beans> |