Build optimization (#2253)
This commit is contained in:
parent
e5abeb4fd9
commit
84956990b6
@ -3,7 +3,6 @@ package com.baeldung.awaitility;
|
|||||||
import org.awaitility.Awaitility;
|
import org.awaitility.Awaitility;
|
||||||
import org.awaitility.Duration;
|
import org.awaitility.Duration;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.baeldung.cglib.proxy;
|
package com.baeldung.cglib.proxy;
|
||||||
|
|
||||||
import com.baeldung.cglib.mixin.*;
|
import com.baeldung.cglib.mixin.Class1;
|
||||||
|
import com.baeldung.cglib.mixin.Class2;
|
||||||
|
import com.baeldung.cglib.mixin.Interface1;
|
||||||
|
import com.baeldung.cglib.mixin.Interface2;
|
||||||
|
import com.baeldung.cglib.mixin.MixinInterface;
|
||||||
import net.sf.cglib.proxy.Mixin;
|
import net.sf.cglib.proxy.Mixin;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -2,16 +2,12 @@ package com.baeldung.commons.collections;
|
|||||||
|
|
||||||
import org.apache.commons.collections4.BidiMap;
|
import org.apache.commons.collections4.BidiMap;
|
||||||
import org.apache.commons.collections4.bidimap.DualHashBidiMap;
|
import org.apache.commons.collections4.bidimap.DualHashBidiMap;
|
||||||
import org.apache.commons.collections4.bidimap.DualLinkedHashBidiMap;
|
|
||||||
import org.apache.commons.collections4.bidimap.DualTreeBidiMap;
|
|
||||||
import org.apache.commons.collections4.bidimap.TreeBidiMap;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by smatt on 03/07/2017.
|
|
||||||
*/
|
|
||||||
public class BidiMapUnitTest {
|
public class BidiMapUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -3,14 +3,17 @@ package com.baeldung.commons.collections;
|
|||||||
|
|
||||||
import com.baeldung.commons.collectionutil.Address;
|
import com.baeldung.commons.collectionutil.Address;
|
||||||
import com.baeldung.commons.collectionutil.Customer;
|
import com.baeldung.commons.collectionutil.Customer;
|
||||||
import org.apache.commons.collections4.Closure;
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.collections4.Predicate;
|
import org.apache.commons.collections4.Predicate;
|
||||||
import org.apache.commons.collections4.Transformer;
|
import org.apache.commons.collections4.Transformer;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
@ -70,7 +73,7 @@ public class CollectionUtilsGuideTest {
|
|||||||
|
|
||||||
boolean isModified = CollectionUtils.filter(linkedList1, new Predicate<Customer>() {
|
boolean isModified = CollectionUtils.filter(linkedList1, new Predicate<Customer>() {
|
||||||
public boolean evaluate(Customer customer) {
|
public boolean evaluate(Customer customer) {
|
||||||
return Arrays.asList("Daniel","Kyle").contains(customer.getName());
|
return Arrays.asList("Daniel", "Kyle").contains(customer.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,16 +16,18 @@ import static org.hamcrest.Matchers.is;
|
|||||||
import static org.hamcrest.collection.IsMapContaining.hasEntry;
|
import static org.hamcrest.collection.IsMapContaining.hasEntry;
|
||||||
import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;
|
import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;
|
||||||
import static org.hamcrest.collection.IsMapWithSize.anEmptyMap;
|
import static org.hamcrest.collection.IsMapWithSize.anEmptyMap;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class MapUtilsTest {
|
public class MapUtilsTest {
|
||||||
|
|
||||||
private String[][] color2DArray = new String[][] {
|
private String[][] color2DArray = new String[][]{
|
||||||
{"RED", "#FF0000"},
|
{"RED", "#FF0000"},
|
||||||
{"GREEN", "#00FF00"},
|
{"GREEN", "#00FF00"},
|
||||||
{"BLUE", "#0000FF"}
|
{"BLUE", "#0000FF"}
|
||||||
};
|
};
|
||||||
private String[] color1DArray = new String[] {
|
private String[] color1DArray = new String[]{
|
||||||
"RED", "#FF0000",
|
"RED", "#FF0000",
|
||||||
"GREEN", "#00FF00",
|
"GREEN", "#00FF00",
|
||||||
"BLUE", "#0000FF"
|
"BLUE", "#0000FF"
|
||||||
|
@ -11,9 +11,6 @@ import java.util.Set;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by smatt on 21/06/2017.
|
|
||||||
*/
|
|
||||||
public class SetUtilsUnitTest {
|
public class SetUtilsUnitTest {
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@ -27,33 +24,33 @@ public class SetUtilsUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTwoSets_whenDifference_thenSetView() {
|
public void givenTwoSets_whenDifference_thenSetView() {
|
||||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
Set<Integer> a = new HashSet<>(Arrays.asList(1, 2, 5));
|
||||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2));
|
Set<Integer> b = new HashSet<>(Arrays.asList(1, 2));
|
||||||
SetUtils.SetView<Integer> result = SetUtils.difference(a, b);
|
SetUtils.SetView<Integer> result = SetUtils.difference(a, b);
|
||||||
assertTrue(result.size() == 1 && result.contains(5));
|
assertTrue(result.size() == 1 && result.contains(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTwoSets_whenUnion_thenUnionResult() {
|
public void givenTwoSets_whenUnion_thenUnionResult() {
|
||||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
Set<Integer> a = new HashSet<>(Arrays.asList(1, 2, 5));
|
||||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2));
|
Set<Integer> b = new HashSet<>(Arrays.asList(1, 2));
|
||||||
Set<Integer> expected = new HashSet<>(Arrays.asList(1,2,5));
|
Set<Integer> expected = new HashSet<>(Arrays.asList(1, 2, 5));
|
||||||
SetUtils.SetView<Integer> union = SetUtils.union(a, b);
|
SetUtils.SetView<Integer> union = SetUtils.union(a, b);
|
||||||
assertTrue(SetUtils.isEqualSet(expected, union));
|
assertTrue(SetUtils.isEqualSet(expected, union));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTwoSets_whenIntersection_thenIntersectionResult() {
|
public void givenTwoSets_whenIntersection_thenIntersectionResult() {
|
||||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
Set<Integer> a = new HashSet<>(Arrays.asList(1, 2, 5));
|
||||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2));
|
Set<Integer> b = new HashSet<>(Arrays.asList(1, 2));
|
||||||
Set<Integer> expected = new HashSet<>(Arrays.asList(1,2));
|
Set<Integer> expected = new HashSet<>(Arrays.asList(1, 2));
|
||||||
SetUtils.SetView<Integer> intersect = SetUtils.intersection(a, b);
|
SetUtils.SetView<Integer> intersect = SetUtils.intersection(a, b);
|
||||||
assertTrue(SetUtils.isEqualSet(expected, intersect));
|
assertTrue(SetUtils.isEqualSet(expected, intersect));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenSet_whenTransformedSet_thenTransformedResult() {
|
public void givenSet_whenTransformedSet_thenTransformedResult() {
|
||||||
Set<Integer> a = SetUtils.transformedSet(new HashSet<>(), (e) -> e * 2 );
|
Set<Integer> a = SetUtils.transformedSet(new HashSet<>(), (e) -> e * 2);
|
||||||
a.add(2);
|
a.add(2);
|
||||||
assertEquals(a.toArray()[0], 4);
|
assertEquals(a.toArray()[0], 4);
|
||||||
|
|
||||||
@ -65,19 +62,19 @@ public class SetUtilsUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTwoSet_whenDisjunction_thenDisjunctionSet() {
|
public void givenTwoSet_whenDisjunction_thenDisjunctionSet() {
|
||||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
Set<Integer> a = new HashSet<>(Arrays.asList(1, 2, 5));
|
||||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2,3));
|
Set<Integer> b = new HashSet<>(Arrays.asList(1, 2, 3));
|
||||||
SetUtils.SetView<Integer> result = SetUtils.disjunction(a, b);
|
SetUtils.SetView<Integer> result = SetUtils.disjunction(a, b);
|
||||||
assertTrue(result.toSet().contains(5) && result.toSet().contains(3));
|
assertTrue(result.toSet().contains(5) && result.toSet().contains(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenSet_when_OrderedSet_thenMaintainElementOrder() {
|
public void givenSet_when_OrderedSet_thenMaintainElementOrder() {
|
||||||
Set<Integer> set = new HashSet<>(Arrays.asList(10,1,5));
|
Set<Integer> set = new HashSet<>(Arrays.asList(10, 1, 5));
|
||||||
System.out.println("unordered set: " + set);
|
System.out.println("unordered set: " + set);
|
||||||
|
|
||||||
Set<Integer> orderedSet = SetUtils.orderedSet(new HashSet<>());
|
Set<Integer> orderedSet = SetUtils.orderedSet(new HashSet<>());
|
||||||
orderedSet.addAll(Arrays.asList(10,1,5));
|
orderedSet.addAll(Arrays.asList(10, 1, 5));
|
||||||
System.out.println("ordered set = " + orderedSet);
|
System.out.println("ordered set = " + orderedSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,5 @@
|
|||||||
package com.baeldung.commons.collections.orderedmap;
|
package com.baeldung.commons.collections.orderedmap;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.collections4.OrderedMap;
|
import org.apache.commons.collections4.OrderedMap;
|
||||||
import org.apache.commons.collections4.OrderedMapIterator;
|
import org.apache.commons.collections4.OrderedMapIterator;
|
||||||
import org.apache.commons.collections4.map.LinkedMap;
|
import org.apache.commons.collections4.map.LinkedMap;
|
||||||
@ -12,6 +7,11 @@ import org.apache.commons.collections4.map.ListOrderedMap;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class OrderedMapUnitTest {
|
public class OrderedMapUnitTest {
|
||||||
|
|
||||||
private String[] names = {"Emily", "Mathew", "Rose", "John", "Anna"};
|
private String[] names = {"Emily", "Mathew", "Rose", "John", "Anna"};
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
package com.baeldung.commons.dbutils;
|
package com.baeldung.commons.dbutils;
|
||||||
|
|
||||||
|
import org.apache.commons.dbutils.AsyncQueryRunner;
|
||||||
|
import org.apache.commons.dbutils.DbUtils;
|
||||||
|
import org.apache.commons.dbutils.QueryRunner;
|
||||||
|
import org.apache.commons.dbutils.handlers.BeanListHandler;
|
||||||
|
import org.apache.commons.dbutils.handlers.MapListHandler;
|
||||||
|
import org.apache.commons.dbutils.handlers.ScalarHandler;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -9,16 +19,9 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.apache.commons.dbutils.AsyncQueryRunner;
|
|
||||||
import org.apache.commons.dbutils.DbUtils;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.apache.commons.dbutils.QueryRunner;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import org.apache.commons.dbutils.handlers.BeanListHandler;
|
|
||||||
import org.apache.commons.dbutils.handlers.MapListHandler;
|
|
||||||
import org.apache.commons.dbutils.handlers.ScalarHandler;
|
|
||||||
import org.junit.After;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class DbUtilsUnitTest {
|
public class DbUtilsUnitTest {
|
||||||
|
|
||||||
|
@ -2,9 +2,10 @@ package com.baeldung.commons.lang3;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class StringUtilsUnitTest {
|
public class StringUtilsUnitTest {
|
||||||
@Test
|
@Test
|
||||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class HikariCPUnitTest {
|
public class HikariCPIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenConnection_thenFetchDbData() {
|
public void givenConnection_thenFetchDbData() {
|
@ -8,7 +8,9 @@ import org.jasypt.util.text.BasicTextEncryptor;
|
|||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static junit.framework.Assert.*;
|
import static junit.framework.Assert.assertFalse;
|
||||||
|
import static junit.framework.Assert.assertNotSame;
|
||||||
|
import static junit.framework.Assert.assertTrue;
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static junit.framework.TestCase.assertEquals;
|
||||||
|
|
||||||
public class JasyptUnitTest {
|
public class JasyptUnitTest {
|
||||||
@ -30,7 +32,7 @@ public class JasyptUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldBeSame(){
|
public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldBeSame() {
|
||||||
String password = "secret-pass";
|
String password = "secret-pass";
|
||||||
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
|
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
|
||||||
String encryptedPassword = passwordEncryptor.encryptPassword(password);
|
String encryptedPassword = passwordEncryptor.encryptPassword(password);
|
||||||
@ -43,7 +45,7 @@ public class JasyptUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldNotBeSame(){
|
public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldNotBeSame() {
|
||||||
String password = "secret-pass";
|
String password = "secret-pass";
|
||||||
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
|
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
|
||||||
String encryptedPassword = passwordEncryptor.encryptPassword(password);
|
String encryptedPassword = passwordEncryptor.encryptPassword(password);
|
||||||
@ -56,7 +58,6 @@ public class JasyptUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("should have installed local_policy.jar")
|
@Ignore("should have installed local_policy.jar")
|
||||||
public void givenTextPrivateData_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() {
|
public void givenTextPrivateData_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() {
|
||||||
@ -77,7 +78,7 @@ public class JasyptUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("should have installed local_policy.jar")
|
@Ignore("should have installed local_policy.jar")
|
||||||
public void givenTextPrivateData_whenDecryptOnHighPerformance_thenDecrypt(){
|
public void givenTextPrivateData_whenDecryptOnHighPerformance_thenDecrypt() {
|
||||||
//given
|
//given
|
||||||
String privateData = "secret-data";
|
String privateData = "secret-data";
|
||||||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
|
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
|
||||||
|
@ -8,7 +8,6 @@ import javax.jdo.PersistenceManager;
|
|||||||
import javax.jdo.PersistenceManagerFactory;
|
import javax.jdo.PersistenceManagerFactory;
|
||||||
import javax.jdo.Query;
|
import javax.jdo.Query;
|
||||||
import javax.jdo.Transaction;
|
import javax.jdo.Transaction;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -8,7 +8,11 @@ import au.com.dius.pact.consumer.dsl.PactDslWithProvider;
|
|||||||
import au.com.dius.pact.model.RequestResponsePact;
|
import au.com.dius.pact.model.RequestResponsePact;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.baeldung.vaadin;
|
package com.baeldung.vaadin;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
|
import com.gargoylesoftware.htmlunit.BrowserVersion;
|
||||||
|
import com.vaadin.server.DefaultUIProvider;
|
||||||
|
import com.vaadin.server.VaadinServlet;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.ServerConnector;
|
import org.eclipse.jetty.server.ServerConnector;
|
||||||
@ -15,9 +17,7 @@ import org.openqa.selenium.WebDriver;
|
|||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
|
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
|
||||||
|
|
||||||
import com.gargoylesoftware.htmlunit.BrowserVersion;
|
import static org.junit.Assert.assertEquals;
|
||||||
import com.vaadin.server.DefaultUIProvider;
|
|
||||||
import com.vaadin.server.VaadinServlet;
|
|
||||||
|
|
||||||
|
|
||||||
public class VaadinUITests {
|
public class VaadinUITests {
|
||||||
@ -26,15 +26,15 @@ public class VaadinUITests {
|
|||||||
private Server server;
|
private Server server;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception{
|
public void setUp() throws Exception {
|
||||||
startJettyServer();
|
startJettyServer();
|
||||||
driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_45,true);
|
driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_45, true);
|
||||||
driver.get("http://localhost:8080");
|
driver.get("http://localhost:8080");
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPageLoadedThenShouldSeeURL(){
|
public void whenPageLoadedThenShouldSeeURL() {
|
||||||
String url = driver.getCurrentUrl();
|
String url = driver.getCurrentUrl();
|
||||||
assertEquals("http://localhost:8080/", url);
|
assertEquals("http://localhost:8080/", url);
|
||||||
}
|
}
|
||||||
@ -70,12 +70,12 @@ public class VaadinUITests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void cleanUp() throws Exception{
|
public void cleanUp() throws Exception {
|
||||||
driver.close();
|
driver.close();
|
||||||
server.stop();
|
server.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startJettyServer() throws Exception{
|
public void startJettyServer() throws Exception {
|
||||||
|
|
||||||
int maxThreads = 100;
|
int maxThreads = 100;
|
||||||
int minThreads = 10;
|
int minThreads = 10;
|
||||||
|
@ -5,8 +5,8 @@ import java.io.IOException;
|
|||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
public class JsonUtil {
|
class JsonUtil {
|
||||||
public static byte[] toJson(Object object) throws IOException {
|
static byte[] toJson(Object object) throws IOException {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
return mapper.writeValueAsBytes(object);
|
return mapper.writeValueAsBytes(object);
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
<artifactId>spring-mvc-java</artifactId>
|
<artifactId>spring-mvc-java</artifactId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.1-SNAPSHOT</version>
|
||||||
<name>spring-mvc-java</name>
|
<name>spring-mvc-java</name>
|
||||||
<packaging>war</packaging>
|
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user