Merge branch 'master' of https://github.com/eugenp/tutorials into task/BAEL-9040

This commit is contained in:
Dhawal Kapil 2018-10-21 00:26:48 +05:30
commit dfd549e665
444 changed files with 1630 additions and 1270 deletions

View File

@ -4,37 +4,23 @@
### Relevant Articles:
- [Immutable ArrayList in Java](http://www.baeldung.com/java-immutable-list)
- [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array)
- [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array)
- [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list)
- [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set)
- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist)
- [Random List Element](http://www.baeldung.com/java-random-list-element)
- [Java - Combine Multiple Collections](http://www.baeldung.com/java-combine-multiple-collections)
- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap)
- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap)
- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap)
- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap)
- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap)
- [Removing all nulls from a List in Java](http://www.baeldung.com/java-remove-nulls-from-list)
- [Removing all duplicates from a List in Java](http://www.baeldung.com/java-remove-duplicates-from-list)
- [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections)
- [HashSet and TreeSet Comparison](http://www.baeldung.com/java-hashset-vs-treeset)
- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map)
- [Collect a Java Stream to an Immutable Collection](http://www.baeldung.com/java-stream-immutable-collection)
- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string)
- [Introduction to the Java ArrayDeque](http://www.baeldung.com/java-array-deque)
- [A Guide to HashSet in Java](http://www.baeldung.com/java-hashset)
- [A Guide to TreeSet in Java](http://www.baeldung.com/java-tree-set)
- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap)
- [How to TDD a List Implementation in Java](http://www.baeldung.com/java-test-driven-list)
- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys)
- [Getting the Size of an Iterable in Java](http://www.baeldung.com/java-iterable-size)
- [Iterating Backward Through a List](http://www.baeldung.com/java-list-iterate-backwards)
- [How to Filter a Collection in Java](http://www.baeldung.com/java-collection-filtering)
- [Add Multiple Items to an Java ArrayList](http://www.baeldung.com/java-add-items-array-list)
- [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list)
- [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map)
- [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset)
- [Removing the First Element of an Array](https://www.baeldung.com/java-array-remove-first-element)
- [Fail-Safe Iterator vs Fail-Fast Iterator](http://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator)
@ -47,12 +33,8 @@
- [Remove All Occurrences of a Specific Value from a List](https://www.baeldung.com/java-remove-value-from-list)
- [Thread Safe LIFO Data Structure Implementations](https://www.baeldung.com/java-lifo-thread-safe)
- [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list)
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
- [Differences Between Collection.clear() and Collection.removeAll()](https://www.baeldung.com/java-collection-clear-vs-removeall)
- [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance)
- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value)
- [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity)
- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort)
- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max)
- [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream)
- [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections)

View File

@ -14,22 +14,11 @@
</parent>
<dependencies>
<dependency>
<groupId>net.sourceforge.collections</groupId>
<artifactId>collections-generic</artifactId>
<version>${collections-generic.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
</dependency>
<dependency>
<groupId>com.jayway.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${avaitility.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
@ -67,12 +56,6 @@
<artifactId>commons-exec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>one.util</groupId>
<artifactId>streamex</artifactId>
<version>0.6.5</version>
</dependency>
</dependencies>
<properties>

View File

@ -29,7 +29,6 @@
- [AWS Lambda With Java](http://www.baeldung.com/java-aws-lambda)
- [Introduction to Nashorn](http://www.baeldung.com/java-nashorn)
- [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions)
- [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng)
- [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions)
- [Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency)
- [JVM Log Forging](http://www.baeldung.com/jvm-log-forging)
@ -150,9 +149,11 @@
- [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception)
- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string)
- [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic)
- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root)
- [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string)
- [Different Ways to Capture Java Heap Dumps](https://www.baeldung.com/java-heap-dump-capture)
- [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts)
- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset)
- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing)
- [Java Switch Statement](https://www.baeldung.com/java-switch)
- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java)

View File

@ -0,0 +1,11 @@
=========
## Java Collections Cookbooks and Examples
### Relevant Articles:
- [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array)
- [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array)
- [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list)
- [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set)
- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string)
- [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map)

View File

@ -0,0 +1,40 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>java-collections-conversions</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>java-collections-conversions</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<commons-lang3.version>3.5</commons-lang3.version>
<commons-collections4.version>4.1</commons-collections4.version>
<assertj.version>3.6.1</assertj.version>
</properties>
</project>

View File

@ -0,0 +1,18 @@
=========
## Java Collections Cookbooks and Examples
### Relevant Articles:
- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap)
- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap)
- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap)
- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap)
- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap)
- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map)
- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap)
- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys)
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value)
- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort)
- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max)
- [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps)

View File

