@@ -42,15 +42,16 @@
org.thymeleaf.extras
- thymeleaf-extras-springsecurity4
+ thymeleaf-extras-springsecurity5
org.springframework.social
spring-social-facebook
+ ${spring.social.facebook.version}
-
+
org.springframework.boot
spring-boot-starter-data-jpa
@@ -60,6 +61,12 @@
com.h2database
h2
+
+
+ net.bytebuddy
+ byte-buddy-dep
+ ${bytebuddy.version}
+
@@ -93,5 +100,10 @@
+
+
+ 1.10.9
+ 2.0.3.RELEASE
+
\ No newline at end of file
diff --git a/spring-social-login/src/main/java/com/baeldung/config/Application.java b/spring-social-login/src/main/java/com/baeldung/config/Application.java
index 5d083d2d47..c65df6dbfe 100644
--- a/spring-social-login/src/main/java/com/baeldung/config/Application.java
+++ b/spring-social-login/src/main/java/com/baeldung/config/Application.java
@@ -3,7 +3,7 @@ package com.baeldung.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
diff --git a/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java b/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java
index 3d3081fef9..152c7b229a 100644
--- a/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java
+++ b/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java
@@ -1,8 +1,7 @@
package com.baeldung.config;
-import com.baeldung.security.FacebookSignInAdapter;
-import com.baeldung.security.FacebookConnectionSignup;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@@ -14,22 +13,27 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.social.connect.ConnectionFactoryLocator;
import org.springframework.social.connect.UsersConnectionRepository;
import org.springframework.social.connect.mem.InMemoryUsersConnectionRepository;
+import org.springframework.social.connect.support.ConnectionFactoryRegistry;
import org.springframework.social.connect.web.ProviderSignInController;
+import org.springframework.social.facebook.connect.FacebookConnectionFactory;
+
+import com.baeldung.security.FacebookConnectionSignup;
+import com.baeldung.security.FacebookSignInAdapter;
@Configuration
@EnableWebSecurity
@ComponentScan(basePackages = { "com.baeldung.security" })
public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Value("${spring.social.facebook.appSecret}")
+ String appSecret;
+
+ @Value("${spring.social.facebook.appId}")
+ String appId;
@Autowired
private UserDetailsService userDetailsService;
- @Autowired
- private ConnectionFactoryLocator connectionFactoryLocator;
-
- @Autowired
- private UsersConnectionRepository usersConnectionRepository;
-
@Autowired
private FacebookConnectionSignup facebookConnectionSignup;
@@ -55,7 +59,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
// @Primary
public ProviderSignInController providerSignInController() {
+ ConnectionFactoryLocator connectionFactoryLocator = connectionFactoryLocator();
+ UsersConnectionRepository usersConnectionRepository = getUsersConnectionRepository(connectionFactoryLocator);
((InMemoryUsersConnectionRepository) usersConnectionRepository).setConnectionSignUp(facebookConnectionSignup);
return new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, new FacebookSignInAdapter());
}
+
+ private ConnectionFactoryLocator connectionFactoryLocator() {
+ ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
+ registry.addConnectionFactory(new FacebookConnectionFactory(appId, appSecret));
+ return registry;
+ }
+
+ private UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
+ return new InMemoryUsersConnectionRepository(connectionFactoryLocator);
+ }
}
\ No newline at end of file
diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/README.md b/spring-swagger-codegen/spring-swagger-codegen-app/README.md
index 1cb9e35d99..8740b17ba3 100644
--- a/spring-swagger-codegen/spring-swagger-codegen-app/README.md
+++ b/spring-swagger-codegen/spring-swagger-codegen-app/README.md
@@ -1,3 +1,3 @@
## Spring Swagger Codegen App
-This module contains the code for [Generate Spring Boot REST Client with Swagger](http://www.baeldung.com/spring-boot-rest-client-swagger-codegen).
+This module contains the code for Generate Spring Boot REST Client with Swagger.
diff --git a/spring-thymeleaf-2/README.md b/spring-thymeleaf-2/README.md
index d5c5ead43d..a8c067a443 100644
--- a/spring-thymeleaf-2/README.md
+++ b/spring-thymeleaf-2/README.md
@@ -13,4 +13,5 @@ This module contains articles about Spring with Thymeleaf
- [Working with Boolean in Thymeleaf](https://www.baeldung.com/thymeleaf-boolean)
- [Working With Custom HTML Attributes in Thymeleaf](https://www.baeldung.com/thymeleaf-custom-html-attributes)
- [How to Create an Executable JAR with Maven](https://www.baeldung.com/executable-jar-with-maven)
+- [Spring MVC Data and Thymeleaf](https://www.baeldung.com/spring-mvc-thymeleaf-data)
- [[<-- prev]](/spring-thymeleaf)
diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/currencies/CurrenciesController.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/currencies/CurrenciesController.java
new file mode 100644
index 0000000000..206cf32683
--- /dev/null
+++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/currencies/CurrenciesController.java
@@ -0,0 +1,22 @@
+package com.baeldung.thymeleaf.currencies;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Controller
+public class CurrenciesController {
+
+ @GetMapping(value = "/currency")
+ public String exchange(
+ @RequestParam(value = "amount", required = false) String amount,
+ @RequestParam(value = "amountList", required = false) List amountList,
+ Locale locale) {
+
+ return "currencies/currencies";
+ }
+}
diff --git a/spring-thymeleaf-3/src/main/resources/templates/currencies/currencies.html b/spring-thymeleaf-3/src/main/resources/templates/currencies/currencies.html
new file mode 100644
index 0000000000..c2f44265dd
--- /dev/null
+++ b/spring-thymeleaf-3/src/main/resources/templates/currencies/currencies.html
@@ -0,0 +1,21 @@
+
+
+
+
+ Currency table
+
+
+ Currency format by Locale
+
+
+ Currency Arrays format by Locale
+
+
+ Remove decimal values
+
+
+ Replace decimal points
+
+
+
\ No newline at end of file
diff --git a/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/currencies/CurrenciesControllerIntegrationTest.java b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/currencies/CurrenciesControllerIntegrationTest.java
new file mode 100644
index 0000000000..02bf8a9ee0
--- /dev/null
+++ b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/currencies/CurrenciesControllerIntegrationTest.java
@@ -0,0 +1,68 @@
+package com.baeldung.thymeleaf.currencies;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@AutoConfigureMockMvc(printOnlyOnFailure = false)
+public class CurrenciesControllerIntegrationTest {
+
+ @Autowired
+ private MockMvc mockMvc;
+
+ @Test
+ public void whenCallCurrencyWithSpanishLocale_ThenReturnProperCurrency() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "es-ES")
+ .param("amount", "10032.5"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("10.032,50 €")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithUSALocale_ThenReturnProperCurrency() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "en-US")
+ .param("amount", "10032.5"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("$10,032.50")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithRomanianLocaleWithArrays_ThenReturnLocaleCurrencies() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "ro-RO")
+ .param("amountList", "10", "20", "30"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("10,00 RON, 20,00 RON, 30,00 RON")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithUSALocaleWithoutDecimal_ThenReturnCurrencyWithoutTrailingZeros() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "en-US")
+ .param("amount", "10032"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("$10,032")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithUSALocale_ThenReturnReplacedDecimalPoint() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "en-US")
+ .param("amount", "1.5"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("1,5")));
+ }
+}
diff --git a/stripe/pom.xml b/stripe/pom.xml
index 07d2968f5f..48505c9e4e 100644
--- a/stripe/pom.xml
+++ b/stripe/pom.xml
@@ -11,9 +11,9 @@
com.baeldung
- parent-boot-1
+ parent-boot-2
0.0.1-SNAPSHOT
- ../parent-boot-1
+ ../parent-boot-2
@@ -28,9 +28,6 @@
org.projectlombok
lombok
- ${lombok.version}
-
com.stripe
diff --git a/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java b/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java
index a5c056b659..190911afb3 100644
--- a/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java
+++ b/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java
@@ -13,4 +13,27 @@ public class ChargeRequest {
private Currency currency;
private String stripeEmail;
private String stripeToken;
+ public String getDescription() {
+ return description;
+ }
+ public int getAmount() {
+ return amount;
+ }
+ public Currency getCurrency() {
+ return currency;
+ }
+ public String getStripeEmail() {
+ return stripeEmail;
+ }
+ public String getStripeToken() {
+ return stripeToken;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public void setCurrency(Currency currency) {
+ this.currency = currency;
+ }
+
+
}
diff --git a/stripe/src/main/resources/application.properties b/stripe/src/main/resources/application.properties
new file mode 100644
index 0000000000..f36df33897
--- /dev/null
+++ b/stripe/src/main/resources/application.properties
@@ -0,0 +1,2 @@
+STRIPE_SECRET_KEY=
+STRIPE_PUBLIC_KEY=
\ No newline at end of file
diff --git a/stripe/src/main/resources/static/index.html b/stripe/src/main/resources/static/index.html
index 090a01e91d..d7ba2bef91 100644
--- a/stripe/src/main/resources/static/index.html
+++ b/stripe/src/main/resources/static/index.html
@@ -1,7 +1,7 @@
-
+
diff --git a/terraform/README.md b/terraform/README.md
new file mode 100644
index 0000000000..b2a9539727
--- /dev/null
+++ b/terraform/README.md
@@ -0,0 +1,4 @@
+### Relevant Articles:
+
+- [Introduction to Terraform](https://www.baeldung.com/ops/terraform-intro)
+- [Best Practices When Using Terraform](https://www.baeldung.com/ops/terraform-best-practices)
diff --git a/testing-modules/assertion-libraries/README.md b/testing-modules/assertion-libraries/README.md
index d69457fdeb..ca4cc86f7e 100644
--- a/testing-modules/assertion-libraries/README.md
+++ b/testing-modules/assertion-libraries/README.md
@@ -10,4 +10,4 @@
- [Custom Assertions with AssertJ](http://www.baeldung.com/assertj-custom-assertion)
- [Using Conditions with AssertJ Assertions](http://www.baeldung.com/assertj-conditions)
- [AssertJ Exception Assertions](http://www.baeldung.com/assertj-exception-assertion)
-
+- [Asserting Log Messages With JUnit](https://www.baeldung.com/junit-asserting-logs)
diff --git a/testing-modules/junit5-annotations/README.md b/testing-modules/junit5-annotations/README.md
index 02d4cd652a..bd51bb3d2d 100644
--- a/testing-modules/junit5-annotations/README.md
+++ b/testing-modules/junit5-annotations/README.md
@@ -7,3 +7,4 @@ This module contains articles about JUnit 5 Annotations
- [JUnit 5 Conditional Test Execution with Annotations](https://www.baeldung.com/junit-5-conditional-test-execution)
- [JUnit5 Programmatic Extension Registration with @RegisterExtension](https://www.baeldung.com/junit-5-registerextension-annotation)
- [Guide to JUnit 5 Parameterized Tests](https://www.baeldung.com/parameterized-tests-junit-5)
+- [Writing Templates for Test Cases Using JUnit 5](https://www.baeldung.com/junit5-test-templates)
diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md
index 6c9ddee01d..329228186f 100644
--- a/testing-modules/mockito-2/README.md
+++ b/testing-modules/mockito-2/README.md
@@ -5,3 +5,4 @@
- [Mockito Strict Stubbing and The UnnecessaryStubbingException](https://www.baeldung.com/mockito-unnecessary-stubbing-exception)
- [Mockito and Fluent APIs](https://www.baeldung.com/mockito-fluent-apis)
- [Mocking the ObjectMapper readValue() Method](https://www.baeldung.com/mockito-mock-jackson-read-value)
+- [Introduction to Mockito’s AdditionalAnswers](https://www.baeldung.com/mockito-additionalanswers)
diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml
index 951909b36f..b467b3c503 100644
--- a/testing-modules/pom.xml
+++ b/testing-modules/pom.xml
@@ -33,6 +33,7 @@
selenium-junit-testng
spring-testing
test-containers
+ testing-assertions
testng
junit-5-basics
easymock
diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickTest.java
new file mode 100644
index 0000000000..6d2ab8ef1f
--- /dev/null
+++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickTest.java
@@ -0,0 +1,61 @@
+package java.com.baeldung.selenium.clickusingjavascript;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class SeleniumJavaScriptClickTest {
+
+ private WebDriver driver;
+ private WebDriverWait wait;
+
+ @Before
+ public void setUp() {
+ System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
+ driver = new ChromeDriver();
+ wait = new WebDriverWait(driver, 5000);
+ }
+
+ @After
+ public void cleanUp() {
+ driver.close();
+ }
+
+ @Test
+ public void whenSearchForSeleniumArticles_thenReturnNotEmptyResults() {
+ driver.get("https://baeldung.com");
+ String title = driver.getTitle();
+ assertEquals("Baeldung | Java, Spring and Web Development tutorials", title);
+
+ wait.until(ExpectedConditions.elementToBeClickable(By.className("menu-search")));
+ WebElement searchButton = driver.findElement(By.className("menu-search"));
+ clickElement(searchButton);
+
+ wait.until(ExpectedConditions.elementToBeClickable(By.id("search")));
+ WebElement searchInput = driver.findElement(By.id("search"));
+ searchInput.sendKeys("Selenium");
+
+ wait.until(ExpectedConditions.elementToBeClickable(By.className("btn-search")));
+ WebElement seeSearchResultsButton = driver.findElement(By.className("btn-search"));
+ clickElement(seeSearchResultsButton);
+
+ int seleniumPostsCount = driver.findElements(By.className("post")).size();
+ assertTrue(seleniumPostsCount > 0);
+ }
+
+ private void clickElement(WebElement element) {
+ JavascriptExecutor executor = (JavascriptExecutor) driver;
+ executor.executeScript("arguments[0].click();", element);
+ }
+
+}
diff --git a/testing-modules/testing-assertions/pom.xml b/testing-modules/testing-assertions/pom.xml
new file mode 100644
index 0000000000..0a7c4b0860
--- /dev/null
+++ b/testing-modules/testing-assertions/pom.xml
@@ -0,0 +1,28 @@
+
+ 4.0.0
+ testing-assertions
+ 0.0.1-SNAPSHOT
+
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../../parent-java
+
+
+
+
+ ch.qos.logback
+ logback-classic
+ 1.2.3
+
+
+ org.assertj
+ assertj-core
+ 3.15.0
+ test
+
+
+
diff --git a/testing-modules/testing-assertions/src/main/java/com/baeldung/junit/log/BusinessWorker.java b/testing-modules/testing-assertions/src/main/java/com/baeldung/junit/log/BusinessWorker.java
new file mode 100644
index 0000000000..86cd38824c
--- /dev/null
+++ b/testing-modules/testing-assertions/src/main/java/com/baeldung/junit/log/BusinessWorker.java
@@ -0,0 +1,16 @@
+package com.baeldung.junit.log;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BusinessWorker {
+ private static Logger LOGGER = LoggerFactory.getLogger(BusinessWorker.class);
+
+ public void generateLogs(String msg) {
+ LOGGER.trace(msg);
+ LOGGER.debug(msg);
+ LOGGER.info(msg);
+ LOGGER.warn(msg);
+ LOGGER.error(msg);
+ }
+}
diff --git a/testing-modules/testing-assertions/src/main/resources/logback.xml b/testing-modules/testing-assertions/src/main/resources/logback.xml
new file mode 100644
index 0000000000..d485da62ff
--- /dev/null
+++ b/testing-modules/testing-assertions/src/main/resources/logback.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/testing-modules/testing-assertions/src/test/java/com/baeldung/junit/log/BusinessWorkerUnitTest.java b/testing-modules/testing-assertions/src/test/java/com/baeldung/junit/log/BusinessWorkerUnitTest.java
new file mode 100644
index 0000000000..9200caf13d
--- /dev/null
+++ b/testing-modules/testing-assertions/src/test/java/com/baeldung/junit/log/BusinessWorkerUnitTest.java
@@ -0,0 +1,48 @@
+package com.baeldung.junit.log;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+
+public class BusinessWorkerUnitTest {
+ private static MemoryAppender memoryAppender;
+ private static final String LOGGER_NAME = "com.baeldung.junit.log";
+ private static final String MSG = "This is a test message!!!";
+
+ @Before
+ public void setup() {
+ Logger logger = (Logger) LoggerFactory.getLogger(LOGGER_NAME);
+ memoryAppender = new MemoryAppender();
+ memoryAppender.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
+ logger.setLevel(Level.DEBUG);
+ logger.addAppender(memoryAppender);
+ memoryAppender.start();
+
+ }
+
+ @After
+ public void cleanUp() {
+ memoryAppender.reset();
+ memoryAppender.stop();
+ }
+
+ @Test
+ public void test() {
+ BusinessWorker worker = new BusinessWorker();
+ worker.generateLogs(MSG);
+
+ // I check that I only have 4 messages (all but trace)
+ assertThat(memoryAppender.countEventsForLogger(LOGGER_NAME)).isEqualTo(4);
+ // I look for a specific message at a specific level, and I only have 1
+ assertThat(memoryAppender.search(MSG, Level.INFO).size()).isEqualTo(1);
+ // I check that the entry that is not present is the trace level
+ assertThat(memoryAppender.contains(MSG, Level.TRACE)).isFalse();
+ }
+}
diff --git a/testing-modules/testing-assertions/src/test/java/com/baeldung/junit/log/MemoryAppender.java b/testing-modules/testing-assertions/src/test/java/com/baeldung/junit/log/MemoryAppender.java
new file mode 100644
index 0000000000..31c5c69766
--- /dev/null
+++ b/testing-modules/testing-assertions/src/test/java/com/baeldung/junit/log/MemoryAppender.java
@@ -0,0 +1,51 @@
+package com.baeldung.junit.log;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+
+/**
+ * In memory slf4j appender
+ * Convenient appender to be able to check slf4j invocations
+ */
+public class MemoryAppender extends ListAppender {
+ public void reset() {
+ this.list.clear();
+ }
+
+ public boolean contains(String string, Level level) {
+ return this.list.stream()
+ .anyMatch(event -> event.getMessage().toString().contains(string)
+ && event.getLevel().equals(level));
+ }
+
+ public int countEventsForLogger(String loggerName) {
+ return (int) this.list.stream()
+ .filter(event -> event.getLoggerName().contains(loggerName)).count();
+ }
+
+ public List search(String string) {
+ return this.list.stream()
+ .filter(event -> event.getMessage().toString().contains(string))
+ .collect(Collectors.toList());
+ }
+
+ public List search(String string, Level level) {
+ return this.list.stream()
+ .filter(event -> event.getMessage().toString().contains(string)
+ && event.getLevel().equals(level))
+ .collect(Collectors.toList());
+ }
+
+ public int getSize() {
+ return this.list.size();
+ }
+
+ public List getLoggedEvents() {
+ return Collections.unmodifiableList(this.list);
+ }
+}
diff --git a/testing-modules/testing-assertions/src/test/resources/logback.xml b/testing-modules/testing-assertions/src/test/resources/logback.xml
new file mode 100644
index 0000000000..980ce897ff
--- /dev/null
+++ b/testing-modules/testing-assertions/src/test/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
\ No newline at end of file