Merge branch 'master' of https://github.com/eugenp/tutorials into BAEL-15393
This commit is contained in:
commit
d4bd1335c7
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java8;
|
||||
package com.baeldung.java_8_features.groupingby;
|
||||
|
||||
import com.baeldung.java_8_features.groupingby.BlogPost;
|
||||
import com.baeldung.java_8_features.groupingby.BlogPostType;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jackson.test;
|
||||
package com.baeldung.jackson.ignore;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
@ -15,9 +15,9 @@ import com.baeldung.jackson.dtos.MyDtoIncludeNonDefault;
|
|||
import com.baeldung.jackson.dtos.MyDtoWithFilter;
|
||||
import com.baeldung.jackson.dtos.MyDtoWithSpecialField;
|
||||
import com.baeldung.jackson.dtos.MyMixInForIgnoreType;
|
||||
import com.baeldung.jackson.dtos.ignore.MyDtoIgnoreField;
|
||||
import com.baeldung.jackson.dtos.ignore.MyDtoIgnoreFieldByName;
|
||||
import com.baeldung.jackson.dtos.ignore.MyDtoIgnoreNull;
|
||||
import com.baeldung.jackson.ignore.dtos.MyDtoIgnoreField;
|
||||
import com.baeldung.jackson.ignore.dtos.MyDtoIgnoreFieldByName;
|
||||
import com.baeldung.jackson.ignore.dtos.MyDtoIgnoreNull;
|
||||
import com.baeldung.jackson.serialization.MyDtoNullKeySerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jackson.dtos.ignore;
|
||||
package com.baeldung.jackson.ignore.dtos;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jackson.dtos.ignore;
|
||||
package com.baeldung.jackson.ignore.dtos;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jackson.dtos.ignore;
|
||||
package com.baeldung.jackson.ignore.dtos;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java8;
|
||||
package com.baeldung.java8.streams;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java8;
|
||||
package com.baeldung.java8.streams;
|
||||
|
||||
import com.baeldung.stream.Product;
|
||||
import org.junit.Before;
|
|
@ -9,6 +9,11 @@
|
|||
<version>1.0-SNAPSHOT</version>
|
||||
<name>libraries-primitive</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/it.unimi.dsi/fastutil -->
|
||||
<dependency>
|
||||
|
@ -36,5 +41,18 @@
|
|||
<version>1.19</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Eclipse Collections -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.collections</groupId>
|
||||
<artifactId>eclipse-collections-api</artifactId>
|
||||
<version>10.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.collections</groupId>
|
||||
<artifactId>eclipse-collections</artifactId>
|
||||
<version>10.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,70 @@
|
|||
package com.baeldung;
|
||||
|
||||
import org.eclipse.collections.api.list.primitive.ImmutableIntList;
|
||||
import org.eclipse.collections.api.list.primitive.MutableLongList;
|
||||
import org.eclipse.collections.api.map.primitive.MutableIntIntMap;
|
||||
import org.eclipse.collections.api.set.primitive.MutableIntSet;
|
||||
import org.eclipse.collections.impl.factory.primitive.*;
|
||||
import org.eclipse.collections.impl.list.Interval;
|
||||
import org.eclipse.collections.impl.list.primitive.IntInterval;
|
||||
import org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.stream.DoubleStream;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
public class PrimitiveCollectionsUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenListOfLongHasOneTwoThree_thenSumIsSix() {
|
||||
MutableLongList longList = LongLists.mutable.of(1L, 2L, 3L);
|
||||
assertEquals(6, longList.sum());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenListOfIntHasOneTwoThree_thenMaxIsThree() {
|
||||
ImmutableIntList intList = IntLists.immutable.of(1, 2, 3);
|
||||
assertEquals(3, intList.max());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenConvertFromIterableToPrimitive_thenValuesAreEquals() {
|
||||
Iterable<Integer> iterable = Interval.oneTo(3);
|
||||
MutableIntSet intSet = IntSets.mutable.withAll(iterable);
|
||||
IntInterval intInterval = IntInterval.oneTo(3);
|
||||
assertEquals(intInterval.toSet(), intSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationsOnIntIntMap() {
|
||||
MutableIntIntMap map = new IntIntHashMap();
|
||||
assertEquals(5, map.addToValue(0, 5));
|
||||
assertEquals(5, map.get(0));
|
||||
assertEquals(3, map.getIfAbsentPut(1, 3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreateDoubleStream_thenAverageIsThree() {
|
||||
DoubleStream doubleStream = DoubleLists
|
||||
.mutable.with(1.0, 2.0, 3.0, 4.0, 5.0)
|
||||
.primitiveStream();
|
||||
assertEquals(3, doubleStream.average().getAsDouble(), 0.001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreateMapFromStream_thenValuesMustMatch() {
|
||||
Iterable<Integer> integers = Interval.oneTo(3);
|
||||
MutableIntIntMap map =
|
||||
IntIntMaps.mutable.from(
|
||||
integers,
|
||||
key -> key,
|
||||
value -> value * value);
|
||||
MutableIntIntMap expected = IntIntMaps.mutable.empty()
|
||||
.withKeyValue(1, 1)
|
||||
.withKeyValue(2, 4)
|
||||
.withKeyValue(3, 9);
|
||||
assertEquals(expected, map);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.springbootsecurity.basic_auth;
|
||||
package com.baeldung.springbootsecurity.autoconfig;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfi
|
|||
@SpringBootApplication(exclude = {
|
||||
SecurityAutoConfiguration.class
|
||||
// ,ManagementWebSecurityAutoConfiguration.class
|
||||
}, scanBasePackages = "com.baeldung.springbootsecurity.basic_auth")
|
||||
}, scanBasePackages = "com.baeldung.springbootsecurity.autoconfig")
|
||||
public class SpringBootSecurityApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringBootSecurityApplication.class, args);
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.springbootsecurity.basic_auth.config;
|
||||
package com.baeldung.springbootsecurity.autoconfig.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.springbootsecurity.basic_auth;
|
||||
package com.baeldung.springbootsecurity.autoconfig.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
@ -18,6 +18,8 @@ import org.springframework.boot.web.server.LocalServerPort;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.springbootsecurity.autoconfig.SpringBootSecurityApplication;
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = SpringBootSecurityApplication.class)
|
||||
public class BasicConfigurationIntegrationTest {
|
Loading…
Reference in New Issue