From b2626bd509551b5ac467a06fb47fd88a0306cb3e Mon Sep 17 00:00:00 2001 From: Mic Date: Fri, 15 Feb 2013 09:53:47 +0800 Subject: [PATCH] reviewed Javadoc for abstract test classes --- .../AbstractOwnerRepositoryTests.java | 66 +++++---------- .../petclinic/AbstractPetRepositoryTests.java | 79 +++++------------- .../petclinic/AbstractVetRepositoryTests.java | 80 +++++-------------- .../AbstractVisitRepositoryTests.java | 80 +++++-------------- .../samples/petclinic/OwnerTests.java | 15 ++++ .../jdbc/JdbcOwnerRepositoryImplTests.java | 15 ++++ 6 files changed, 108 insertions(+), 227 deletions(-) diff --git a/src/test/java/org/springframework/samples/petclinic/AbstractOwnerRepositoryTests.java b/src/test/java/org/springframework/samples/petclinic/AbstractOwnerRepositoryTests.java index e274d38ec..1ad621ff0 100644 --- a/src/test/java/org/springframework/samples/petclinic/AbstractOwnerRepositoryTests.java +++ b/src/test/java/org/springframework/samples/petclinic/AbstractOwnerRepositoryTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.samples.petclinic; import static org.junit.Assert.assertEquals; @@ -10,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.model.Owner; import org.springframework.samples.petclinic.repository.OwnerRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; import org.springframework.transaction.annotation.Transactional; /** @@ -18,29 +32,10 @@ import org.springframework.transaction.annotation.Transactional; * Base class for {@link OwnerRepository} integration tests. *

*

- * "AbstractClinicTests-context.xml" declares a common - * {@link javax.sql.DataSource DataSource}. Subclasses should specify - * additional context locations which declare a - * {@link org.springframework.transaction.PlatformTransactionManager PlatformTransactionManager} - * and a concrete implementation of {@link OwnerRepository}. + * Subclasses should specify Spring context configuration using {@link ContextConfiguration @ContextConfiguration} annotation *

*

- * This class extends {@link AbstractTransactionalJUnit4SpringContextTests}, - * one of the valuable testing support classes provided by the - * Spring TestContext Framework found in the - * org.springframework.test.context package. The - * annotation-driven configuration used here represents best practice for - * integration tests with Spring. Note, however, that - * AbstractTransactionalJUnit4SpringContextTests serves only as a convenience - * for extension. For example, if you do not wish for your test classes to be - * tied to a Spring-specific class hierarchy, you may configure your tests with - * annotations such as {@link ContextConfiguration @ContextConfiguration}, - * {@link org.springframework.test.context.TestExecutionListeners @TestExecutionListeners}, - * {@link org.springframework.transaction.annotation.Transactional @Transactional}, - * etc. - *

- *

- * AbstractClinicTests and its subclasses benefit from the following services + * AbstractOwnerRepositoryTests and its subclasses benefit from the following services * provided by the Spring TestContext Framework: *

* - *

- * The Spring TestContext Framework and related unit and integration testing - * support classes are shipped in spring-test.jar. - *

* * @author Ken Krebs * @author Rod Johnson * @author Juergen Hoeller * @author Sam Brannen - * * @author Michael Isvy + * @author Michael Isvy */ public abstract class AbstractOwnerRepositoryTests { diff --git a/src/test/java/org/springframework/samples/petclinic/AbstractPetRepositoryTests.java b/src/test/java/org/springframework/samples/petclinic/AbstractPetRepositoryTests.java index fce671d4e..c43a4fc3c 100644 --- a/src/test/java/org/springframework/samples/petclinic/AbstractPetRepositoryTests.java +++ b/src/test/java/org/springframework/samples/petclinic/AbstractPetRepositoryTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.samples.petclinic; import static org.junit.Assert.assertEquals; @@ -13,79 +28,21 @@ import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.PetType; import org.springframework.samples.petclinic.repository.OwnerRepository; import org.springframework.samples.petclinic.repository.PetRepository; -import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.samples.petclinic.util.EntityUtils; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; import org.springframework.transaction.annotation.Transactional; /** *

- * Base class for {@link ClinicService} integration tests. + * Base class for {@link OwnerRepository} integration tests. *

*

- * "AbstractClinicTests-context.xml" declares a common - * {@link javax.sql.DataSource DataSource}. Subclasses should specify - * additional context locations which declare a - * {@link org.springframework.transaction.PlatformTransactionManager PlatformTransactionManager} - * and a concrete implementation of {@link ClinicService}. - *

- *

- * This class extends {@link AbstractTransactionalJUnit4SpringContextTests}, - * one of the valuable testing support classes provided by the - * Spring TestContext Framework found in the - * org.springframework.test.context package. The - * annotation-driven configuration used here represents best practice for - * integration tests with Spring. Note, however, that - * AbstractTransactionalJUnit4SpringContextTests serves only as a convenience - * for extension. For example, if you do not wish for your test classes to be - * tied to a Spring-specific class hierarchy, you may configure your tests with - * annotations such as {@link ContextConfiguration @ContextConfiguration}, - * {@link org.springframework.test.context.TestExecutionListeners @TestExecutionListeners}, - * {@link org.springframework.transaction.annotation.Transactional @Transactional}, - * etc. - *

- *

- * AbstractClinicTests and its subclasses benefit from the following services - * provided by the Spring TestContext Framework: - *

- * - *

- * The Spring TestContext Framework and related unit and integration testing - * support classes are shipped in spring-test.jar. - *

+ * see javadoc inside {@link AbstractOwnerRepositoryTests} for more details * * @author Ken Krebs * @author Rod Johnson * @author Juergen Hoeller * @author Sam Brannen + * @author Michael Isvy */ public abstract class AbstractPetRepositoryTests { diff --git a/src/test/java/org/springframework/samples/petclinic/AbstractVetRepositoryTests.java b/src/test/java/org/springframework/samples/petclinic/AbstractVetRepositoryTests.java index 0269aa75c..be5f10b6b 100644 --- a/src/test/java/org/springframework/samples/petclinic/AbstractVetRepositoryTests.java +++ b/src/test/java/org/springframework/samples/petclinic/AbstractVetRepositoryTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.samples.petclinic; import static org.junit.Assert.assertEquals; @@ -7,80 +22,23 @@ import java.util.Collection; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.model.Vet; +import org.springframework.samples.petclinic.repository.OwnerRepository; import org.springframework.samples.petclinic.repository.VetRepository; -import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.samples.petclinic.util.EntityUtils; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; import org.springframework.transaction.annotation.Transactional; /** *

- * Base class for {@link ClinicService} integration tests. + * Base class for {@link OwnerRepository} integration tests. *

*

- * "AbstractClinicTests-context.xml" declares a common - * {@link javax.sql.DataSource DataSource}. Subclasses should specify - * additional context locations which declare a - * {@link org.springframework.transaction.PlatformTransactionManager PlatformTransactionManager} - * and a concrete implementation of {@link ClinicService}. - *

- *

- * This class extends {@link AbstractTransactionalJUnit4SpringContextTests}, - * one of the valuable testing support classes provided by the - * Spring TestContext Framework found in the - * org.springframework.test.context package. The - * annotation-driven configuration used here represents best practice for - * integration tests with Spring. Note, however, that - * AbstractTransactionalJUnit4SpringContextTests serves only as a convenience - * for extension. For example, if you do not wish for your test classes to be - * tied to a Spring-specific class hierarchy, you may configure your tests with - * annotations such as {@link ContextConfiguration @ContextConfiguration}, - * {@link org.springframework.test.context.TestExecutionListeners @TestExecutionListeners}, - * {@link org.springframework.transaction.annotation.Transactional @Transactional}, - * etc. - *

- *

- * AbstractClinicTests and its subclasses benefit from the following services - * provided by the Spring TestContext Framework: - *

- * - *

- * The Spring TestContext Framework and related unit and integration testing - * support classes are shipped in spring-test.jar. - *

+ * see javadoc inside {@link AbstractVetRepositoryTests} for more details * * @author Ken Krebs * @author Rod Johnson * @author Juergen Hoeller * @author Sam Brannen + * @author Michael Isvy */ public abstract class AbstractVetRepositoryTests { diff --git a/src/test/java/org/springframework/samples/petclinic/AbstractVisitRepositoryTests.java b/src/test/java/org/springframework/samples/petclinic/AbstractVisitRepositoryTests.java index 1f769b8b6..e0d38767a 100644 --- a/src/test/java/org/springframework/samples/petclinic/AbstractVisitRepositoryTests.java +++ b/src/test/java/org/springframework/samples/petclinic/AbstractVisitRepositoryTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.samples.petclinic; import static org.junit.Assert.assertEquals; @@ -6,80 +21,23 @@ import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.Visit; +import org.springframework.samples.petclinic.repository.OwnerRepository; import org.springframework.samples.petclinic.repository.PetRepository; import org.springframework.samples.petclinic.repository.VisitRepository; -import org.springframework.samples.petclinic.service.ClinicService; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; import org.springframework.transaction.annotation.Transactional; /** *

- * Base class for {@link ClinicService} integration tests. + * Base class for {@link OwnerRepository} integration tests. *

*

- * "AbstractClinicTests-context.xml" declares a common - * {@link javax.sql.DataSource DataSource}. Subclasses should specify - * additional context locations which declare a - * {@link org.springframework.transaction.PlatformTransactionManager PlatformTransactionManager} - * and a concrete implementation of {@link ClinicService}. - *

- *

- * This class extends {@link AbstractTransactionalJUnit4SpringContextTests}, - * one of the valuable testing support classes provided by the - * Spring TestContext Framework found in the - * org.springframework.test.context package. The - * annotation-driven configuration used here represents best practice for - * integration tests with Spring. Note, however, that - * AbstractTransactionalJUnit4SpringContextTests serves only as a convenience - * for extension. For example, if you do not wish for your test classes to be - * tied to a Spring-specific class hierarchy, you may configure your tests with - * annotations such as {@link ContextConfiguration @ContextConfiguration}, - * {@link org.springframework.test.context.TestExecutionListeners @TestExecutionListeners}, - * {@link org.springframework.transaction.annotation.Transactional @Transactional}, - * etc. - *

- *

- * AbstractClinicTests and its subclasses benefit from the following services - * provided by the Spring TestContext Framework: - *

- * - *

- * The Spring TestContext Framework and related unit and integration testing - * support classes are shipped in spring-test.jar. - *

+ * see javadoc inside {@link AbstractVetRepositoryTests} for more details * * @author Ken Krebs * @author Rod Johnson * @author Juergen Hoeller * @author Sam Brannen + * @author Michael Isvy */ public abstract class AbstractVisitRepositoryTests { diff --git a/src/test/java/org/springframework/samples/petclinic/OwnerTests.java b/src/test/java/org/springframework/samples/petclinic/OwnerTests.java index c49c200b7..0932be6fa 100644 --- a/src/test/java/org/springframework/samples/petclinic/OwnerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/OwnerTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.samples.petclinic; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/org/springframework/samples/petclinic/jdbc/JdbcOwnerRepositoryImplTests.java b/src/test/java/org/springframework/samples/petclinic/jdbc/JdbcOwnerRepositoryImplTests.java index 453bf10f1..e222ce288 100644 --- a/src/test/java/org/springframework/samples/petclinic/jdbc/JdbcOwnerRepositoryImplTests.java +++ b/src/test/java/org/springframework/samples/petclinic/jdbc/JdbcOwnerRepositoryImplTests.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.samples.petclinic.jdbc; import org.junit.runner.RunWith;