[JAVA-6455] Remove Lombok
This commit is contained in:
		
							parent
							
								
									9e22d43bab
								
							
						
					
					
						commit
						e1331505c5
					
				| @ -1,15 +1,13 @@ | ||||
| package com.baeldung.h2db.springboot.models; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| import javax.persistence.Entity; | ||||
| import javax.persistence.GeneratedValue; | ||||
| import javax.persistence.Id; | ||||
| import javax.persistence.Table; | ||||
| import java.util.Objects; | ||||
| 
 | ||||
| @Table(name = "countries") | ||||
| @Entity | ||||
| @Data | ||||
| public class Country { | ||||
| 
 | ||||
|     @Id | ||||
| @ -18,4 +16,42 @@ public class Country { | ||||
| 
 | ||||
|     private String name; | ||||
| 
 | ||||
|     public int getId() { | ||||
|         return id; | ||||
|     } | ||||
| 
 | ||||
|     public void setId(int id) { | ||||
|         this.id = id; | ||||
|     } | ||||
| 
 | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
| 
 | ||||
|     public void setName(String name) { | ||||
|         this.name = name; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean equals(Object o) { | ||||
|         if (this == o) | ||||
|             return true; | ||||
|         if (o == null || getClass() != o.getClass()) | ||||
|             return false; | ||||
|         Country country = (Country) o; | ||||
|         return id == country.id && name.equals(country.name); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public int hashCode() { | ||||
|         return Objects.hash(id, name); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toString() { | ||||
|         return "Country{" + | ||||
|           "id=" + id + | ||||
|           ", name='" + name + '\'' + | ||||
|           '}'; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -15,6 +15,8 @@ import static org.assertj.core.api.Assertions.assertThat; | ||||
| @SpringBootTest(classes = SpringBootH2Application.class) | ||||
| public class SpringBootH2IntegrationTest { | ||||
| 
 | ||||
|     private static final Country AN_EXPECTED_COUNTRY = buildCountry(); | ||||
| 
 | ||||
|     @Autowired | ||||
|     private CountryRepository countryRepository; | ||||
| 
 | ||||
| @ -22,7 +24,16 @@ public class SpringBootH2IntegrationTest { | ||||
|     public void givenInitData_whenApplicationStarts_thenDataIsLoaded() { | ||||
|         Iterable<Country> users = countryRepository.findAll(); | ||||
| 
 | ||||
|         assertThat(users).hasSize(5); | ||||
|         assertThat(users) | ||||
|           .hasSize(5) | ||||
|           .contains(AN_EXPECTED_COUNTRY); | ||||
|     } | ||||
| 
 | ||||
|     private static Country buildCountry() { | ||||
|         Country c = new Country(); | ||||
|         c.setId(5); | ||||
|         c.setName("Canada"); | ||||
|         return c; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user