Build opt 22 06 (#2132)

* Drools reformat

* Further refactor

* Further refactor

* Refactor
This commit is contained in:
Grzegorz Piwowarek 2017-06-22 15:52:05 +02:00 committed by GitHub
parent 38dc2041a1
commit 87049b63f4
48 changed files with 291 additions and 336 deletions

View File

@ -36,6 +36,7 @@ public class ApplicantServiceIntegrationTest {
applicantService.suggestARoleForApplicant(applicant, suggestedRole); applicantService.suggestARoleForApplicant(applicant, suggestedRole);
assertEquals("Senior developer", suggestedRole.getRole()); assertEquals("Senior developer", suggestedRole.getRole());
} }
@Test @Test
public void whenCriteriaMatching_ThenSuggestDeveloperRole() throws IOException { public void whenCriteriaMatching_ThenSuggestDeveloperRole() throws IOException {
Applicant applicant = new Applicant("Davis", 37, 800000.0, 3); Applicant applicant = new Applicant("Davis", 37, 800000.0, 3);
@ -43,6 +44,7 @@ public class ApplicantServiceIntegrationTest {
applicantService.suggestARoleForApplicant(applicant, suggestedRole); applicantService.suggestARoleForApplicant(applicant, suggestedRole);
assertEquals("Developer", suggestedRole.getRole()); assertEquals("Developer", suggestedRole.getRole());
} }
@Test @Test
public void whenCriteriaNotMatching_ThenNoRole() throws IOException { public void whenCriteriaNotMatching_ThenNoRole() throws IOException {
Applicant applicant = new Applicant("John", 37, 1200000.0, 5); Applicant applicant = new Applicant("John", 37, 1200000.0, 5);

View File

@ -3,6 +3,7 @@ package com.baeldung.drools.service;
import com.baeldung.drools.model.Product; import com.baeldung.drools.model.Product;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;

View File

@ -13,7 +13,7 @@ public class AsciidoctorDemo {
private final Asciidoctor asciidoctor; private final Asciidoctor asciidoctor;
public AsciidoctorDemo() { AsciidoctorDemo() {
asciidoctor = create(); asciidoctor = create();
} }
@ -26,8 +26,7 @@ public class AsciidoctorDemo {
final String outfile = asciidoctor.convertFile(new File("sample.adoc"), options); final String outfile = asciidoctor.convertFile(new File("sample.adoc"), options);
} }
public String generateHTMLFromString(final String input) { String generateHTMLFromString(final String input) {
final String output = asciidoctor.convert("Hello _Baeldung_!", new HashMap<String, Object>()); return asciidoctor.convert("Hello _Baeldung_!", new HashMap<String, Object>());
return output;
} }
} }

View File

@ -2,8 +2,9 @@ package com.baeldung.commons.lang3;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
public class ArrayUtilsUnitTest { public class ArrayUtilsUnitTest {
@Test @Test

View File

@ -1,9 +1,9 @@
package com.baeldung.hikaricp; package com.baeldung.hikaricp;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
public class HikariCPUnitTest { public class HikariCPUnitTest {

View File

@ -4,7 +4,15 @@ package com.baeldung.javassist;
import javassist.CannotCompileException; import javassist.CannotCompileException;
import javassist.ClassPool; import javassist.ClassPool;
import javassist.NotFoundException; import javassist.NotFoundException;
import javassist.bytecode.*; import javassist.bytecode.AccessFlag;
import javassist.bytecode.BadBytecode;
import javassist.bytecode.Bytecode;
import javassist.bytecode.ClassFile;
import javassist.bytecode.CodeAttribute;
import javassist.bytecode.CodeIterator;
import javassist.bytecode.FieldInfo;
import javassist.bytecode.MethodInfo;
import javassist.bytecode.Mnemonic;
import org.junit.Test; import org.junit.Test;
import java.io.DataOutputStream; import java.io.DataOutputStream;

View File

@ -1,10 +1,5 @@
package com.baeldung.javatuples; package com.baeldung.javatuples;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.List;
import org.javatuples.KeyValue; import org.javatuples.KeyValue;
import org.javatuples.LabelValue; import org.javatuples.LabelValue;
import org.javatuples.Pair; import org.javatuples.Pair;
@ -13,6 +8,11 @@ import org.javatuples.Triplet;
import org.javatuples.Unit; import org.javatuples.Unit;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class JavaTuplesUnitTest { public class JavaTuplesUnitTest {
@SuppressWarnings("unused") @SuppressWarnings("unused")

View File

@ -93,9 +93,7 @@ public class GuideToJDOIntegrationTest {
Query q = pm2.newQuery("SELECT FROM " + Product.class.getName() + " WHERE price == 200"); Query q = pm2.newQuery("SELECT FROM " + Product.class.getName() + " WHERE price == 200");
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Product> products = (List<Product>) q.execute(); List<Product> products = (List<Product>) q.execute();
Iterator<Product> iter = products.iterator(); for (Product p : products) {
while (iter.hasNext()) {
Product p = iter.next();
assertEquals("Laptop", p.name); assertEquals("Laptop", p.name);
} }

View File

@ -1,8 +1,6 @@
package com.baeldung.jsonassert; package com.baeldung.jsonassert;
import static org.assertj.core.api.Assertions.assertThat;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.junit.Test; import org.junit.Test;
@ -13,6 +11,8 @@ import org.skyscreamer.jsonassert.RegularExpressionValueMatcher;
import org.skyscreamer.jsonassert.comparator.ArraySizeComparator; import org.skyscreamer.jsonassert.comparator.ArraySizeComparator;
import org.skyscreamer.jsonassert.comparator.CustomComparator; import org.skyscreamer.jsonassert.comparator.CustomComparator;
import static org.assertj.core.api.Assertions.assertThat;
public class JsonAssertUnitTest { public class JsonAssertUnitTest {
@Test @Test

View File

@ -1,13 +1,12 @@
package com.baeldung.junitparams; package com.baeldung.junitparams;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import junitparams.FileParameters; import junitparams.FileParameters;
import junitparams.JUnitParamsRunner; import junitparams.JUnitParamsRunner;
import junitparams.Parameters; import junitparams.Parameters;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
@RunWith(JUnitParamsRunner.class) @RunWith(JUnitParamsRunner.class)
public class SafeAdditionUtilTest { public class SafeAdditionUtilTest {

View File

@ -1,15 +1,5 @@
package com.baeldung.opennlp; package com.baeldung.opennlp;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Test;
import opennlp.tools.chunker.ChunkerME; import opennlp.tools.chunker.ChunkerME;
import opennlp.tools.chunker.ChunkerModel; import opennlp.tools.chunker.ChunkerModel;
import opennlp.tools.cmdline.postag.POSModelLoader; import opennlp.tools.cmdline.postag.POSModelLoader;
@ -31,6 +21,15 @@ import opennlp.tools.util.ObjectStream;
import opennlp.tools.util.PlainTextByLineStream; import opennlp.tools.util.PlainTextByLineStream;
import opennlp.tools.util.Span; import opennlp.tools.util.Span;
import opennlp.tools.util.TrainingParameters; import opennlp.tools.util.TrainingParameters;
import org.junit.Test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import static org.junit.Assert.assertEquals;
public class OpenNLPTests { public class OpenNLPTests {
@ -48,8 +47,6 @@ public class OpenNLPTests {
String sentences[] = sdetector.sentDetect(text); String sentences[] = sdetector.sentDetect(text);
assertEquals(4, sentences.length); assertEquals(4, sentences.length);
is.close(); is.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -68,8 +65,6 @@ public class OpenNLPTests {
String[] names = Span.spansToStrings(nameSpans, sentence); String[] names = Span.spansToStrings(nameSpans, sentence);
assertEquals(1, names.length); assertEquals(1, names.length);
assertEquals("James Jordan", names[0]); assertEquals("James Jordan", names[0]);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -88,8 +83,6 @@ public class OpenNLPTests {
String[] locations = Span.spansToStrings(locationSpans, sentence); String[] locations = Span.spansToStrings(locationSpans, sentence);
assertEquals(1, locations.length); assertEquals(1, locations.length);
assertEquals("Oklahoma", locations[0]); assertEquals("Oklahoma", locations[0]);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -2,9 +2,6 @@ package com.baeldung.serenity;
import net.serenitybdd.jbehave.SerenityStory; import net.serenitybdd.jbehave.SerenityStory;
/**
* @author aiet
*/
public class GithubUserProfilePayloadIntegrationTest extends SerenityStory { public class GithubUserProfilePayloadIntegrationTest extends SerenityStory {
} }

View File

@ -13,13 +13,11 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated; import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
/**
* @author aiet
*/
@RunWith(SerenityRunner.class) @RunWith(SerenityRunner.class)
public class GoogleSearchLiveTest { public class GoogleSearchLiveTest {
@Managed(driver = "chrome") private WebDriver browser; @Managed(driver = "chrome")
private WebDriver browser;
@Test @Test
public void whenGoogleBaeldungThenShouldSeeEugen() { public void whenGoogleBaeldungThenShouldSeeEugen() {

View File

@ -7,15 +7,13 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
/**
* @author aiet
*/
@RunWith(SerenityRunner.class) @RunWith(SerenityRunner.class)
public class GoogleSearchPageObjectLiveTest { public class GoogleSearchPageObjectLiveTest {
@Managed(driver = "chrome") private WebDriver browser; @Managed(driver = "chrome")
private WebDriver browser;
GoogleSearchPageObject googleSearch; private GoogleSearchPageObject googleSearch;
@Test @Test
public void whenGoogleBaeldungThenShouldSeeEugen() { public void whenGoogleBaeldungThenShouldSeeEugen() {

View File

@ -12,19 +12,20 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import static net.serenitybdd.screenplay.GivenWhenThen.*; import static net.serenitybdd.screenplay.GivenWhenThen.givenThat;
import static net.serenitybdd.screenplay.GivenWhenThen.seeThat;
import static net.serenitybdd.screenplay.GivenWhenThen.then;
import static net.serenitybdd.screenplay.GivenWhenThen.when;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.hasItem;
/**
* Unit test for simple App.
*/
@RunWith(SerenityRunner.class) @RunWith(SerenityRunner.class)
public class GoogleSearchScreenplayLiveTest { public class GoogleSearchScreenplayLiveTest {
@Managed(driver = "chrome") WebDriver browser; @Managed(driver = "chrome")
private WebDriver browser;
Actor kitty = Actor.named("kitty"); private Actor kitty = Actor.named("kitty");
@Before @Before
public void setup() { public void setup() {

View File

@ -16,7 +16,8 @@ import static com.baeldung.serenity.membership.MemberGrade.Silver;
@RunWith(SerenityRunner.class) @RunWith(SerenityRunner.class)
public class MemberStatusIntegrationTest { public class MemberStatusIntegrationTest {
@Steps MemberStatusSteps memberSteps; @Steps
private MemberStatusSteps memberSteps;
@Test @Test
public void membersShouldStartWithBronzeStatus() { public void membersShouldStartWithBronzeStatus() {

View File

@ -8,25 +8,22 @@ import java.io.IOException;
import static net.serenitybdd.rest.SerenityRest.rest; import static net.serenitybdd.rest.SerenityRest.rest;
import static net.serenitybdd.rest.SerenityRest.then; import static net.serenitybdd.rest.SerenityRest.then;
/** class GithubRestAssuredUserAPISteps {
* @author aiet
*/
public class GithubRestAssuredUserAPISteps {
private String api; private String api;
@Step("Given the github REST API for user profile") @Step("Given the github REST API for user profile")
public void withUserProfileAPIEndpoint() { void withUserProfileAPIEndpoint() {
api = "https://api.github.com/users/{username}"; api = "https://api.github.com/users/{username}";
} }
@Step("When looking for {0} via the api") @Step("When looking for {0} via the api")
public void getProfileOfUser(String username) throws IOException { void getProfileOfUser(String username) throws IOException {
rest().get(api, username); rest().get(api, username);
} }
@Step("Then there should be a login field with value {0} in payload of user {0}") @Step("Then there should be a login field with value {0} in payload of user {0}")
public void profilePayloadShouldContainLoginValue(String username) { void profilePayloadShouldContainLoginValue(String username) {
then().body("login", Matchers.equalTo(username)); then().body("login", Matchers.equalTo(username));
} }

View File

@ -14,9 +14,6 @@ import java.io.IOException;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
/**
* @author aiet
*/
public class GithubRestUserAPISteps { public class GithubRestUserAPISteps {
private String api; private String api;

View File

@ -9,11 +9,8 @@ import java.io.IOException;
public class GithubUserProfilePayloadStepDefinitions { public class GithubUserProfilePayloadStepDefinitions {
// @Steps
// GithubRestUserAPISteps userAPISteps;
@Steps @Steps
GithubRestAssuredUserAPISteps userAPISteps; private GithubRestAssuredUserAPISteps userAPISteps;
@Given("github user profile api") @Given("github user profile api")
public void givenGithubUserProfileApi() { public void givenGithubUserProfileApi() {

View File

@ -6,12 +6,9 @@ import net.thucydides.core.annotations.Step;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
/**
* @author aiet
*/
public class MemberStatusSteps { public class MemberStatusSteps {
Member member; private Member member;
@Step("Given a member has {0} points") @Step("Given a member has {0} points")
public void aMemberHasPointsOf(int points) { public void aMemberHasPointsOf(int points) {

View File

@ -10,15 +10,14 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
/**
* @author aiet
*/
@DefaultUrl("https://www.google.com/ncr") @DefaultUrl("https://www.google.com/ncr")
public class GoogleSearchPageObject extends PageObject { public class GoogleSearchPageObject extends PageObject {
@FindBy(name = "q") private WebElement search; @FindBy(name = "q")
private WebElement search;
@FindBy(css = "._ksh") private WebElement result; @FindBy(css = "._ksh")
private WebElement result;
public void searchFor(String keyword) { public void searchFor(String keyword) {
search.sendKeys(keyword, Keys.ENTER); search.sendKeys(keyword, Keys.ENTER);

View File

@ -8,13 +8,13 @@ import net.thucydides.core.annotations.DefaultUrl;
* @author baoqiang * @author baoqiang
*/ */
@DefaultUrl("https://www.google.com/ncr") @DefaultUrl("https://www.google.com/ncr")
public class GoogleSearchPage extends PageObject { class GoogleSearchPage extends PageObject {
public static final Target SEARCH_RESULT_TITLES = Target static final Target SEARCH_RESULT_TITLES = Target
.the("search results") .the("search results")
.locatedBy("._ksh"); .locatedBy("._ksh");
public static final Target SEARCH_INPUT_BOX = Target static final Target SEARCH_INPUT_BOX = Target
.the("search input box") .the("search input box")
.locatedBy("#lst-ib"); .locatedBy("#lst-ib");

View File

@ -6,9 +6,6 @@ import net.serenitybdd.screenplay.questions.Text;
import java.util.List; import java.util.List;
/**
* @author baoqiang
*/
public class GoogleSearchResults implements Question<List<String>> { public class GoogleSearchResults implements Question<List<String>> {
public static Question<List<String>> displayed() { public static Question<List<String>> displayed() {

View File

@ -7,9 +7,6 @@ import net.serenitybdd.screenplay.actions.Enter;
import net.thucydides.core.annotations.Step; import net.thucydides.core.annotations.Step;
import org.openqa.selenium.Keys; import org.openqa.selenium.Keys;
/**
* @author baoqiang
*/
public class SearchForKeyword implements Task { public class SearchForKeyword implements Task {
@Step("{0} searches for '#keyword'") @Step("{0} searches for '#keyword'")

View File

@ -7,9 +7,6 @@ import net.thucydides.core.annotations.Step;
import static net.serenitybdd.screenplay.Tasks.instrumented; import static net.serenitybdd.screenplay.Tasks.instrumented;
/**
* @author baoqiang
*/
public class StartWith implements Task { public class StartWith implements Task {
public static StartWith googleSearchPage() { public static StartWith googleSearchPage() {

View File

@ -1,9 +1,7 @@
package com.baeldung.stm; package com.baeldung.stm;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;

View File

@ -15,9 +15,6 @@ import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author aiet
*/
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ContextConfiguration(classes = Spring5JUnit4ConcurrentIntegrationTest.SimpleConfiguration.class) @ContextConfiguration(classes = Spring5JUnit4ConcurrentIntegrationTest.SimpleConfiguration.class)
public class Spring5JUnit4ConcurrentIntegrationTest implements ApplicationContextAware, InitializingBean { public class Spring5JUnit4ConcurrentIntegrationTest implements ApplicationContextAware, InitializingBean {

View File

@ -8,7 +8,6 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.BodyInserters;

View File

@ -16,10 +16,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
class Spring5JUnit5ComposedAnnotationIntegrationTest { class Spring5JUnit5ComposedAnnotationIntegrationTest {
@Autowired @Autowired
Task task; private Task task;
@Autowired @Autowired
List<Task> tasks; private List<Task> tasks;
@Test @Test
@DisplayName("ApplicationContext injected into method") @DisplayName("ApplicationContext injected into method")

View File

@ -1,7 +1,7 @@
package com.baeldung.jupiter; package com.baeldung.jupiter;
import com.baeldung.web.reactive.Task; import com.baeldung.web.reactive.Task;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@ -10,14 +10,12 @@ import org.springframework.test.context.ContextConfiguration;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = TestConfig.class) @ContextConfiguration(classes = TestConfig.class)
class Spring5JUnit5IntegrationTest { class Spring5JUnit5IntegrationTest {
@Autowired @Autowired
Task task; private Task task;
@Test @Test
void givenAMethodName_whenInjecting_thenApplicationContextInjectedIntoMetho(ApplicationContext applicationContext) { void givenAMethodName_whenInjecting_thenApplicationContextInjectedIntoMetho(ApplicationContext applicationContext) {

View File

@ -7,10 +7,10 @@ import org.junit.jupiter.api.Test;
import org.junit.runner.Computer; import org.junit.runner.Computer;
import org.junit.runner.JUnitCore; import org.junit.runner.JUnitCore;
public class Spring5JUnit5ParallelIntegrationTest { class Spring5JUnit5ParallelIntegrationTest {
@Test @Test
public void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel() { void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel() {
final Class<?>[] classes = { final Class<?>[] classes = {
Example1IntegrationTest.class, Example2IntegrationTest.class Example1IntegrationTest.class, Example2IntegrationTest.class
}; };
@ -19,7 +19,7 @@ public class Spring5JUnit5ParallelIntegrationTest {
} }
@Test @Test
public void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingLinear() { void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingLinear() {
final Class<?>[] classes = { final Class<?>[] classes = {
Example1IntegrationTest.class, Example2IntegrationTest.class Example1IntegrationTest.class, Example2IntegrationTest.class
}; };

View File

@ -1,12 +1,14 @@
package com.baeldung.jupiter; package com.baeldung.jupiter;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
public class Spring5Java8NewFeaturesIntegrationTest { class Spring5Java8NewFeaturesIntegrationTest {
@FunctionalInterface @FunctionalInterface
public interface FunctionalInterfaceExample<Input, Result> { public interface FunctionalInterfaceExample<Input, Result> {
@ -14,12 +16,10 @@ public class Spring5Java8NewFeaturesIntegrationTest {
} }
public class StringUtils { public class StringUtils {
public FunctionalInterfaceExample<String, String> FunctionalInterfaceExample<String, String>
functionLambdaString = s -> { functionLambdaString = s -> Pattern.compile(" +").splitAsStream(s)
return Pattern.compile(" +").splitAsStream(s)
.map(word -> new StringBuilder(word).reverse()) .map(word -> new StringBuilder(word).reverse())
.collect(Collectors.joining(" ")); .collect(Collectors.joining(" "));
};
} }
@Test @Test

View File

@ -3,16 +3,8 @@ package com.baeldung.jupiter;
import com.baeldung.web.reactive.Task; import com.baeldung.web.reactive.Task;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.ClientRequest;
import org.springframework.web.reactive.function.client.ExchangeFunction;
import org.springframework.web.reactive.function.client.ExchangeFunctions;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.reactive.function.server.ServerResponse;
@ -21,10 +13,8 @@ import reactor.core.publisher.Mono;
import reactor.ipc.netty.NettyContext; import reactor.ipc.netty.NettyContext;
import reactor.ipc.netty.http.server.HttpServer; import reactor.ipc.netty.http.server.HttpServer;
import java.net.URI;
import java.time.Duration; import java.time.Duration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.web.reactive.function.server.RequestPredicates.GET; import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RequestPredicates.POST; import static org.springframework.web.reactive.function.server.RequestPredicates.POST;

View File

@ -1,6 +1,5 @@
package com.baeldung.web; package com.baeldung.web;
import com.baeldung.web.PathPatternController;
import com.baeldung.Spring5Application; import com.baeldung.Spring5Application;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -11,7 +10,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Spring5Application.class) @SpringBootTest(classes = Spring5Application.class)
public class PathPatternsUsingHandlerMethodTest { public class PathPatternsUsingHandlerMethodIntegrationTest {
private static WebTestClient client; private static WebTestClient client;

View File

@ -1,8 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId> <artifactId>spring-jooq</artifactId>
<artifactId>sprin-jooq</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<parent> <parent>

View File

@ -12,7 +12,7 @@ import io.restassured.authentication.FormAuthConfig;
import io.restassured.response.Response; import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification; import io.restassured.specification.RequestSpecification;
public class LiveTest { public class ApplicationLiveTest {
private final FormAuthConfig formAuthConfig = new FormAuthConfig("http://localhost:8082/spring-security-mvc-boot/login", "username", "password"); private final FormAuthConfig formAuthConfig = new FormAuthConfig("http://localhost:8082/spring-security-mvc-boot/login", "username", "password");

View File

@ -25,18 +25,18 @@ import org.springframework.boot.test.context.SpringBootTest;
@WebAppConfiguration @WebAppConfiguration
public class CustomUserDetailsServiceIntegrationTest { public class CustomUserDetailsServiceIntegrationTest {
public static final String USERNAME = "user"; private static final String USERNAME = "user";
public static final String PASSWORD = "pass"; private static final String PASSWORD = "pass";
public static final String USERNAME2 = "user2"; private static final String USERNAME2 = "user2";
@Autowired @Autowired
UserRepository myUserRepository; private UserRepository myUserRepository;
@Autowired @Autowired
AuthenticationProvider authenticationProvider; private AuthenticationProvider authenticationProvider;
@Autowired @Autowired
PasswordEncoder passwordEncoder; private PasswordEncoder passwordEncoder;
// //

View File

@ -16,7 +16,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = MultipleAuthProvidersApplication.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = MultipleAuthProvidersApplication.class)
public class MultipleAuthProvidersApplicationTests { public class MultipleAuthProvidersApplicationIntegrationTest {
@Autowired @Autowired
private TestRestTemplate restTemplate; private TestRestTemplate restTemplate;

View File

@ -21,6 +21,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock
@WebAppConfiguration @WebAppConfiguration
@SpringBootTest(classes = MultipleEntryPointsApplication.class) @SpringBootTest(classes = MultipleEntryPointsApplication.class)
public class MultipleEntryPointsIntegrationTest { public class MultipleEntryPointsIntegrationTest {
@Autowired @Autowired
private WebApplicationContext wac; private WebApplicationContext wac;