Best Powermock code snippet using samples.Service
Source:ClinicServiceTests.java  
...14 * limitations under the License.15 */16package org.springframework.samples.petclinic.service;17/**18 * Integration test of the Service and the Repository layer.19 * <p>20 * ClinicServiceSpringDataJpaTests subclasses benefit from the following services provided by the Spring21 * TestContext Framework: </p> <ul> <li><strong>Spring IoC container caching</strong> which spares us unnecessary set up22 * time between test execution.</li> <li><strong>Dependency Injection</strong> of test fixture instances, meaning that23 * we don't need to perform application context lookups. See the use of {@link Autowired @Autowired} on the <code>{@link24 * ClinicServiceTests#clinicService clinicService}</code> instance variable, which uses autowiring <em>by25 * type</em>. <li><strong>Transaction management</strong>, meaning each test method is executed in its own transaction,26 * which is automatically rolled back by default. Thus, even if tests insert or otherwise change database state, there27 * is no need for a teardown or cleanup script. <li> An {@link org.springframework.context.ApplicationContext28 * ApplicationContext} is also inherited and can be used for explicit bean lookup if necessary. </li> </ul>29 *30 * @author Ken Krebs31 * @author Rod Johnson32 * @author Juergen Hoeller33 * @author Sam Brannen34 * @author Michael Isvy35 * @author Dave Syer36 */37@org.junit.runner.RunWith(org.springframework.test.context.junit4.SpringRunner.class)38@org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest(includeFilters = @org.springframework.context.annotation.ComponentScan.Filter(org.springframework.stereotype.Service.class))39public class ClinicServiceTests {40    @org.springframework.beans.factory.annotation.Autowired41    protected org.springframework.samples.petclinic.owner.OwnerRepository owners;42    @org.springframework.beans.factory.annotation.Autowired43    protected org.springframework.samples.petclinic.owner.PetRepository pets;44    @org.springframework.beans.factory.annotation.Autowired45    protected org.springframework.samples.petclinic.visit.VisitRepository visits;46    @org.springframework.beans.factory.annotation.Autowired47    protected org.springframework.samples.petclinic.vet.VetRepository vets;48    @org.junit.Test49    public void shouldFindOwnersByLastName() {50        java.util.Collection<org.springframework.samples.petclinic.owner.Owner> owners = eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|1", java.util.Collection.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|0", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findByLastName("Davis"));51        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|3", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|2", java.util.Collection.class, owners).size())).isEqualTo(2);52        eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|5", java.util.Collection.class, (owners = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|4", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findByLastName("Daviss")));53        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|7", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindOwnersByLastName()|6", java.util.Collection.class, owners).isEmpty())).isTrue();54    }55    @org.junit.Test56    public void shouldFindSingleOwnerWithPet() {57        org.springframework.samples.petclinic.owner.Owner owner = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|1", org.springframework.samples.petclinic.owner.Owner.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|0", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findById(1));58        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|3", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|2", org.springframework.samples.petclinic.owner.Owner.class, owner).getLastName())).startsWith("Franklin");59        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|6", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.Pet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|5", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|4", org.springframework.samples.petclinic.owner.Owner.class, owner).getPets()).size())).isEqualTo(1);60        eu.stamp_project.reneri.instrumentation.StateObserver.<org.assertj.core.api.ObjectAssert<org.springframework.samples.petclinic.owner.PetType>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|12", org.assertj.core.api.ObjectAssert.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.assertj.core.api.ObjectAssert<org.springframework.samples.petclinic.owner.PetType>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|11", org.assertj.core.api.ObjectAssert.class, org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetType>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|10", org.springframework.samples.petclinic.owner.PetType.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|9", org.springframework.samples.petclinic.owner.Pet.class, eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.Pet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|8", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|7", org.springframework.samples.petclinic.owner.Owner.class, owner).getPets()).get(0)).getType()))).isNotNull());61        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|17", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetType>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|16", org.springframework.samples.petclinic.owner.PetType.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|15", org.springframework.samples.petclinic.owner.Pet.class, eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.Pet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|14", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindSingleOwnerWithPet()|13", org.springframework.samples.petclinic.owner.Owner.class, owner).getPets()).get(0)).getType()).getName())).isEqualTo("cat");62    }63    @org.junit.Test64    @org.springframework.transaction.annotation.Transactional65    public void shouldInsertOwner() {66        java.util.Collection<org.springframework.samples.petclinic.owner.Owner> owners = eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|1", java.util.Collection.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|0", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findByLastName("Schultz"));67        int found = eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|3", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|2", java.util.Collection.class, owners).size());68        org.springframework.samples.petclinic.owner.Owner owner = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|4", org.springframework.samples.petclinic.owner.Owner.class, new org.springframework.samples.petclinic.owner.Owner());69        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|5", org.springframework.samples.petclinic.owner.Owner.class, owner).setFirstName("Sam");70        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|6", org.springframework.samples.petclinic.owner.Owner.class, owner).setLastName("Schultz");71        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|7", org.springframework.samples.petclinic.owner.Owner.class, owner).setAddress("4, Evans Street");72        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|8", org.springframework.samples.petclinic.owner.Owner.class, owner).setCity("Wollongong");73        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|9", org.springframework.samples.petclinic.owner.Owner.class, owner).setTelephone("4444444444");74        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|10", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).save(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|11", org.springframework.samples.petclinic.owner.Owner.class, owner));75        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|14", eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|13", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|12", org.springframework.samples.petclinic.owner.Owner.class, owner).getId()).longValue())).isNotEqualTo(0);76        eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|16", java.util.Collection.class, (owners = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|15", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findByLastName("Schultz")));77        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|18", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.Owner>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|17", java.util.Collection.class, owners).size())).isEqualTo(((eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertOwner()|19", found)) + 1));78    }79    @org.junit.Test80    @org.springframework.transaction.annotation.Transactional81    public void shouldUpdateOwner() {82        org.springframework.samples.petclinic.owner.Owner owner = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|1", org.springframework.samples.petclinic.owner.Owner.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|0", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findById(1));83        java.lang.String oldLastName = eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|3", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|2", org.springframework.samples.petclinic.owner.Owner.class, owner).getLastName());84        java.lang.String newLastName = (eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|4", oldLastName)) + "X";85        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|5", org.springframework.samples.petclinic.owner.Owner.class, owner).setLastName(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|6", newLastName));86        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|7", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).save(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|8", org.springframework.samples.petclinic.owner.Owner.class, owner));87        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|10", org.springframework.samples.petclinic.owner.Owner.class, // retrieving new name from database88        (owner = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|9", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findById(1)));89        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|12", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|11", org.springframework.samples.petclinic.owner.Owner.class, owner).getLastName())).isEqualTo(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdateOwner()|13", newLastName));90    }91    @org.junit.Test92    public void shouldFindPetWithCorrectId() {93        org.springframework.samples.petclinic.owner.Pet pet7 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindPetWithCorrectId()|1", org.springframework.samples.petclinic.owner.Pet.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindPetWithCorrectId()|0", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).findById(7));94        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindPetWithCorrectId()|3", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindPetWithCorrectId()|2", org.springframework.samples.petclinic.owner.Pet.class, pet7).getName())).startsWith("Samantha");95        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindPetWithCorrectId()|6", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindPetWithCorrectId()|5", org.springframework.samples.petclinic.owner.Owner.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindPetWithCorrectId()|4", org.springframework.samples.petclinic.owner.Pet.class, pet7).getOwner()).getFirstName())).isEqualTo("Jean");96    }97    @org.junit.Test98    public void shouldFindAllPetTypes() {99        java.util.Collection<org.springframework.samples.petclinic.owner.PetType> petTypes = eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.PetType>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|1", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|0", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).findPetTypes());100        org.springframework.samples.petclinic.owner.PetType petType1 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetType>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|3", org.springframework.samples.petclinic.owner.PetType.class, org.springframework.samples.petclinic.service.EntityUtils.getById(eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.PetType>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|2", java.util.Collection.class, petTypes), org.springframework.samples.petclinic.owner.PetType.class, 1));101        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|5", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetType>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|4", org.springframework.samples.petclinic.owner.PetType.class, petType1).getName())).isEqualTo("cat");102        org.springframework.samples.petclinic.owner.PetType petType4 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetType>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|7", org.springframework.samples.petclinic.owner.PetType.class, org.springframework.samples.petclinic.service.EntityUtils.getById(eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.PetType>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|6", java.util.Collection.class, petTypes), org.springframework.samples.petclinic.owner.PetType.class, 4));103        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|9", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetType>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindAllPetTypes()|8", org.springframework.samples.petclinic.owner.PetType.class, petType4).getName())).isEqualTo("snake");104    }105    @org.junit.Test106    @org.springframework.transaction.annotation.Transactional107    public void shouldInsertPetIntoDatabaseAndGenerateId() {108        org.springframework.samples.petclinic.owner.Owner owner6 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|1", org.springframework.samples.petclinic.owner.Owner.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|0", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findById(6));109        int found = eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|4", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.Pet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|3", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|2", org.springframework.samples.petclinic.owner.Owner.class, owner6).getPets()).size());110        org.springframework.samples.petclinic.owner.Pet pet = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|5", org.springframework.samples.petclinic.owner.Pet.class, new org.springframework.samples.petclinic.owner.Pet());111        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|6", org.springframework.samples.petclinic.owner.Pet.class, pet).setName("bowser");112        java.util.Collection<org.springframework.samples.petclinic.owner.PetType> types = eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.PetType>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|8", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|7", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).findPetTypes());113        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|9", org.springframework.samples.petclinic.owner.Pet.class, pet).setType(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetType>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|11", org.springframework.samples.petclinic.owner.PetType.class, org.springframework.samples.petclinic.service.EntityUtils.getById(eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.owner.PetType>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|10", java.util.Collection.class, types), org.springframework.samples.petclinic.owner.PetType.class, 2)));114        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|12", org.springframework.samples.petclinic.owner.Pet.class, pet).setBirthDate(eu.stamp_project.reneri.instrumentation.StateObserver.<java.time.LocalDate>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|13", java.time.LocalDate.class, java.time.LocalDate.now()));115        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|14", org.springframework.samples.petclinic.owner.Owner.class, owner6).addPet(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|15", org.springframework.samples.petclinic.owner.Pet.class, pet));116        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|18", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.Pet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|17", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|16", org.springframework.samples.petclinic.owner.Owner.class, owner6).getPets()).size())).isEqualTo(((eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|19", found)) + 1));117        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|20", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).save(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|21", org.springframework.samples.petclinic.owner.Pet.class, pet));118        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|22", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).save(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|23", org.springframework.samples.petclinic.owner.Owner.class, owner6));119        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|25", org.springframework.samples.petclinic.owner.Owner.class, (owner6 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.OwnerRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|24", org.springframework.samples.petclinic.owner.OwnerRepository.class, this.owners).findById(6)));120        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|28", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.owner.Pet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|27", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Owner>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|26", org.springframework.samples.petclinic.owner.Owner.class, owner6).getPets()).size())).isEqualTo(((eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|29", found)) + 1));121        // checks that id has been generated122        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|31", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldInsertPetIntoDatabaseAndGenerateId()|30", org.springframework.samples.petclinic.owner.Pet.class, pet).getId())).isNotNull();123    }124    @org.junit.Test125    @org.springframework.transaction.annotation.Transactional126    public void shouldUpdatePetName() throws java.lang.Exception {127        org.springframework.samples.petclinic.owner.Pet pet7 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|1", org.springframework.samples.petclinic.owner.Pet.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|0", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).findById(7));128        java.lang.String oldName = eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|3", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|2", org.springframework.samples.petclinic.owner.Pet.class, pet7).getName());129        java.lang.String newName = (eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|4", oldName)) + "X";130        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|5", org.springframework.samples.petclinic.owner.Pet.class, pet7).setName(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|6", newName));131        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|7", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).save(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|8", org.springframework.samples.petclinic.owner.Pet.class, pet7));132        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|10", org.springframework.samples.petclinic.owner.Pet.class, (pet7 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|9", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).findById(7)));133        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|12", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|11", org.springframework.samples.petclinic.owner.Pet.class, pet7).getName())).isEqualTo(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldUpdatePetName()|13", newName));134    }135    @org.junit.Test136    public void shouldFindVets() {137        java.util.Collection<org.springframework.samples.petclinic.vet.Vet> vets = eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.vet.Vet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|1", java.util.Collection.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.VetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|0", org.springframework.samples.petclinic.vet.VetRepository.class, this.vets).findAll());138        org.springframework.samples.petclinic.vet.Vet vet = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.Vet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|3", org.springframework.samples.petclinic.vet.Vet.class, org.springframework.samples.petclinic.service.EntityUtils.getById(eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.vet.Vet>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|2", java.util.Collection.class, vets), org.springframework.samples.petclinic.vet.Vet.class, 3));139        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|5", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.Vet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|4", org.springframework.samples.petclinic.vet.Vet.class, vet).getLastName())).isEqualTo("Douglas");140        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|7", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.Vet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|6", org.springframework.samples.petclinic.vet.Vet.class, vet).getNrOfSpecialties())).isEqualTo(2);141        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|11", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.Specialty>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|10", org.springframework.samples.petclinic.vet.Specialty.class, eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.vet.Specialty>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|9", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.Vet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|8", org.springframework.samples.petclinic.vet.Vet.class, vet).getSpecialties()).get(0)).getName())).isEqualTo("dentistry");142        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|15", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.Specialty>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|14", org.springframework.samples.petclinic.vet.Specialty.class, eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.vet.Specialty>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|13", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.vet.Vet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVets()|12", org.springframework.samples.petclinic.vet.Vet.class, vet).getSpecialties()).get(1)).getName())).isEqualTo("surgery");143    }144    @org.junit.Test145    @org.springframework.transaction.annotation.Transactional146    public void shouldAddNewVisitForPet() {147        org.springframework.samples.petclinic.owner.Pet pet7 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|1", org.springframework.samples.petclinic.owner.Pet.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|0", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).findById(7));148        int found = eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|4", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.visit.Visit>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|3", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|2", org.springframework.samples.petclinic.owner.Pet.class, pet7).getVisits()).size());149        org.springframework.samples.petclinic.visit.Visit visit = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|5", org.springframework.samples.petclinic.visit.Visit.class, new org.springframework.samples.petclinic.visit.Visit());150        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|6", org.springframework.samples.petclinic.owner.Pet.class, pet7).addVisit(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|7", org.springframework.samples.petclinic.visit.Visit.class, visit));151        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|8", org.springframework.samples.petclinic.visit.Visit.class, visit).setDescription("test");152        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.VisitRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|9", org.springframework.samples.petclinic.visit.VisitRepository.class, this.visits).save(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|10", org.springframework.samples.petclinic.visit.Visit.class, visit));153        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|11", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).save(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|12", org.springframework.samples.petclinic.owner.Pet.class, pet7));154        eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|14", org.springframework.samples.petclinic.owner.Pet.class, (pet7 = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.PetRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|13", org.springframework.samples.petclinic.owner.PetRepository.class, this.pets).findById(7)));155        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|17", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.visit.Visit>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|16", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.owner.Pet>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|15", org.springframework.samples.petclinic.owner.Pet.class, pet7).getVisits()).size())).isEqualTo(((eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|18", found)) + 1));156        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|20", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldAddNewVisitForPet()|19", org.springframework.samples.petclinic.visit.Visit.class, visit).getId())).isNotNull();157    }158    @org.junit.Test159    public void shouldFindVisitsByPetId() throws java.lang.Exception {160        java.util.Collection<org.springframework.samples.petclinic.visit.Visit> visits = eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.List<org.springframework.samples.petclinic.visit.Visit>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|1", java.util.List.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.VisitRepository>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|0", org.springframework.samples.petclinic.visit.VisitRepository.class, this.visits).findByPetId(7));161        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|3", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.visit.Visit>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|2", java.util.Collection.class, visits).size())).isEqualTo(2);162        org.springframework.samples.petclinic.visit.Visit[] visitArr = eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit[]>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|8", org.springframework.samples.petclinic.visit.Visit[].class, eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.visit.Visit>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|4", java.util.Collection.class, visits).toArray(eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit[]>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|7", org.springframework.samples.petclinic.visit.Visit[].class, new org.springframework.samples.petclinic.visit.Visit[eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|6", eu.stamp_project.reneri.instrumentation.StateObserver.<java.util.Collection<org.springframework.samples.petclinic.visit.Visit>>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|5", java.util.Collection.class, visits).size())])));163        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.<java.time.LocalDate>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|11", java.time.LocalDate.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|10", org.springframework.samples.petclinic.visit.Visit.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit[]>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|9", org.springframework.samples.petclinic.visit.Visit[].class, visitArr)[0]).getDate())).isNotNull();164        org.assertj.core.api.Assertions.assertThat(eu.stamp_project.reneri.instrumentation.StateObserver.observe("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|14", eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|13", org.springframework.samples.petclinic.visit.Visit.class, eu.stamp_project.reneri.instrumentation.StateObserver.<org.springframework.samples.petclinic.visit.Visit[]>observeState("org.springframework.samples.petclinic.service.ClinicServiceTests|shouldFindVisitsByPetId()|12", org.springframework.samples.petclinic.visit.Visit[].class, visitArr)[0]).getPetId())).isEqualTo(7);165    }166}...Source:ControllerModule.java  
...33import com.shipdream.lib.android.mvc.samples.benchmark.controller.internal.Controller6Impl;34import com.shipdream.lib.android.mvc.samples.benchmark.controller.internal.Controller7Impl;35import com.shipdream.lib.android.mvc.samples.benchmark.controller.internal.Controller8Impl;36import com.shipdream.lib.android.mvc.samples.benchmark.controller.internal.Controller9Impl;37import com.shipdream.lib.android.mvc.samples.benchmark.service.Service0;38import com.shipdream.lib.android.mvc.samples.benchmark.service.Service1;39import com.shipdream.lib.android.mvc.samples.benchmark.service.Service2;40import com.shipdream.lib.android.mvc.samples.benchmark.service.Service3;41import com.shipdream.lib.android.mvc.samples.benchmark.service.Service4;42import com.shipdream.lib.android.mvc.samples.benchmark.service.Service5;43import com.shipdream.lib.android.mvc.samples.benchmark.service.Service6;44import com.shipdream.lib.android.mvc.samples.benchmark.service.Service7;45import com.shipdream.lib.android.mvc.samples.benchmark.service.Service8;46import com.shipdream.lib.android.mvc.samples.benchmark.service.Service9;47import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service0Impl;48import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service1Impl;49import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service2Impl;50import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service3Impl;51import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service4Impl;52import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service5Impl;53import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service6Impl;54import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service7Impl;55import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service8Impl;56import com.shipdream.lib.android.mvc.samples.benchmark.service.internal.Service9Impl;57import dagger.Module;58import dagger.Provides;59@Module60public class ControllerModule {61    @Provides62    public Controller0 providesController0() {63        return new Controller0Impl();64    }65    @Provides66    public Controller1 providesController1() {67        return new Controller1Impl();68    }69    @Provides70    public Controller2 providesController2() {71        return new Controller2Impl();72    }73    @Provides74    public Controller3 providesController3() {75        return new Controller3Impl();76    }77    @Provides78    public Controller4 providesController4() {79        return new Controller4Impl();80    }81    @Provides82    public Controller5 providesController5() {83        return new Controller5Impl();84    }85    @Provides86    public Controller6 providesController6() {87        return new Controller6Impl();88    }89    @Provides90    public Controller7 providesController7() {91        return new Controller7Impl();92    }93    @Provides94    public Controller8 providesController8() {95        return new Controller8Impl();96    }97    @Provides98    public Controller9 providesController9() {99        return new Controller9Impl();100    }101    @Provides102    public Service0 providesService0() {103        return new Service0Impl();104    }105    @Provides106    public Service1 providesService1() {107        return new Service1Impl();108    }109    @Provides110    public Service2 providesService2() {111        return new Service2Impl();112    }113    @Provides114    public Service3 providesService3() {115        return new Service3Impl();116    }117    @Provides118    public Service4 providesService4() {119        return new Service4Impl();120    }121    @Provides122    public Service5 providesService5() {123        return new Service5Impl();124    }125    @Provides126    public Service6 providesService6() {127        return new Service6Impl();128    }129    @Provides130    public Service7 providesService7() {131        return new Service7Impl();132    }133    @Provides134    public Service8 providesService8() {135        return new Service8Impl();136    }137    @Provides138    public Service9 providesService9() {139        return new Service9Impl();140    }141}...Source:ConfigurableServiceConfig.java  
...8 * Example Configuration class that has OSGi automatically map configurable properties to the respective types.9 * Also with metatype declaration information to have it be visible in the configuration admin10 * Also with use of localization for metadata information.11 */12@ObjectClassDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.name",13	description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.description",14	id = "net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl"15)16@interface ConfigurableServiceConfig {17	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.byteValue.name",18			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.byteValue.description")19	byte byteValue() default 5;20	/* Bug: default for char values get written to XML as integer value instead of character itself,21	 * so does not actually utilize declared default in the configuration admin correctly.22	 * Likely tied to the compiler's character behaviorism in that characters are converted to their integer values. */23	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.charValue.name",24			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.charValue.description")25	char charValue() default 'c';26	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.doubleValue.name",27			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.doubleValue.description")28	double doubleValue() default 3.14;29	// let options auto-generate from enum type information30	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue.name",31			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue.description")32	EnumOption enumValue() default EnumOption.NONE;33	// specify options ourselves to allow localization34	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue2.name",35			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue2.description",36			options = {37					@Option(label = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue2.NONE",38							value = "NONE"),39					@Option(label = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue2.OPTION1",40							value = "OPTION1"),41					@Option(label = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue2.OPTION2",42							value = "OPTION2"),43					@Option(label = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.enumValue2.OPTION3",44							value = "OPTION3"),45			})46	EnumOption enumValue2() default EnumOption.NONE;47	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.floatValue.name",48			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.floatValue.description")49	float floatValue() default 1.73f;50	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.integerValue.name",51			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.integerValue.description")52	int integerValue() default 1000;53	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.longValue.name",54			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.longValue.description")55	long longValue() default 5000;56	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.longArrayValues.name",57			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.longArrayValues.description")58	long[] longArrayValues() default { 1, 2, 3 };59	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.password.name",60			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.password.description",61			type = AttributeType.PASSWORD)62	String password() default "";63	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.shortValue.name",64			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.shortValue.description")65	short shortValue() default 500;66	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.stringArrayValues.name",67			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.stringArrayValues.description")68	String[] stringArrayValues() default { "one", "two", "three" };69	@AttributeDefinition(name = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.stringValue.name",70			description = "%net.kemuri9.samples.dsannotations.impl.ConfigurableServiceImpl.stringValue.description")71	String stringValue() default "some string";72}...Service
Using AI Code Generation
1import samples.Service;2public class 1 {3    public static void main(String[] args) {4        Service service = new Service();5        service.doSomething();6    }7}8package samples;9public class Service {10    public void doSomething() {11        System.out.println("Hello World");12    }13}Service
Using AI Code Generation
1import samples.Service;2public class 1{3public static void main(String args[]){4Service s=new Service();5s.display();6}7}8package samples;9public class Service{10public void display(){11System.out.println("Hello world");12}13}14import samples.Service;15public class 1{16public static void main(String args[]){17Service s=new Service();18s.display();19}20}21package samples;22public class Service{23public void display(){24System.out.println("Hello world");25}26}Service
Using AI Code Generation
1import samples.Service;2public class Client {3    public static void main(String[] args) {4        Service service = new Service();5        service.doSomething();6    }7}8package samples;9public class Service {10    public void doSomething() {11        System.out.println("Doing something...");12    }13}14        Service service = new Service();15        Service service = new Service();16        Service service = new Service();Service
Using AI Code Generation
1import samples.Service;2public class 1 {3  public static void main(String[] args) {4    Service s = new Service();5    s.printMsg();6  }7}8package samples;9public class Service {10  public void printMsg() {11    System.out.println("This is a message from Service class");12  }13}Service
Using AI Code Generation
1package samples;2import java.util.*;3import java.io.*;4{5    public static void main(String args[])6    {7        Scanner sc = new Scanner(System.in);8        System.out.println("Enter the number of services");9        int n = sc.nextInt();10        Service s = new Service();11        s.calculateTotalCost(n);12    }13    void calculateTotalCost(int n)14    {15        Scanner sc = new Scanner(System.in);16        Service s = new Service();17        int totalCost = 0;18        for(int i = 1; i <= n; i++)19        {20            System.out.println("Enter the type of service");21            String type = sc.next();22            System.out.println("Enter the number of units");23            int units = sc.nextInt();24            int cost = s.calculateCost(type, units);25            totalCost = totalCost + cost;26        }27        System.out.println("Total cost is " + totalCost);28    }29    int calculateCost(String type, int units)30    {31        int cost = 0;32        switch(type)33        {34                cost = calculateDomesticCost(units);35                break;36                cost = calculateCommercialCost(units);37                break;38                cost = calculateIndustrialCost(units);39                break;40        }41        return cost;42    }43    int calculateDomesticCost(int units)44    {45        int cost = 0;46        if(units <= 100)47        {48            cost = units * 2;49        }50        else if(units > 100 && units <= 300)Service
Using AI Code Generation
1package samples;2import java.util.Scanner;3public class Service {4    public static void main(String args[]) {5        int n;6        Scanner input = new Scanner(System.in);7        System.out.println("Enter the number of elements");8        n = input.nextInt();9        int arr[] = new int[n];10        System.out.println("Enter the elements");11        for (int i = 0; i < n; i++) {12            arr[i] = input.nextInt();13        }14        System.out.println("The sum is " + sum(arr));15    }16    public static int sum(int arr[]) {17        int sum = 0;18        for (int i = 0; i < arr.length; i++) {19            sum += arr[i];20        }21        return sum;22    }23}24package samples;25import samples.Service;26public class Client {27    public static void main(String args[]) {28        Service.main(args);29    }30}Service
Using AI Code Generation
1import samples.Service;2{3public static void main(String args[])4{5Service service = new Service();6service.display();7}8}Service
Using AI Code Generation
1import samples.Service;2class Client {3    public static void main(String[] args) {4        Service s = new Service();5        s.print();6    }7}8import samples.Service;9class Client {10    public static void main(String[] args) {11        Service s = new Service();12        s.print();13    }14}15import samples.Service;16class Client {17    public static void main(String[] args) {18        Service s = new Service();19        s.print();20    }21}22import samples.Service;23class Client {24    public static void main(String[] args) {25        Service s = new Service();26        s.print();27    }28}29import samples.Service;30class Client {31    public static void main(String[] args) {32        Service s = new Service();33        s.print();34    }35}36import samples.Service;37class Client {38    public static void main(String[] args) {39        Service s = new Service();40        s.print();41    }42}Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
