Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
broken-petclinic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
s61200
broken-petclinic
Commits
827dc123
Commit
827dc123
authored
6 years ago
by
Dave Syer
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Remove redundant component scan filter"
This reverts commit
ab567242
.
parent
8472aa03
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+0
-2
0 additions, 2 deletions
.gitignore
src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java
+14
-22
14 additions, 22 deletions
...amework/samples/petclinic/service/ClinicServiceTests.java
with
14 additions
and
24 deletions
.gitignore
+
0
−
2
View file @
827dc123
...
...
@@ -2,8 +2,6 @@ target/*
.settings/*
.classpath
.project
.factorypath
.attach_pid*
.idea
*.iml
/target
...
...
This diff is collapsed.
Click to expand it.
src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java
+
14
−
22
View file @
827dc123
...
...
@@ -16,14 +16,16 @@
package
org.springframework.samples.petclinic.service
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
java.time.LocalDate
;
import
java.util.Collection
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.samples.petclinic.owner.Owner
;
import
org.springframework.samples.petclinic.owner.OwnerRepository
;
import
org.springframework.samples.petclinic.owner.Pet
;
...
...
@@ -33,32 +35,22 @@ import org.springframework.samples.petclinic.vet.Vet;
import
org.springframework.samples.petclinic.vet.VetRepository
;
import
org.springframework.samples.petclinic.visit.Visit
;
import
org.springframework.samples.petclinic.visit.VisitRepository
;
import
org.springframework.stereotype.Service
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.transaction.annotation.Transactional
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* Integration test of the Service and the Repository layer.
* <p>
* ClinicServiceSpringDataJpaTests subclasses benefit from the following services provided
* by the Spring TestContext Framework:
* </p>
* <ul>
* <li><strong>Spring IoC container caching</strong> which spares us unnecessary set up
* time between test execution.</li>
* <li><strong>Dependency Injection</strong> of test fixture instances, meaning that we
* don't need to perform application context lookups. See the use of
* {@link Autowired @Autowired} on the <code>{@link
* ClinicServiceTests#clinicService clinicService}</code> instance variable, which uses
* autowiring <em>by type</em>.
* <li><strong>Transaction management</strong>, meaning each test method is executed in
* its own transaction, which is automatically rolled back by default. Thus, even if tests
* insert or otherwise change database state, there is no need for a teardown or cleanup
* script.
* <li>An {@link org.springframework.context.ApplicationContext ApplicationContext} is
* also inherited and can be used for explicit bean lookup if necessary.</li>
* </ul>
* ClinicServiceSpringDataJpaTests subclasses benefit from the following services provided by the Spring
* TestContext Framework: </p> <ul> <li><strong>Spring IoC container caching</strong> which spares us unnecessary set up
* time between test execution.</li> <li><strong>Dependency Injection</strong> of test fixture instances, meaning that
* we don't need to perform application context lookups. See the use of {@link Autowired @Autowired} on the <code>{@link
* ClinicServiceTests#clinicService clinicService}</code> instance variable, which uses autowiring <em>by
* type</em>. <li><strong>Transaction management</strong>, meaning each test method is executed in its own transaction,
* which is automatically rolled back by default. Thus, even if tests insert or otherwise change database state, there
* is no need for a teardown or cleanup script. <li> An {@link org.springframework.context.ApplicationContext
* ApplicationContext} is also inherited and can be used for explicit bean lookup if necessary. </li> </ul>
*
* @author Ken Krebs
* @author Rod Johnson
...
...
@@ -69,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@RunWith
(
SpringRunner
.
class
)
@DataJpaTest
@DataJpaTest
(
includeFilters
=
@ComponentScan
.
Filter
(
Service
.
class
))
public
class
ClinicServiceTests
{
@Autowired
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment