Skip to content

Commit f972513

Browse files
java8features - new java 8 features
1 parent 9b04dff commit f972513

13 files changed

Lines changed: 325 additions & 244 deletions

core-java-8/src/main/java/com/baeldung/java_8_features/Address.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.baeldung.java_8_features;
22

3-
/**
4-
* Created by Alex Vengr
5-
*/
63
public class Address {
74

85
private String street;
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
package com.baeldung.java_8_features;
22

3-
/**
4-
* Created by Alex Vengr
5-
*/
63
public class CustomException extends RuntimeException {
74
}

core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import java.util.Arrays;
44
import java.util.List;
55

6-
/**
7-
* Created by Alex Vengrov
8-
*/
96
public class Detail {
107

118
private static final List<String> PARTS = Arrays.asList("turbine", "pump");

core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
import java.util.Optional;
44

5-
/**
6-
* Created by Alex Vengrov
7-
*/
85
public class OptionalAddress {
96

107
private String street;

core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
import java.util.Optional;
44

5-
/**
6-
* Created by Alex Vengrov
7-
*/
85
public class OptionalUser {
96

107
private OptionalAddress address;

core-java-8/src/main/java/com/baeldung/java_8_features/User.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
import java.util.Optional;
44

5-
/**
6-
* Created by Alex Vengrov
7-
*/
85
public class User {
96

107
private String name;

core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.baeldung.java_8_features;
22

3-
/**
4-
* Created by Alex Vengrov
5-
*/
63
public interface Vehicle {
74

85
void moveTo(long altitude, long longitude);

core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.baeldung.java_8_features;
22

3-
/**
4-
* Created by 1 on 15.05.2016.
5-
*/
63
public class VehicleImpl implements Vehicle {
74

85
@Override
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.baeldung.java8;
2+
3+
import com.baeldung.java_8_features.Vehicle;
4+
import com.baeldung.java_8_features.VehicleImpl;
5+
import org.junit.Test;
6+
7+
import static org.junit.Assert.assertEquals;
8+
9+
public class Java8DefaultStaticIntefaceMethodsTest {
10+
11+
@Test
12+
public void callStaticInterfaceMethdosMethods_whenExpectedResults_thenCorrect() {
13+
Vehicle vehicle = new VehicleImpl();
14+
String overview = vehicle.getOverview();
15+
long[] startPosition = vehicle.startPosition();
16+
17+
assertEquals(overview, "ATV made by N&F Vehicles");
18+
assertEquals(startPosition[0], 23);
19+
assertEquals(startPosition[1], 15);
20+
}
21+
22+
@Test
23+
public void callDefaultInterfaceMethods_whenExpectedResults_thenCorrect() {
24+
String producer = Vehicle.producer();
25+
assertEquals(producer, "N&F Vehicles");
26+
}
27+
}

core-java-8/src/test/java/com/baeldung/java8/Java8Features.java

Lines changed: 0 additions & 220 deletions
This file was deleted.

0 commit comments

Comments
 (0)