@ -0,0 +1,54 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>java-collections-maps</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>java-collections-maps</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
</dependency>
<dependency>
<groupId>com.jayway.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${avaitility.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>one.util</groupId>
<artifactId>streamex</artifactId>
<version>0.6.5</version>
</dependency>
</dependencies>
<properties>
<commons-lang3.version>3.5</commons-lang3.version>
<commons-collections4.version>4.1</commons-collections4.version>
<collections-generic.version>4.01</collections-generic.version>
<avaitility.version>1.7.0</avaitility.version>
<assertj.version>3.6.1</assertj.version>
<eclipse.collections.version>7.1.0</eclipse.collections.version>
</properties>
</project>

View File

@ -29,7 +29,7 @@
</dependencies>
<properties>
<spring.version>4.3.17.RELEASE</spring.version>
<spring.version>4.3.20.RELEASE</spring.version>
<junit.jupiter.version>5.0.2</junit.jupiter.version>
</properties>

View File

@ -1,71 +1,71 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.core-java-persistence</groupId>
<artifactId>core-java-persistence</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>core-java-persistence</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2database.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${commons-dbcp2.version}</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${HikariCP.version}</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>${c3p0.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.spring-web.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${springframework.boot.spring-boot-starter.version}</version>
</dependency>
</dependencies>
<build>
<finalName>core-java-persistence</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<assertj-core.version>3.10.0</assertj-core.version>
<h2database.version>1.4.197</h2database.version>
<commons-dbcp2.version>2.4.0</commons-dbcp2.version>
<HikariCP.version>3.2.0</HikariCP.version>
<c3p0.version>0.9.5.2</c3p0.version>
<springframework.boot.spring-boot-starter.version>1.5.8.RELEASE</springframework.boot.spring-boot-starter.version>
<springframework.spring-web.version>4.3.4.RELEASE</springframework.spring-web.version>
</properties>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.core-java-persistence</groupId>
<artifactId>core-java-persistence</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>core-java-persistence</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2database.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${commons-dbcp2.version}</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${HikariCP.version}</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>${c3p0.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.spring-web.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${springframework.boot.spring-boot-starter.version}</version>
</dependency>
</dependencies>
<build>
<finalName>core-java-persistence</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<assertj-core.version>3.10.0</assertj-core.version>
<h2database.version>1.4.197</h2database.version>
<commons-dbcp2.version>2.4.0</commons-dbcp2.version>
<HikariCP.version>3.2.0</HikariCP.version>
<c3p0.version>0.9.5.2</c3p0.version>
<springframework.boot.spring-boot-starter.version>1.5.8.RELEASE</springframework.boot.spring-boot-starter.version>
<springframework.spring-web.version>4.3.4.RELEASE</springframework.spring-web.version>
</properties>
</project>

View File

@ -1,67 +1,67 @@
package com.baeldung.connectionpool;
import java.sql.Connection;
import java.sql.SQLException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.BeforeClass;
import org.junit.Test;
public class BasicConnectionPoolUnitTest {
private static ConnectionPool connectionPool;
@BeforeClass
public static void setUpBasicConnectionPoolInstance() throws SQLException {
connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception {
assertTrue(connectionPool.getConnection().isValid(1));
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception {
Connection connection = connectionPool.getConnection();
assertThat(connectionPool.releaseConnection(connection)).isTrue();
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() {
assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test");
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() {
assertThat(connectionPool.getUser()).isEqualTo("user");
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() {
assertThat(connectionPool.getPassword()).isEqualTo("password");
}
@Test(expected = RuntimeException.class)
public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception {
// this test needs to be independent so it doesn't share the same connection pool as other tests
ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
final int MAX_POOL_SIZE = 20;
for (int i = 0; i < MAX_POOL_SIZE + 1; i++) {
cp.getConnection();
}
fail();
}
@Test
public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception {
ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10);
((BasicConnectionPool) cp).shutdown();
assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0);
}
}
package com.baeldung.connectionpool;
import java.sql.Connection;
import java.sql.SQLException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.BeforeClass;
import org.junit.Test;
public class BasicConnectionPoolUnitTest {
private static ConnectionPool connectionPool;
@BeforeClass
public static void setUpBasicConnectionPoolInstance() throws SQLException {
connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception {
assertTrue(connectionPool.getConnection().isValid(1));
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception {
Connection connection = connectionPool.getConnection();
assertThat(connectionPool.releaseConnection(connection)).isTrue();
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() {
assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test");
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() {
assertThat(connectionPool.getUser()).isEqualTo("user");
}
@Test
public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() {
assertThat(connectionPool.getPassword()).isEqualTo("password");
}
@Test(expected = RuntimeException.class)
public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception {
// this test needs to be independent so it doesn't share the same connection pool as other tests
ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
final int MAX_POOL_SIZE = 20;
for (int i = 0; i < MAX_POOL_SIZE + 1; i++) {
cp.getConnection();
}
fail();
}
@Test
public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception {
ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10);
((BasicConnectionPool) cp).shutdown();
assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0);
}
}

View File

@ -1,13 +1,13 @@
package com.baeldung.connectionpool;
import java.sql.SQLException;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class C3poDataSourceUnitTest {
@Test
public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
assertTrue(C3poDataSource.getConnection().isValid(1));
}
package com.baeldung.connectionpool;
import java.sql.SQLException;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class C3poDataSourceUnitTest {
@Test
public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
assertTrue(C3poDataSource.getConnection().isValid(1));
}
}

View File

@ -1,13 +1,13 @@
package com.baeldung.connectionpool;
import java.sql.SQLException;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class DBCPDataSourceUnitTest {
@Test
public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
assertTrue(DBCPDataSource.getConnection().isValid(1));
}
package com.baeldung.connectionpool;
import java.sql.SQLException;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class DBCPDataSourceUnitTest {
@Test
public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
assertTrue(DBCPDataSource.getConnection().isValid(1));
}
}

View File

@ -1,13 +1,13 @@
package com.baeldung.connectionpool;
import java.sql.SQLException;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class HikariCPDataSourceUnitTest {
@Test
public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
assertTrue(HikariCPDataSource.getConnection().isValid(1));
}
package com.baeldung.connectionpool;
import java.sql.SQLException;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class HikariCPDataSourceUnitTest {
@Test
public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
assertTrue(HikariCPDataSource.getConnection().isValid(1));
}
}

View File

@ -14,6 +14,7 @@
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<dependencies>

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More