diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..ae07c99a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,9 @@ +version: 2.1 + +orbs: + maven: circleci/maven@1.1 + +workflows: + maven_test: + jobs: + - maven/test diff --git a/README.md b/README.md index f3e94a56..ee4eba72 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,19 @@ For questions and help: * Or post in the Slack Community exclusive to the course. GitHub Issues will not be addressed. + + +## +- Very Simple beforeClass/each/test/after/afterall guru.springframework.sfgpetclinig.controllers.IndexControllerTest +- Group Assertions guru.springframework.sfgpetclinig.controllers.Person +- Nested Test Classes: guru.springframework.sfgpetclinic.services.map.OwnerMapServiceTest +- @RepeatedTest(x) : PersonRepeatedTest:... +- ParameterizedTests : OwnerTest + - quite useful + +## Tag annotation, to make groups of tests +- Annotate a Class or Method with @Tag. + - In IntelliJ, go to Run -> `Edit Configuration` -> Change `Class` to `Tag` and enter the Tag name. In the run dropdown (top-right) you can select different test groups + - In Maven + - In Gradle + diff --git a/pom.xml b/pom.xml index 9bd5d015..fe6656ef 100644 --- a/pom.xml +++ b/pom.xml @@ -65,6 +65,24 @@ ${junit-platform.version} test + + org.assertj + assertj-core + 3.18.1 + test + + + org.hamcrest + hamcrest-library + 2.2 + test + + + org.junit.jupiter + junit-jupiter-params + ${junit-platform.version} + test + @@ -82,6 +100,8 @@ --illegal-access=permit + + @@ -93,8 +113,32 @@ --illegal-access=permit + + + + integration-test + verify + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.8.2 + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.22.0 + + + + + \ No newline at end of file diff --git a/src/main/java/guru/springframework/sfgpetclinic/controllers/IndexController.java b/src/main/java/guru/springframework/sfgpetclinic/controllers/IndexController.java index 731a2119..31852445 100644 --- a/src/main/java/guru/springframework/sfgpetclinic/controllers/IndexController.java +++ b/src/main/java/guru/springframework/sfgpetclinic/controllers/IndexController.java @@ -8,6 +8,7 @@ public String index(){ } public String oupsHandler(){ - return "notimplemented"; + throw new ValueNotFoundException(); } + } diff --git a/src/main/java/guru/springframework/sfgpetclinic/controllers/ValueNotFoundException.java b/src/main/java/guru/springframework/sfgpetclinic/controllers/ValueNotFoundException.java new file mode 100644 index 00000000..3094c2c3 --- /dev/null +++ b/src/main/java/guru/springframework/sfgpetclinic/controllers/ValueNotFoundException.java @@ -0,0 +1,23 @@ +package guru.springframework.sfgpetclinic.controllers; + +public class ValueNotFoundException extends RuntimeException { + + public ValueNotFoundException() { + } + + public ValueNotFoundException(String message) { + super(message); + } + + public ValueNotFoundException(String message, Throwable cause) { + super(message, cause); + } + + public ValueNotFoundException(Throwable cause) { + super(cause); + } + + public ValueNotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/src/main/java/guru/springframework/sfgpetclinic/model/OwnerType.java b/src/main/java/guru/springframework/sfgpetclinic/model/OwnerType.java new file mode 100644 index 00000000..349ecbc5 --- /dev/null +++ b/src/main/java/guru/springframework/sfgpetclinic/model/OwnerType.java @@ -0,0 +1,5 @@ +package guru.springframework.sfgpetclinic.model; + +public enum OwnerType { + INDIVIDUAL, COMPANY +} diff --git a/src/main/java/guru/springframework/sfgpetclinic/services/map/VetMapService.java b/src/main/java/guru/springframework/sfgpetclinic/services/map/VetMapService.java index c94fe453..ff58920f 100644 --- a/src/main/java/guru/springframework/sfgpetclinic/services/map/VetMapService.java +++ b/src/main/java/guru/springframework/sfgpetclinic/services/map/VetMapService.java @@ -28,9 +28,9 @@ public Vet findById(Long id) { @Override public Vet save(Vet object) { - if (object.getSpecialities().size() > 0){ + if (object.getSpecialities() != null && object.getSpecialities().size() > 0) { object.getSpecialities().forEach(speciality -> { - if(speciality.getId() == null){ + if (speciality.getId() == null) { Speciality savedSpecialty = specialtyService.save(speciality); speciality.setId(savedSpecialty.getId()); } diff --git a/src/test/java/guru/springframework/sfgpetclinic/ControllerTests.java b/src/test/java/guru/springframework/sfgpetclinic/ControllerTests.java new file mode 100644 index 00000000..6c4bcce0 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/ControllerTests.java @@ -0,0 +1,22 @@ +package guru.springframework.sfgpetclinic; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.TestInstance; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS)// necessary for beforeAll, not for beforeEach +@Tag("Controllers") +public interface ControllerTests { + + @BeforeAll + default void beforeAll(){ + System.out.println("(0) Let's do something in the controller Interface"); + } + @BeforeEach + default void beforeEach(){ + System.out.println("(0.1) Let's do something in the controller Interface"); + } + + +} diff --git a/src/test/java/guru/springframework/sfgpetclinic/CustomArgsProvider.java b/src/test/java/guru/springframework/sfgpetclinic/CustomArgsProvider.java new file mode 100644 index 00000000..6d48e958 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/CustomArgsProvider.java @@ -0,0 +1,17 @@ +package guru.springframework.sfgpetclinic; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; + +import java.util.stream.Stream; + +public class CustomArgsProvider implements ArgumentsProvider { + @Override + public Stream provideArguments(ExtensionContext extensionContext) throws Exception { + return Stream.of( + Arguments.of("FL", 12, 21), + Arguments.of("OH", 22, 23), + Arguments.of("MI", 42, 26)); + } +} diff --git a/src/test/java/guru/springframework/sfgpetclinic/ModelRepeatedTests.java b/src/test/java/guru/springframework/sfgpetclinic/ModelRepeatedTests.java new file mode 100644 index 00000000..952e685c --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/ModelRepeatedTests.java @@ -0,0 +1,15 @@ +package guru.springframework.sfgpetclinic; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.RepetitionInfo; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.TestInfo; + +@Tag("RepeatedTests") +public interface ModelRepeatedTests { + + @BeforeEach + default void beforeEachConsoleOutputter(TestInfo testInfo, RepetitionInfo repetitionInfo){ + System.out.println("Running Test - "+testInfo.getDisplayName() + " - " + repetitionInfo.getTotalRepetitions()); + } +} diff --git a/src/test/java/guru/springframework/sfgpetclinic/ModelTests.java b/src/test/java/guru/springframework/sfgpetclinic/ModelTests.java new file mode 100644 index 00000000..0f3e1ec8 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/ModelTests.java @@ -0,0 +1,15 @@ +package guru.springframework.sfgpetclinic; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.TestInfo; + +@Tag("Models") +public interface ModelTests { + + + @BeforeEach + default void beforeEachConsoleOutputter(TestInfo testInfo){ + System.out.println("Running Test - "+testInfo.getDisplayName()); + } +} diff --git a/src/test/java/guru/springframework/sfgpetclinic/controllers/IndexControllerTest.java b/src/test/java/guru/springframework/sfgpetclinic/controllers/IndexControllerTest.java new file mode 100644 index 00000000..e8c82762 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/controllers/IndexControllerTest.java @@ -0,0 +1,105 @@ +package guru.springframework.sfgpetclinic.controllers; + +import guru.springframework.sfgpetclinic.ControllerTests; +import org.junit.jupiter.api.*; +import org.junit.jupiter.api.condition.*; + +import java.time.Duration; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +//@Tag("Controllers") <- now gets the tag from interface +class IndexControllerTest implements ControllerTests { + + + IndexController indexController; + + @BeforeEach + void setUp() { + indexController = new IndexController(); + } + + @Test + @DisplayName("Test proper View name is return for index page") + void index() { + assertEquals("index", this.indexController.index(), "Wrong view returned"); + assertThat(this.indexController.index()).isEqualTo("index"); + } + + @Test + @DisplayName("Test exception") + void oupsHandler() { + assertThrows(ValueNotFoundException.class, () -> { + this.indexController.oupsHandler(); + }); + } + + @Disabled("Demo of Timeout") + @Test + void testTimeOut() { + assertTimeout(Duration.ofMillis(100), () -> { + // runs in a single thread + Thread.sleep(2000); + System.out.println("I Got Here"); + }); + } + + @Disabled("Demo of Preemptive Timeout") + @Test + void testTimeOutPreempt() { + assertTimeoutPreemptively(Duration.ofMillis(100), () -> { + // runs in a separate thread + Thread.sleep(2000); + System.out.println("I sure not get here"); + }); + } + + @Disabled("Display Purposes only") + @Test + void testAssumptionTrue() { + // Assume doesn't have to be true; if assumption is false, this is not make the test fail + assumeTrue("GURU".equalsIgnoreCase(System.getenv("VARIABLE"))); + } + + @Test + void testAssumptionTrueAssumptionIsTrue() { + assumeTrue("GURU".equalsIgnoreCase("GURU")); + } + + @EnabledOnOs(OS.MAC) + @Test + public void runOnMac() { + } + + @EnabledOnOs(OS.WINDOWS) + @Test + public void runOnWindows() { + } + + @EnabledOnJre(JRE.JAVA_8) + @Test + public void runOnJava8() { + } + + @EnabledOnJre(JRE.JAVA_9) + @Test + public void runOnJava9() { + } + + @EnabledOnJre(JRE.JAVA_10) + @Test + public void runOnJava10() { + } + + @EnabledOnJre(JRE.JAVA_11) + @Test + public void runOnJava11() { + } + + @EnabledIfEnvironmentVariable(named = "HOME",matches = "ERR") + @Test + void testIfHomeIsErr(){} + +} \ No newline at end of file diff --git a/src/test/java/guru/springframework/sfgpetclinic/controllers/VetControllerTest.java b/src/test/java/guru/springframework/sfgpetclinic/controllers/VetControllerTest.java new file mode 100644 index 00000000..3a33d6e5 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/controllers/VetControllerTest.java @@ -0,0 +1,52 @@ +package guru.springframework.sfgpetclinic.controllers; + +import guru.springframework.sfgpetclinic.ControllerTests; +import guru.springframework.sfgpetclinic.fauxspring.Model; +import guru.springframework.sfgpetclinic.fauxspring.ModelMap; +import guru.springframework.sfgpetclinic.fauxspring.ModelMapImpl; +import guru.springframework.sfgpetclinic.model.Vet; +import guru.springframework.sfgpetclinic.services.SpecialtyService; +import guru.springframework.sfgpetclinic.services.VetService; +import guru.springframework.sfgpetclinic.services.map.SpecialityMapService; +import guru.springframework.sfgpetclinic.services.map.VetMapService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.*; + +//@Tag("Controllers") <- now gets the tag from interface +class VetControllerTest implements ControllerTests { + + VetService vetService; + SpecialtyService specialtyService; + + VetController vetController; + + @BeforeEach + void setUp() { + specialtyService = new SpecialityMapService(); + vetService = new VetMapService(specialtyService); + vetController = new VetController(vetService); + + Vet vet1 = new Vet(1L, "Joe", "Buck", null); + Vet vet2 = new Vet(2L, "Jimmy", "Smith", null); + + vetService.save(vet1); + vetService.save(vet2); + } + + @Test + void listVets() { + Model model = new ModelMapImpl(); + String view = vetController.listVets(model); + + assertThat("vets/index").isEqualTo(view); + + Set modelAtt = (Set) ((ModelMapImpl)model).getMap().get("vets"); + assertThat(modelAtt.size()).isEqualTo(2); + } +} \ No newline at end of file diff --git a/src/test/java/guru/springframework/sfgpetclinic/fauxspring/ModelMapImpl.java b/src/test/java/guru/springframework/sfgpetclinic/fauxspring/ModelMapImpl.java new file mode 100644 index 00000000..20df2512 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/fauxspring/ModelMapImpl.java @@ -0,0 +1,24 @@ +package guru.springframework.sfgpetclinic.fauxspring; + +import guru.springframework.sfgpetclinic.model.Pet; + +import java.util.HashMap; +import java.util.Map; + +public class ModelMapImpl implements Model{ + + private Map map = new HashMap<>(); + + @Override + public void addAttribute(String key, Object o) { + map.put(key, o); + } + + @Override + public void addAttribute(Object o) { + + } + + public Map getMap(){return this.map;} + +} diff --git a/src/test/java/guru/springframework/sfgpetclinic/model/OwnerTest.java b/src/test/java/guru/springframework/sfgpetclinic/model/OwnerTest.java new file mode 100644 index 00000000..e81ef09f --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/model/OwnerTest.java @@ -0,0 +1,91 @@ +package guru.springframework.sfgpetclinic.model; + + +import guru.springframework.sfgpetclinic.CustomArgsProvider; +import guru.springframework.sfgpetclinic.ModelTests; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.*; + +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertEquals; + +//@Tag("Models") <- now gets the tag from interface +public class OwnerTest implements ModelTests { + + @Test + public void dependentAssertions() { + Owner owner = new Owner(1L, "Joe", "Buck"); + owner.setCity("Key West"); + owner.setTelephone("0123456789"); + assertAll("Properties test", + () -> assertAll("Person Properties", + () -> assertEquals("Joe", owner.getFirstName(), "First name did not match"), + () -> assertEquals("Buck", owner.getLastName(), "Last name did not match")), + () -> assertAll("Owner Properties", + () -> assertEquals("Key West", owner.getCity(), "City did not match"), + () -> assertEquals("0123456789", owner.getTelephone(), "Phone number did not match") + )); + } + + + @DisplayName("Value Source Test ") + @ParameterizedTest(name = "{displayName} - [{index}] {arguments} ") + @ValueSource(strings = {"Spring", "Framework", "Guru"}) + void testValueSource(String val ){ + System.out.println(val); + } + + @DisplayName("Enum Source Test ") + @ParameterizedTest(name = "{displayName} - [{index}] {arguments} ") + @EnumSource(OwnerType.class) + void enumTest(OwnerType ownerType){ + System.out.println(ownerType); + + } + @DisplayName("CSV Input Test ") + @ParameterizedTest(name = "{displayName} - [{index}] {arguments} ") + @CsvSource({ + "FL, 1, 1", + "OH, 2, 2", + "MI, 3, 1" + }) + void csvInputTest(String stateName, int val1, int val2){ + System.out.println(stateName+":"+val1+":"+val2); + } + + @DisplayName("CSV from File Test ") + @ParameterizedTest(name = "{displayName} - [{index}] {arguments} ") + @CsvFileSource(resources = "/input.csv", numLinesToSkip = 1) + void csvFromFileTest(String stateName, int val1, int val2){ + System.out.println(stateName+":"+val1+":"+val2); + } + + @DisplayName("Method Provider Test ") + @ParameterizedTest(name = "{displayName} - [{index}] {arguments} ") + @MethodSource("getArgs") + void fromMethodTest(String stateName, int val1, int val2){ + System.out.println(stateName+":"+val1+":"+val2); + } + + static Stream getArgs(){ + return Stream.of( + Arguments.of("FL", 1, 1), + Arguments.of("OH", 2, 3), + Arguments.of("MI", 4, 6)); + } + + @DisplayName("Custom Provider Test ") + @ParameterizedTest(name = "{displayName} - [{index}] {arguments} ") + @ArgumentsSource(CustomArgsProvider.class) + void fromCustomProviderClass(String stateName, int val1, int val2){ + System.out.println(stateName+":"+val1+":"+val2); + } + + +} diff --git a/src/test/java/guru/springframework/sfgpetclinic/model/PersonRepeatedTest.java b/src/test/java/guru/springframework/sfgpetclinic/model/PersonRepeatedTest.java new file mode 100644 index 00000000..bad98c60 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/model/PersonRepeatedTest.java @@ -0,0 +1,27 @@ +package guru.springframework.sfgpetclinic.model; + +import guru.springframework.sfgpetclinic.ModelRepeatedTests; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.RepeatedTest; +import org.junit.jupiter.api.RepetitionInfo; +import org.junit.jupiter.api.TestInfo; + +public class PersonRepeatedTest implements ModelRepeatedTests { + @DisplayName("My Repeated Test") + @RepeatedTest(value = 10, name = "{displayName} : {currentRepetition} : {totalRepetitions}") + void myRepeatedTest(){ + System.out.println("Run x"); + } + + + @RepeatedTest(5) + void myRepeatedTestWithDI(TestInfo testInfo, RepetitionInfo repetitionInfo){ + System.out.println(testInfo.getDisplayName() + ":" + repetitionInfo.getCurrentRepetition()); + } + + @DisplayName("My Assignment Repeated Test") + @RepeatedTest(value = 5, name = "{displayName} : {currentRepetition} : {totalRepetitions}") + void myAssignmentRepeated(){ + + } +} diff --git a/src/test/java/guru/springframework/sfgpetclinic/model/PersonTest.java b/src/test/java/guru/springframework/sfgpetclinic/model/PersonTest.java new file mode 100644 index 00000000..9b4ad70f --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/model/PersonTest.java @@ -0,0 +1,38 @@ +package guru.springframework.sfgpetclinic.model; + +import guru.springframework.sfgpetclinic.ModelTests; +import org.junit.jupiter.api.*; + +import static org.junit.jupiter.api.Assertions.*; + +//@Tag("Models") <- now gets the tag from interface +class PersonTest implements ModelTests { + + @Test + public void groupedAssertions(){ + // given + Person person = new Person(1L, "Joe", "Buck"); + // when + + // then + assertAll("Test Props Set", + () -> assertEquals("Joe", person.getFirstName()), + () -> assertEquals("Buck", person.getLastName()) + ); + } + @Test + public void groupedAssertionsFail(){ + // given + Person person = new Person(1L, "Joe", "Buck"); + // when + + // then + assertAll("Test Props Set", + () -> assertEquals("Joe", person.getFirstName()), + () -> assertNotEquals("Buck2", person.getLastName()) + ); + } + + + +} \ No newline at end of file diff --git a/src/test/java/guru/springframework/sfgpetclinic/services/map/OwnerMapServiceTest.java b/src/test/java/guru/springframework/sfgpetclinic/services/map/OwnerMapServiceTest.java new file mode 100644 index 00000000..07ce7755 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/services/map/OwnerMapServiceTest.java @@ -0,0 +1,102 @@ +package guru.springframework.sfgpetclinic.services.map; + +import guru.springframework.sfgpetclinic.model.Owner; +import guru.springframework.sfgpetclinic.model.PetType; +import guru.springframework.sfgpetclinic.repositories.PetTypeRepository; +import guru.springframework.sfgpetclinic.services.PetService; +import guru.springframework.sfgpetclinic.services.PetTypeService; +import org.junit.jupiter.api.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.*; + +@DisplayName("Owner Map Service Test - ") +class OwnerMapServiceTest { + + OwnerMapService ownerMapService; + PetTypeService petTypeService; + PetService petService; + + @BeforeEach + void setUp() { + petTypeService = new PetTypeMapService(); + petService = new PetMapService(); + ownerMapService = new OwnerMapService(petTypeService, petService); + System.out.println("1) First Before each"); + } + + + @DisplayName("Verify Zero Owners") + @Test + public void ownersAreZero(){ + int ownerCount = ownerMapService.findAll().size(); + + assertThat(ownerCount).isZero(); + } + + @DisplayName("Pet Type - ") + @Nested // nested test class + class TestCreatePetTypes { + + @BeforeEach + void setUp(){ + PetType petType = new PetType(1L, "Dog"); + PetType petType2 = new PetType(2L, "Cat"); + petTypeService.save(petType); + petTypeService.save(petType2); + + System.out.println("2) Nested Before each"); + } + + @Test + void testPetCount(){ + int petTypeCount = petTypeService.findAll().size(); + assertThat(petTypeCount).isNotZero().isEqualTo(2); + } + + @DisplayName("Save Owners Tests - ") + @Nested + class SaveOwnersTests{ + + @BeforeEach + void setUp(){ + ownerMapService.save(new Owner(1L, "Before", "Each")); + System.out.println("3) Saved Owners Before Each"); + } + + @Test + void saveOwner(){ + Owner owner = new Owner(2L, "Joe", "Buck"); + Owner savedOwner = ownerMapService.save(owner); + assertThat(savedOwner).isNotNull(); + } + + @DisplayName("Save Owners Tests -") + @Nested + class FindOwnersTests{ + + @DisplayName("Find Owner") + @Test + void findOwner(){ + Owner foundOwner = ownerMapService.findById(1L); + assertThat(foundOwner).isNotNull(); + } + + @DisplayName("Find Owner not Found") + @Test + void findOwnerNotFound(){ + Owner foundOwner = ownerMapService.findById(2L); + + assertThat(foundOwner).isNull(); + } + } + } + } + + @DisplayName("Verify Still Zero") + @Test + public void ownersAreStillZero(){ + int ownerCount = ownerMapService.findAll().size(); + assertThat(ownerCount).isZero(); + } +} \ No newline at end of file diff --git a/src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa/OwnerSDJpaServiceTest.java b/src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa/OwnerSDJpaServiceTest.java new file mode 100644 index 00000000..5f937392 --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa/OwnerSDJpaServiceTest.java @@ -0,0 +1,49 @@ +package guru.springframework.sfgpetclinic.services.springdatajpa; + +import guru.springframework.sfgpetclinic.model.Owner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +@Disabled(value = "Disabled until later") +class OwnerSDJpaServiceTest { + + OwnerSDJpaService service; + + @BeforeEach + void setUp() { + service = new OwnerSDJpaService(null, null ,null); + } + + @Disabled + @Test + void findByLastName() { + Owner foundOwner = service.findByLastName("Buck"); + } + + @Test + void findAllByLastNameLike() { + } + + @Test + void findAll() { + } + + @Test + void findById() { + } + + @Test + void save() { + } + + @Test + void delete() { + } + + @Test + void deleteById() { + } +} \ No newline at end of file diff --git a/src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa/PetSDJpaServiceIT.java b/src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa/PetSDJpaServiceIT.java new file mode 100644 index 00000000..335c2b8e --- /dev/null +++ b/src/test/java/guru/springframework/sfgpetclinic/services/springdatajpa/PetSDJpaServiceIT.java @@ -0,0 +1,36 @@ +package guru.springframework.sfgpetclinic.services.springdatajpa; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import static org.junit.jupiter.api.Assertions.*; + + +//@ExtendWith() +class PetSDJpaServiceIT { + + @BeforeEach + void setUp() { + } + + @Test + void findAll() { + } + + @Test + void findById() { + } + + @Test + void save() { + } + + @Test + void delete() { + } + + @Test + void deleteById() { + } +} \ No newline at end of file diff --git a/src/test/resources/input.csv b/src/test/resources/input.csv new file mode 100644 index 00000000..359022ba --- /dev/null +++ b/src/test/resources/input.csv @@ -0,0 +1,4 @@ +state, val1, val2 +FL, 1, 2 +OH, 2, 3 +MI, 3, 4 \ No newline at end of file