diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java index 608d68f9e9..b933a28754 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerPostProcessor.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerPostProcessor.java index 1f0c239d72..07d55bb9d3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerPostProcessor.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index 4dcc7e4685..11c87c1b30 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index 383f4cfc4f..eb0ac7222a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java index 49ab43b4ae..bdc6d82365 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java index 28912d8f26..b5848e7e5f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 6b5117bbe4..c5ce34c9c5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryAutoConfigurationTests.java index 22de40932e..a05a8a662c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryAutoConfigurationTests.java @@ -40,34 +40,31 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class ReactiveWebServerFactoryAutoConfigurationTests { - private ReactiveWebApplicationContextRunner contextRunner = - new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new) - .withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)); + private ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner( + AnnotationConfigReactiveWebServerApplicationContext::new) + .withConfiguration(AutoConfigurations + .of(ReactiveWebServerFactoryAutoConfiguration.class)); @Test public void createFromConfigClass() { - this.contextRunner - .withUserConfiguration(MockWebServerAutoConfiguration.class, - HttpHandlerConfiguration.class) - .run(context -> { + this.contextRunner.withUserConfiguration(MockWebServerAutoConfiguration.class, + HttpHandlerConfiguration.class).run((context) -> { assertThat(context.getBeansOfType(ReactiveWebServerFactory.class)) .hasSize(1); assertThat(context.getBeansOfType(WebServerFactoryCustomizer.class)) .hasSize(1); - assertThat(context.getBeansOfType(ReactiveWebServerFactoryCustomizer.class)) - .hasSize(1); + assertThat(context + .getBeansOfType(ReactiveWebServerFactoryCustomizer.class)) + .hasSize(1); }); } @Test public void missingHttpHandler() { - this.contextRunner - .withUserConfiguration(MockWebServerAutoConfiguration.class) - .run(context -> { - assertThat(context.getStartupFailure()) - .isInstanceOf(ApplicationContextException.class) - .hasMessageContaining("missing HttpHandler bean"); - }); + this.contextRunner.withUserConfiguration(MockWebServerAutoConfiguration.class) + .run((context) -> assertThat(context.getStartupFailure()) + .isInstanceOf(ApplicationContextException.class) + .hasMessageContaining("missing HttpHandler bean")); } @Test @@ -75,34 +72,27 @@ public class ReactiveWebServerFactoryAutoConfigurationTests { this.contextRunner .withUserConfiguration(MockWebServerAutoConfiguration.class, HttpHandlerConfiguration.class, TooManyHttpHandlers.class) - .run(context -> { - assertThat(context.getStartupFailure()) - .isInstanceOf(ApplicationContextException.class) - .hasMessageContaining("multiple HttpHandler beans : " + - "httpHandler,additionalHttpHandler"); - }); + .run((context) -> assertThat(context.getStartupFailure()) + .isInstanceOf(ApplicationContextException.class) + .hasMessageContaining("multiple HttpHandler beans : " + + "httpHandler,additionalHttpHandler")); } @Test public void customizeReactiveWebServer() { - this.contextRunner - .withUserConfiguration(MockWebServerAutoConfiguration.class, - HttpHandlerConfiguration.class, ReactiveWebServerCustomization.class) - .run(context -> { - assertThat(context.getBean(MockReactiveWebServerFactory.class).getPort()) - .isEqualTo(9000); - }); + this.contextRunner.withUserConfiguration(MockWebServerAutoConfiguration.class, + HttpHandlerConfiguration.class, ReactiveWebServerCustomization.class) + .run((context) -> assertThat( + context.getBean(MockReactiveWebServerFactory.class).getPort()) + .isEqualTo(9000)); } @Test public void defaultWebServerIsTomcat() { // Tomcat should be chosen over Netty if the Tomcat library is present. - this.contextRunner - .withUserConfiguration(HttpHandlerConfiguration.class) - .run(context -> { - assertThat(context.getBean(ReactiveWebServerFactory.class)) - .isInstanceOf(TomcatReactiveWebServerFactory.class); - }); + this.contextRunner.withUserConfiguration(HttpHandlerConfiguration.class).run( + (context) -> assertThat(context.getBean(ReactiveWebServerFactory.class)) + .isInstanceOf(TomcatReactiveWebServerFactory.class)); } @Configuration diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java index 975a4f3f9d..6555ab2fc3 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java index 9e6f4d72ff..b0f96f2f45 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java index 3627f4cd57..82a2e7ccc4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java index 1dd28aee36..6ec95df5ed 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,4 +74,5 @@ public class City implements Serializable { public String toString() { return getName() + "," + getState() + "," + getCountry(); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java index 35764736fa..3c72b2aeae 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,4 +80,5 @@ public class Hotel implements Serializable { public String getZip() { return this.zip; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java index 7076b2cfce..c55ce4293e 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java @@ -17,5 +17,7 @@ package sample.data.jpa.domain; public enum Rating { + TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java index 761f3557c1..3ed3db0caf 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -128,4 +128,5 @@ public class Review implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java index c19c9cf5f6..0cdb85d501 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java index ca1cb6992f..00fa71802f 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,5 +17,7 @@ package sample.data.jpa.domain; public enum TripType { + BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java index cd74f536cd..4aafa8f71b 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable { public void setName(String name) { this.name = name; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java index eab39b23c1..51884556a7 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,4 +75,5 @@ class CityServiceImpl implements CityService { Assert.notNull(city, "City must not be null"); return this.hotelRepository.findByCity(city, pageable); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java index 5a1ecf464c..327919ce13 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService { Long count = this.ratingCount.get(rating); return count == null ? 0 : count; } + } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java index 7a07a94cc3..085e3d9f07 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,8 +41,8 @@ public class CityRepositoryIntegrationTests { @Test public void findsFirstPageOfCities() { - Page cities = this.repository.findAll(PageRequest.of(0, 10)); assertThat(cities.getTotalElements()).isGreaterThan(20L); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java index bb7753c18d..d478b45dcf 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ public class HotelRepositoryIntegrationTests { @Autowired CityRepository cityRepository; + @Autowired HotelRepository repository; @@ -53,16 +54,15 @@ public class HotelRepositoryIntegrationTests { City city = this.cityRepository .findAll(PageRequest.of(0, 1, Direction.ASC, "name")).getContent().get(0); assertThat(city.getName()).isEqualTo("Atlanta"); - Page hotels = this.repository.findByCity(city, PageRequest.of(0, 10, Direction.ASC, "name")); Hotel hotel = this.repository.findByCityAndName(city, hotels.getContent().get(0).getName()); assertThat(hotel.getName()).isEqualTo("Doubletree"); - List counts = this.repository.findRatingCounts(hotel); assertThat(counts).hasSize(1); assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE); assertThat(counts.get(0).getCount()).isGreaterThan(1L); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java index a60ae7b6cc..67f0d8ae3b 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,4 +74,5 @@ public class City implements Serializable { public String toString() { return getName() + "," + getState() + "," + getCountry(); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java index 4be17b2f26..a4bcf3478b 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,4 +74,5 @@ public class Hotel implements Serializable { public String getZip() { return this.zip; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java index f237100c89..dc28459259 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable { public void setName(String name) { this.name = name; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java index a05c62f121..2ce2edbad6 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java @@ -58,14 +58,12 @@ public class SampleDataRestApplicationTests { @Test public void testHome() throws Exception { - this.mvc.perform(get("/api")).andExpect(status().isOk()) .andExpect(content().string(containsString("hotels"))); } @Test public void findByNameAndCountry() throws Exception { - this.mvc.perform(get( "/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia")) .andExpect(status().isOk()) @@ -75,10 +73,10 @@ public class SampleDataRestApplicationTests { @Test public void findByContaining() throws Exception { - this.mvc.perform(get( "/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK")) .andExpect(status().isOk()) .andExpect(jsonPath("_embedded.cities", hasSize(3))); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java index a5ecded536..648c6ba416 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,6 @@ public class CityRepositoryIntegrationTests { @Test public void findsFirstPageOfCities() { - Page cities = this.repository.findAll(PageRequest.of(0, 10)); assertThat(cities.getTotalElements()).isGreaterThan(20L); } @@ -63,4 +62,5 @@ public class CityRepositoryIntegrationTests { PageRequest.of(0, 10)); assertThat(cities.getTotalElements()).isEqualTo(3L); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-solr/src/test/java/sample/data/solr/SampleSolrApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-solr/src/test/java/sample/data/solr/SampleSolrApplicationTests.java index 1971b010e2..e928c997e5 100644 --- a/spring-boot-samples/spring-boot-sample-data-solr/src/test/java/sample/data/solr/SampleSolrApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-solr/src/test/java/sample/data/solr/SampleSolrApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ public class SampleSolrApplicationTests { @Test public void testDefaultSettings() throws Exception { - try { SampleSolrApplication.main(new String[0]); } @@ -44,9 +43,8 @@ public class SampleSolrApplicationTests { assertThat(output).contains("name=Sony Playstation"); } + @SuppressWarnings("serial") private boolean serverNotRunning(IllegalStateException ex) { - - @SuppressWarnings("serial") NestedCheckedException nested = new NestedCheckedException("failed", ex) { }; Throwable root = nested.getRootCause();