Merge branch 'master' into master
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
resource.loader=webapp
|
||||
webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader
|
||||
webapp.resource.loader.path = .
|
||||
webapp.resource.loader.path =
|
||||
webapp.resource.loader.cache = true
|
||||
@@ -6,7 +6,7 @@ public class ServiceMain {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
ProcessHandle thisProcess = ProcessHandle.current();
|
||||
long pid = thisProcess.getPid();
|
||||
long pid = thisProcess.pid();
|
||||
|
||||
Optional<String[]> opArgs = Optional.ofNullable(args);
|
||||
String procName = opArgs.map(str -> str.length > 0 ? str[0] : null).orElse(System.getProperty("sun.java.command"));
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.baeldung.java9.language;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class Java9ObjectsAPIUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenNullObject_whenRequireNonNullElse_thenElse(){
|
||||
assertThat(Objects.<List>requireNonNullElse(null, Collections.EMPTY_LIST),
|
||||
is(Collections.EMPTY_LIST));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenObject_whenRequireNonNullElse_thenObject(){
|
||||
assertThat(Objects.<List>requireNonNullElse(List.of("item1", "item2"),
|
||||
Collections.EMPTY_LIST), is(List.of("item1", "item2")));
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void givenNull_whenRequireNonNullElse_thenException(){
|
||||
Objects.<List>requireNonNullElse(null, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenObject_whenRequireNonNullElseGet_thenObject(){
|
||||
assertThat(Objects.<List>requireNonNullElseGet(null, List::of),
|
||||
is(List.of()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNumber_whenInvokeCheckIndex_thenNumber(){
|
||||
int length = 5;
|
||||
assertThat(Objects.checkIndex(4, length), is(4));
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void givenOutOfRangeNumber_whenInvokeCheckIndex_thenException(){
|
||||
int length = 5;
|
||||
Objects.checkIndex(5, length);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenSubRange_whenCheckFromToIndex_thenNumber(){
|
||||
int length = 6;
|
||||
assertThat(Objects.checkFromToIndex(2,length,length), is(2));
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void givenInvalidSubRange_whenCheckFromToIndex_thenException(){
|
||||
int length = 6;
|
||||
Objects.checkFromToIndex(2,7,length);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenSubRange_whenCheckFromIndexSize_thenNumber(){
|
||||
int length = 6;
|
||||
assertThat(Objects.checkFromIndexSize(2,3,length), is(2));
|
||||
}
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void givenInvalidSubRange_whenCheckFromIndexSize_thenException(){
|
||||
int length = 6;
|
||||
Objects.checkFromIndexSize(2, 6, length);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
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</groupId>
|
||||
<!-- NOT NEEDED - JSP <groupId>com.baeldung</groupId>-->
|
||||
<artifactId>junit5</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<junit.jupiter.version>5.0.0-M5</junit.jupiter.version>
|
||||
<junit.platform.version>1.0.0-M5</junit.platform.version>
|
||||
<junit.vintage.version>4.12.0-M5</junit.vintage.version>
|
||||
<junit.jupiter.version>5.0.0-RC2</junit.jupiter.version>
|
||||
<junit.platform.version>1.0.0-RC2</junit.platform.version>
|
||||
<junit.vintage.version>4.12.0-RC2</junit.vintage.version>
|
||||
<log4j2.version>2.8.2</log4j2.version>
|
||||
<h2.version>1.4.196</h2.version>
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.baeldung.param;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
|
||||
public class InvalidPersonParameterResolver implements ParameterResolver {
|
||||
|
||||
/**
|
||||
* The "bad" (invalid) data for testing purposes has to go somewhere, right?
|
||||
*/
|
||||
public static Person[] INVALID_PERSONS = {
|
||||
new Person().setId(1L).setLastName("Ad_ams").setFirstName("Jill,"),
|
||||
new Person().setId(2L).setLastName(",Baker").setFirstName(""),
|
||||
new Person().setId(3L).setLastName(null).setFirstName(null),
|
||||
new Person().setId(4L).setLastName("Daniel&").setFirstName("{Joseph}"),
|
||||
new Person().setId(5L).setLastName("").setFirstName("English, Jane"),
|
||||
new Person()/* .setId(6L).setLastName("Fontana").setFirstName("Enrique") */,
|
||||
// TODO: ADD MORE DATA HERE
|
||||
};
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
Object ret = null;
|
||||
//
|
||||
// Return a random, valid Person object if Person.class is the type of Parameter
|
||||
/// to be resolved. Otherwise return null.
|
||||
if (parameterContext.getParameter().getType() == Person.class) {
|
||||
ret = INVALID_PERSONS[new Random().nextInt(INVALID_PERSONS.length)];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
boolean ret = false;
|
||||
//
|
||||
// If the Parameter.type == Person.class, then we support it, otherwise, get outta here!
|
||||
if (parameterContext.getParameter().getType() == Person.class) {
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.baeldung.param;
|
||||
|
||||
/**
|
||||
* Very simple Person entity.
|
||||
* Use the Fluent-style interface to set properties.
|
||||
*
|
||||
* @author J Steven Perry
|
||||
*
|
||||
*/
|
||||
public class Person {
|
||||
|
||||
private Long id;
|
||||
private String lastName;
|
||||
private String firstName;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Person setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public Person setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public Person setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.baeldung.param;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Somewhat contrived validation class to illustrate unit test
|
||||
* concepts.
|
||||
*
|
||||
* @author J Steven Perry
|
||||
*
|
||||
*/
|
||||
public class PersonValidator {
|
||||
|
||||
/**
|
||||
* Contrived checked exception to illustrate one possible
|
||||
* way to handle validation errors (via a checked exception).
|
||||
*
|
||||
* @author J Steven Perry
|
||||
*
|
||||
*/
|
||||
public static class ValidationException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -134518049431883102L;
|
||||
|
||||
// Probably should implement some more constructors, but don't want
|
||||
/// to tarnish the lesson...
|
||||
|
||||
/**
|
||||
* The one and only way to create this checked exception.
|
||||
*
|
||||
* @param message
|
||||
* The message accompanying the exception. Should be meaningful.
|
||||
*/
|
||||
public ValidationException(String message) {
|
||||
super(message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final String[] ILLEGAL_NAME_CHARACTERS = {
|
||||
",",
|
||||
"_",
|
||||
"{",
|
||||
"}",
|
||||
"!"
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate the first name of the specified Person object.
|
||||
*
|
||||
* @param person
|
||||
* The Person object to validate.
|
||||
*
|
||||
* @return - returns true if the specified Person is valid
|
||||
*
|
||||
* @throws ValidationException
|
||||
* - this Exception is thrown if any kind of validation error occurs.
|
||||
*/
|
||||
public static boolean validateFirstName(Person person) throws ValidationException {
|
||||
boolean ret = true;
|
||||
// The validation rules go here.
|
||||
// Naive: use simple ifs
|
||||
if (person == null) {
|
||||
throw new ValidationException("Person is null (not allowed)!");
|
||||
}
|
||||
if (person.getFirstName() == null) {
|
||||
throw new ValidationException("Person FirstName is null (not allowed)!");
|
||||
}
|
||||
if (person.getFirstName().isEmpty()) {
|
||||
throw new ValidationException("Person FirstName is an empty String (not allowed)!");
|
||||
}
|
||||
if (!isStringValid(person.getFirstName(), ILLEGAL_NAME_CHARACTERS)) {
|
||||
throw new ValidationException(
|
||||
"Person FirstName (" + person.getFirstName() + ") may not contain any of the following characters: "
|
||||
+ Arrays.toString(ILLEGAL_NAME_CHARACTERS)
|
||||
+ "!");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the last name of the specified Person object. Looks the same as first
|
||||
* name? Look closer. Just kidding. It's the same. But real world code can (and will) diverge.
|
||||
*
|
||||
* @param person
|
||||
* The Person object to validate.
|
||||
*
|
||||
* @return - returns true if the specified Person is valid
|
||||
*
|
||||
* @throws ValidationException
|
||||
* - this Exception is thrown if any kind of validation error occurs.
|
||||
*/
|
||||
public static boolean validateLastName(Person person) throws ValidationException {
|
||||
boolean ret = true;
|
||||
// The validation rules go here.
|
||||
// Naive: use simple ifs
|
||||
if (person == null) {
|
||||
throw new ValidationException("Person is null (not allowed)!");
|
||||
}
|
||||
if (person.getFirstName() == null) {
|
||||
throw new ValidationException("Person FirstName is null (not allowed)!");
|
||||
}
|
||||
if (person.getFirstName().isEmpty()) {
|
||||
throw new ValidationException("Person FirstName is an empty String (not allowed)!");
|
||||
}
|
||||
if (!isStringValid(person.getFirstName(), ILLEGAL_NAME_CHARACTERS)) {
|
||||
throw new ValidationException(
|
||||
"Person LastName (" + person.getLastName() + ") may not contain any of the following characters: "
|
||||
+ Arrays.toString(ILLEGAL_NAME_CHARACTERS)
|
||||
+ "!");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the specified name. If it contains any of the illegalCharacters,
|
||||
* this method returns false (indicating the name is illegal). Otherwise it returns true.
|
||||
*
|
||||
* @param candidate
|
||||
* The candidate String to validate
|
||||
*
|
||||
* @param illegalCharacters
|
||||
* The characters the String is not allowed to have
|
||||
*
|
||||
* @return - boolean - true if the name is valid, false otherwise.
|
||||
*/
|
||||
private static boolean isStringValid(String candidate, String[] illegalCharacters) {
|
||||
boolean ret = true;
|
||||
for (String illegalChar : illegalCharacters) {
|
||||
if (candidate.contains(illegalChar)) {
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.baeldung.param;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.RepeatedTest;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.platform.runner.JUnitPlatform;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(JUnitPlatform.class)
|
||||
@DisplayName("Testing PersonValidator")
|
||||
public class PersonValidatorTest {
|
||||
|
||||
/**
|
||||
* Nested class, uses ExtendWith
|
||||
* {@link com.baeldung.param.ValidPersonParameterResolver ValidPersonParameterResolver}
|
||||
* to feed Test methods with "good" data.
|
||||
*/
|
||||
@Nested
|
||||
@DisplayName("When using Valid data")
|
||||
@ExtendWith(ValidPersonParameterResolver.class)
|
||||
public class ValidData {
|
||||
|
||||
/**
|
||||
* Repeat the test ten times, that way we have a good shot at
|
||||
* running all of the data through at least once.
|
||||
*
|
||||
* @param person
|
||||
* A valid Person object to validate.
|
||||
*/
|
||||
@RepeatedTest(value = 10)
|
||||
@DisplayName("All first names are valid")
|
||||
public void validateFirstName(Person person) {
|
||||
try {
|
||||
assertTrue(PersonValidator.validateFirstName(person));
|
||||
} catch (PersonValidator.ValidationException e) {
|
||||
fail("Exception not expected: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test ten times, that way we have a good shot at
|
||||
* running all of the data through at least once.
|
||||
*
|
||||
* @param person
|
||||
* A valid Person object to validate.
|
||||
*/
|
||||
@RepeatedTest(value = 10)
|
||||
@DisplayName("All last names are valid")
|
||||
public void validateLastName(Person person) {
|
||||
try {
|
||||
assertTrue(PersonValidator.validateLastName(person));
|
||||
} catch (PersonValidator.ValidationException e) {
|
||||
fail("Exception not expected: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Nested class, uses ExtendWith
|
||||
* {@link com.baeldung.param.InvalidPersonParameterResolver InvalidPersonParameterResolver}
|
||||
* to feed Test methods with "bad" data.
|
||||
*/
|
||||
@Nested
|
||||
@DisplayName("When using Invalid data")
|
||||
@ExtendWith(InvalidPersonParameterResolver.class)
|
||||
public class InvalidData {
|
||||
|
||||
/**
|
||||
* Repeat the test ten times, that way we have a good shot at
|
||||
* running all of the data through at least once.
|
||||
*
|
||||
* @param person
|
||||
* An invalid Person object to validate.
|
||||
*/
|
||||
@RepeatedTest(value = 10)
|
||||
@DisplayName("All first names are invalid")
|
||||
public void validateFirstName(Person person) {
|
||||
assertThrows(PersonValidator.ValidationException.class, () -> PersonValidator.validateFirstName(person));
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test ten times, that way we have a good shot at
|
||||
* running all of the data through at least once.
|
||||
*
|
||||
* @param person
|
||||
* An invalid Person object to validate.
|
||||
*/
|
||||
@RepeatedTest(value = 10)
|
||||
@DisplayName("All first names are invalid")
|
||||
public void validateLastName(Person person) {
|
||||
assertThrows(PersonValidator.ValidationException.class, () -> PersonValidator.validateLastName(person));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.baeldung.param;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
|
||||
public class ValidPersonParameterResolver implements ParameterResolver {
|
||||
|
||||
/**
|
||||
* The "good" (valid) data for testing purposes has to go somewhere, right?
|
||||
*/
|
||||
public static Person[] VALID_PERSONS = {
|
||||
new Person().setId(1L).setLastName("Adams").setFirstName("Jill"),
|
||||
new Person().setId(2L).setLastName("Baker").setFirstName("James"),
|
||||
new Person().setId(3L).setLastName("Carter").setFirstName("Samanta"),
|
||||
new Person().setId(4L).setLastName("Daniels").setFirstName("Joseph"),
|
||||
new Person().setId(5L).setLastName("English").setFirstName("Jane"),
|
||||
new Person().setId(6L).setLastName("Fontana").setFirstName("Enrique"),
|
||||
// TODO: ADD MORE DATA HERE
|
||||
};
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
Object ret = null;
|
||||
//
|
||||
// Return a random, valid Person object if Person.class is the type of Parameter
|
||||
/// to be resolved. Otherwise return null.
|
||||
if (parameterContext.getParameter().getType() == Person.class) {
|
||||
ret = VALID_PERSONS[new Random().nextInt(VALID_PERSONS.length)];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
boolean ret = false;
|
||||
//
|
||||
// If the Parameter.type == Person.class, then we support it, otherwise, get outta here!
|
||||
if (parameterContext.getParameter().getType() == Person.class) {
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,8 @@
|
||||
- [Introduction to Neuroph](http://www.baeldung.com/intro-to-neuroph)
|
||||
- [Guide to Apache Commons CircularFifoQueue](http://www.baeldung.com/commons-circular-fifo-queue)
|
||||
- [Quick Guide to RSS with Rome](http://www.baeldung.com/rome-rss)
|
||||
- [Introduction to NoException](http://www.baeldung.com/intrduction-to-noexception)
|
||||
|
||||
|
||||
The libraries module contains examples related to small libraries that are relatively easy to use and does not require any separate module of its own.
|
||||
|
||||
|
||||
@@ -462,6 +462,11 @@
|
||||
<artifactId>pcollections</artifactId>
|
||||
<version>${pcollections.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.machinezoo.noexception</groupId>
|
||||
<artifactId>noexception</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.collections</groupId>
|
||||
<artifactId>eclipse-collections</artifactId>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.baeldung.noexception;
|
||||
|
||||
import com.machinezoo.noexception.ExceptionHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CustomExceptionHandler extends ExceptionHandler {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(CustomExceptionHandler.class);
|
||||
|
||||
@Override
|
||||
public boolean handle(Throwable throwable) {
|
||||
|
||||
if (throwable.getClass()
|
||||
.isAssignableFrom(RuntimeException.class)
|
||||
|| throwable.getClass()
|
||||
.isAssignableFrom(Error.class)) {
|
||||
return false;
|
||||
} else {
|
||||
logger.error("Caught Exception ", throwable);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.baeldung.eclipsecollections;
|
||||
|
||||
import org.eclipse.collections.api.block.procedure.Procedure;
|
||||
import org.eclipse.collections.api.tuple.Pair;
|
||||
import org.eclipse.collections.impl.map.mutable.UnifiedMap;
|
||||
import org.eclipse.collections.impl.tuple.Tuples;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ForEachPatternTest {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void whenInstantiateAndChangeValues_thenCorrect() {
|
||||
Pair<Integer, String> pair1 = Tuples.pair(1, "One");
|
||||
Pair<Integer, String> pair2 = Tuples.pair(2, "Two");
|
||||
Pair<Integer, String> pair3 = Tuples.pair(3, "Three");
|
||||
|
||||
UnifiedMap<Integer, String> map = UnifiedMap.newMapWith(pair1, pair2, pair3);
|
||||
|
||||
for (int i = 0; i < map.size(); i++) {
|
||||
map.put(i + 1, "New Value");
|
||||
}
|
||||
|
||||
for (int i = 0; i < map.size(); i++) {
|
||||
assertEquals("New Value", map.get(i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.baeldung.eclipsecollections;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.collections.impl.factory.Lists;
|
||||
import org.junit.Test;
|
||||
|
||||
public class InjectIntoPatternTest {
|
||||
|
||||
@Test
|
||||
public void whenInjectInto_thenCorrect() {
|
||||
List<Integer> list = Lists.mutable.of(1, 2, 3, 4);
|
||||
int result = 5;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Integer v = list.get(i);
|
||||
result = result + v.intValue();
|
||||
}
|
||||
|
||||
assertEquals(15, result);
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,9 @@ public class HLLUnitTest {
|
||||
|
||||
//when
|
||||
LongStream.range(0, numberOfElements).forEach(element -> {
|
||||
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
|
||||
hll.addRaw(hashedValue);
|
||||
}
|
||||
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
|
||||
hll.addRaw(hashedValue);
|
||||
}
|
||||
);
|
||||
|
||||
//then
|
||||
@@ -44,15 +44,15 @@ public class HLLUnitTest {
|
||||
|
||||
//when
|
||||
LongStream.range(0, numberOfElements).forEach(element -> {
|
||||
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
|
||||
firstHll.addRaw(hashedValue);
|
||||
}
|
||||
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
|
||||
firstHll.addRaw(hashedValue);
|
||||
}
|
||||
);
|
||||
|
||||
LongStream.range(numberOfElements, numberOfElements * 2).forEach(element -> {
|
||||
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
|
||||
secondHLL.addRaw(hashedValue);
|
||||
}
|
||||
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
|
||||
secondHLL.addRaw(hashedValue);
|
||||
}
|
||||
);
|
||||
|
||||
//then
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
import io.specto.hoverfly.junit.core.SimulationSource;
|
||||
import io.specto.hoverfly.junit.rule.HoverflyRule;
|
||||
|
||||
public class HoverflyApiTest {
|
||||
public class HoverflyApiIntegrationTest {
|
||||
|
||||
private static final SimulationSource source = dsl(
|
||||
service("http://www.baeldung.com")
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.baeldung.noexception;
|
||||
|
||||
import com.machinezoo.noexception.Exceptions;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NoExceptionUnitTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(NoExceptionUnitTest.class);
|
||||
|
||||
@Test
|
||||
public void whenStdExceptionHandling_thenCatchAndLog() {
|
||||
try {
|
||||
System.out.println("Result is " + Integer.parseInt("foobar"));
|
||||
} catch (Throwable exception) {
|
||||
logger.error("Caught exception:", exception);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenDefaultNoException_thenCatchAndLog() {
|
||||
Exceptions.log().run(() -> System.out.println("Result is " + Integer.parseInt("foobar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenLogger_whenDefaultNoException_thenCatchAndLogWithClassName() {
|
||||
Exceptions.log(logger).run(() -> System.out.println("Result is " + Integer.parseInt("foobar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenLoggerAndMessage_whenDefaultNoException_thenCatchAndLogWithMessage() {
|
||||
Exceptions.log(logger, "Something went wrong:").run(() -> System.out.println("Result is " + Integer.parseInt("foobar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDefaultValue_whenDefaultNoException_thenCatchAndLogPrintDefault() {
|
||||
System.out.println("Result is " + Exceptions.log(logger, "Something went wrong:").get(() -> Integer.parseInt("foobar")).orElse(-1));
|
||||
}
|
||||
|
||||
@Test(expected = Error.class)
|
||||
public void givenCustomHandler_whenError_thenRethrowError() {
|
||||
CustomExceptionHandler customExceptionHandler = new CustomExceptionHandler();
|
||||
customExceptionHandler.run(() -> throwError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCustomHandler_whenException_thenCatchAndLog() {
|
||||
CustomExceptionHandler customExceptionHandler = new CustomExceptionHandler();
|
||||
customExceptionHandler.run(() -> throwException());
|
||||
}
|
||||
|
||||
private static void throwError() {
|
||||
throw new Error("This is very bad.");
|
||||
}
|
||||
|
||||
private static void throwException() {
|
||||
String testString = "foo";
|
||||
testString.charAt(5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.baeldung.pcollections;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.pcollections.*;
|
||||
import org.pcollections.HashPMap;
|
||||
import org.pcollections.HashTreePMap;
|
||||
import org.pcollections.HashTreePSet;
|
||||
import org.pcollections.MapPSet;
|
||||
import org.pcollections.PVector;
|
||||
import org.pcollections.TreePVector;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -27,7 +32,7 @@ public class PCollectionsUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenExistingHashMap_whenFrom_thenCreateHashPMap() {
|
||||
Map map = new HashMap();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("mkey1", "mval1");
|
||||
map.put("mkey2", "mval2");
|
||||
|
||||
@@ -41,7 +46,7 @@ public class PCollectionsUnitTest {
|
||||
HashPMap<String, String> pmap = HashTreePMap.empty();
|
||||
HashPMap<String, String> pmap0 = pmap.plus("key1", "value1");
|
||||
|
||||
Map map = new HashMap();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("key2", "val2");
|
||||
map.put("key3", "val3");
|
||||
|
||||
@@ -57,22 +62,24 @@ public class PCollectionsUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenTreePVectorMethods_thenPerformOperations() {
|
||||
TreePVector pVector = TreePVector.empty();
|
||||
TreePVector<String> pVector = TreePVector.empty();
|
||||
|
||||
TreePVector<String> pV1 = pVector.plus("e1");
|
||||
TreePVector<String> pV2 = pV1.plusAll(Arrays.asList("e2", "e3", "e4"));
|
||||
|
||||
TreePVector pV1 = pVector.plus("e1");
|
||||
TreePVector pV2 = pV1.plusAll(Arrays.asList("e2", "e3", "e4"));
|
||||
assertEquals(1, pV1.size());
|
||||
assertEquals(4, pV2.size());
|
||||
|
||||
TreePVector pV3 = pV2.minus("e1");
|
||||
TreePVector pV4 = pV3.minusAll(Arrays.asList("e2", "e3", "e4"));
|
||||
TreePVector<String> pV3 = pV2.minus("e1");
|
||||
TreePVector<String> pV4 = pV3.minusAll(Arrays.asList("e2", "e3", "e4"));
|
||||
|
||||
assertEquals(pV3.size(), 3);
|
||||
assertEquals(pV4.size(), 0);
|
||||
|
||||
TreePVector pSub = pV2.subList(0, 2);
|
||||
TreePVector<String> pSub = pV2.subList(0, 2);
|
||||
assertTrue(pSub.contains("e1") && pSub.contains("e2"));
|
||||
|
||||
TreePVector pVW = (TreePVector) pV2.with(0, "e10");
|
||||
PVector<String> pVW = pV2.with(0, "e10");
|
||||
assertEquals(pVW.get(0), "e10");
|
||||
}
|
||||
|
||||
@@ -80,7 +87,7 @@ public class PCollectionsUnitTest {
|
||||
public void whenMapPSetMethods_thenPerformOperations() {
|
||||
|
||||
MapPSet pSet = HashTreePSet.empty()
|
||||
.plusAll(Arrays.asList("e1","e2","e3","e4"));
|
||||
.plusAll(Arrays.asList("e1", "e2", "e3", "e4"));
|
||||
assertEquals(pSet.size(), 4);
|
||||
|
||||
MapPSet pSet1 = pSet.minus("e4");
|
||||
|
||||
@@ -27,9 +27,6 @@ import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class AtlasObserverLiveTest {
|
||||
|
||||
private final String atlasUri = "http://localhost:7101/api/v1";
|
||||
|
||||
+1
-4
@@ -22,10 +22,7 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class MetricAnnotationTest extends MetricTestBase {
|
||||
public class MetricAnnotationManualTest extends MetricTestBase {
|
||||
|
||||
@Monitor(name = "integerCounter", type = DataSourceType.COUNTER, description = "Total number of update operations.")
|
||||
private final AtomicInteger updateCount = new AtomicInteger(0);
|
||||
+7
-5
@@ -13,14 +13,16 @@ import java.util.List;
|
||||
|
||||
import static com.netflix.servo.annotations.DataSourceType.GAUGE;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.hamcrest.Matchers.hasProperty;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class MetricObserverTest extends MetricTestBase {
|
||||
public class MetricObserverManualTest extends MetricTestBase {
|
||||
|
||||
@Test
|
||||
public void givenMetrics_whenRegister_thenMonitored() throws InterruptedException {
|
||||
+9
-6
@@ -1,20 +1,23 @@
|
||||
package com.baeldung.metrics.servo;
|
||||
|
||||
import com.netflix.servo.Metric;
|
||||
import com.netflix.servo.publish.*;
|
||||
import com.netflix.servo.publish.BasicMetricFilter;
|
||||
import com.netflix.servo.publish.JvmMetricPoller;
|
||||
import com.netflix.servo.publish.MemoryMetricObserver;
|
||||
import com.netflix.servo.publish.PollRunnable;
|
||||
import com.netflix.servo.publish.PollScheduler;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public class MetricPollerTest {
|
||||
public class MetricPollerManualTest {
|
||||
|
||||
@Test
|
||||
public void givenJvmPoller_whenMonitor_thenDataCollected() throws Exception {
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.baeldung.metrics.servo;
|
||||
|
||||
import com.netflix.servo.publish.*;
|
||||
import com.netflix.servo.publish.BasicMetricFilter;
|
||||
import com.netflix.servo.publish.MemoryMetricObserver;
|
||||
import com.netflix.servo.publish.MetricFilter;
|
||||
import com.netflix.servo.publish.MonitorRegistryMetricPoller;
|
||||
import com.netflix.servo.publish.PollRunnable;
|
||||
import com.netflix.servo.publish.PollScheduler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
abstract class MetricTestBase {
|
||||
|
||||
MemoryMetricObserver observer;
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
package com.baeldung.metrics.servo;
|
||||
|
||||
import com.netflix.servo.monitor.*;
|
||||
import com.netflix.servo.monitor.BasicCounter;
|
||||
import com.netflix.servo.monitor.BasicGauge;
|
||||
import com.netflix.servo.monitor.BasicInformational;
|
||||
import com.netflix.servo.monitor.BasicTimer;
|
||||
import com.netflix.servo.monitor.BucketConfig;
|
||||
import com.netflix.servo.monitor.BucketTimer;
|
||||
import com.netflix.servo.monitor.Counter;
|
||||
import com.netflix.servo.monitor.Gauge;
|
||||
import com.netflix.servo.monitor.MaxGauge;
|
||||
import com.netflix.servo.monitor.Monitor;
|
||||
import com.netflix.servo.monitor.MonitorConfig;
|
||||
import com.netflix.servo.monitor.Monitors;
|
||||
import com.netflix.servo.monitor.PeakRateCounter;
|
||||
import com.netflix.servo.monitor.StatsTimer;
|
||||
import com.netflix.servo.monitor.StepCounter;
|
||||
import com.netflix.servo.monitor.Stopwatch;
|
||||
import com.netflix.servo.stats.StatsConfig;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -9,13 +24,12 @@ import java.util.Map;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.hasEntry;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class MetricTypeTest {
|
||||
|
||||
@Test
|
||||
@@ -113,7 +127,7 @@ public class MetricTypeTest {
|
||||
BucketTimer timer = new BucketTimer(MonitorConfig
|
||||
.builder("test")
|
||||
.build(), new BucketConfig.Builder()
|
||||
.withBuckets(new long[] { 2L, 5L })
|
||||
.withBuckets(new long[]{2L, 5L})
|
||||
.withTimeUnit(SECONDS)
|
||||
.build(), SECONDS);
|
||||
timer.record(3);
|
||||
@@ -150,7 +164,7 @@ public class MetricTypeTest {
|
||||
.builder("test")
|
||||
.build(), new StatsConfig.Builder()
|
||||
.withComputeFrequencyMillis(2000)
|
||||
.withPercentiles(new double[] { 99.0, 95.0, 90.0 })
|
||||
.withPercentiles(new double[]{99.0, 95.0, 90.0})
|
||||
.withPublishMax(true)
|
||||
.withPublishMin(true)
|
||||
.withPublishCount(true)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
### Relevant Articles:
|
||||
- [Introduction to NoException](http://www.baeldung.com/intrduction-to-noexception)
|
||||
@@ -0,0 +1,23 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>noexception</artifactId>
|
||||
<version>1.0</version>
|
||||
<name>noexception</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.machinezoo.noexception</groupId>
|
||||
<artifactId>noexception</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.baeldung.noexception;
|
||||
|
||||
import com.machinezoo.noexception.ExceptionHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CustomExceptionHandler extends ExceptionHandler {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(CustomExceptionHandler.class);
|
||||
|
||||
@Override
|
||||
public boolean handle(Throwable throwable) {
|
||||
|
||||
if (throwable.getClass()
|
||||
.isAssignableFrom(RuntimeException.class)
|
||||
|| throwable.getClass()
|
||||
.isAssignableFrom(Error.class)) {
|
||||
return false;
|
||||
} else {
|
||||
logger.error("Caught Exception ", throwable);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.baeldung.noexception;
|
||||
|
||||
import com.machinezoo.noexception.Exceptions;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NoExceptionUnitTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(NoExceptionUnitTest.class);
|
||||
|
||||
@Test
|
||||
public void whenStdExceptionHandling_thenCatchAndLog() {
|
||||
try {
|
||||
System.out.println("Result is " + Integer.parseInt("foobar"));
|
||||
} catch (Throwable exception) {
|
||||
logger.error("Caught exception:", exception);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenDefaultNoException_thenCatchAndLog() {
|
||||
|
||||
Exceptions.log().run(() -> System.out.println("Result is " + Integer.parseInt("foobar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenLogger_whenDefaultNoException_thenCatchAndLogWithClassName() {
|
||||
System.out.println("Result is " + Exceptions.log(logger).get(() -> +Integer.parseInt("foobar")).orElse(-1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenLoggerAndMessage_whenDefaultNoException_thenCatchAndLogWithClassNameAndMessage() {
|
||||
System.out.println("Result is " + Exceptions.log(logger, "Something went wrong:").get(() -> +Integer.parseInt("foobar")).orElse(-1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDefaultValue_whenDefaultNoException_thenCatchAndLogPrintDefault() {
|
||||
System.out.println("Result is " + Exceptions.log(logger, "Something went wrong:").get(() -> +Integer.parseInt("foobar")).orElse(-1));
|
||||
}
|
||||
|
||||
@Test(expected = Error.class)
|
||||
public void givenCustomHandler_whenError_thenRethrowError() {
|
||||
CustomExceptionHandler customExceptionHandler = new CustomExceptionHandler();
|
||||
customExceptionHandler.run(() -> throwError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCustomHandler_whenException_thenCatchAndLog() {
|
||||
CustomExceptionHandler customExceptionHandler = new CustomExceptionHandler();
|
||||
customExceptionHandler.run(() -> throwException());
|
||||
}
|
||||
|
||||
private static void throwError() {
|
||||
throw new Error("This is very bad.");
|
||||
}
|
||||
|
||||
private static void throwException() {
|
||||
String testString = "foo";
|
||||
testString.charAt(5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,6 +106,7 @@
|
||||
<module>mockito2</module>
|
||||
<module>mocks</module>
|
||||
<module>mustache</module>
|
||||
<module>noexception</module>
|
||||
|
||||
<module>orika</module>
|
||||
|
||||
|
||||
+10
-9
@@ -3,11 +3,12 @@ package com.example.activitiwithspring;
|
||||
import org.activiti.engine.ProcessEngine;
|
||||
import org.activiti.engine.ProcessEngineConfiguration;
|
||||
import org.activiti.engine.ProcessEngines;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ProcessEngineCreationTests {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class ProcessEngineCreationIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void givenXMLConfig_whenGetDefault_thenGotProcessEngine() {
|
||||
@@ -35,7 +36,7 @@ public class ProcessEngineCreationTests {
|
||||
@Test
|
||||
public void givenDifferentBeanNameInXMLConfig_whenGetProcessEngineConfig_thenGotResult() {
|
||||
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration
|
||||
.createProcessEngineConfigurationFromResource("my.activiti.cfg.xml", "myProcessEngineConfiguration");
|
||||
.createProcessEngineConfigurationFromResource("my.activiti.cfg.xml", "myProcessEngineConfiguration");
|
||||
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
|
||||
assertNotNull(processEngine);
|
||||
assertEquals("baeldung", processEngine.getProcessEngineConfiguration().getJdbcUsername());
|
||||
@@ -45,8 +46,8 @@ public class ProcessEngineCreationTests {
|
||||
public void givenNoXMLConfig_whenCreateInMemProcessEngineConfig_thenCreated() {
|
||||
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
|
||||
ProcessEngine processEngine = processEngineConfiguration
|
||||
.setJdbcUrl("jdbc:h2:mem:my-own-in-mem-db;DB_CLOSE_DELAY=1000")
|
||||
.buildProcessEngine();
|
||||
.setJdbcUrl("jdbc:h2:mem:my-own-in-mem-db;DB_CLOSE_DELAY=1000")
|
||||
.buildProcessEngine();
|
||||
assertNotNull(processEngine);
|
||||
assertEquals("sa", processEngine.getProcessEngineConfiguration().getJdbcUsername());
|
||||
}
|
||||
@@ -55,9 +56,9 @@ public class ProcessEngineCreationTests {
|
||||
public void givenNoXMLConfig_whenCreateProcessEngineConfig_thenCreated() {
|
||||
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
|
||||
ProcessEngine processEngine = processEngineConfiguration
|
||||
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
|
||||
.setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000")
|
||||
.buildProcessEngine();
|
||||
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
|
||||
.setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000")
|
||||
.buildProcessEngine();
|
||||
assertNotNull(processEngine);
|
||||
assertEquals("sa", processEngine.getProcessEngineConfiguration().getJdbcUsername());
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user