Skip to content

Commit 8ce7e1f

Browse files
author
eugenp
committed
formatting work
1 parent 455df4e commit 8ce7e1f

13 files changed

Lines changed: 106 additions & 144 deletions

File tree

‎core-java/src/main/java/com/baeldung/java/networking/udp/EchoClient.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public EchoClient() {
2424
public String sendEcho(String msg) {
2525
DatagramPacket packet = null;
2626
try {
27-
buf=msg.getBytes();
27+
buf = msg.getBytes();
2828
packet = new DatagramPacket(buf, buf.length, address, 4445);
2929
socket.send(packet);
3030
packet = new DatagramPacket(buf, buf.length);

‎core-java/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import org.junit.Test;
99

1010
public class UseLocalDateTimeUnitTest {
11-
11+
1212
UseLocalDateTime useLocalDateTime = new UseLocalDateTime();
13-
13+
1414
@Test
15-
public void givenString_whenUsingParse_thenLocalDateTime(){
16-
Assert.assertEquals(LocalDate.of(2016, Month.MAY, 10),useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalDate());
17-
Assert.assertEquals(LocalTime.of(6,30),useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalTime());
15+
public void givenString_whenUsingParse_thenLocalDateTime() {
16+
Assert.assertEquals(LocalDate.of(2016, Month.MAY, 10), useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalDate());
17+
Assert.assertEquals(LocalTime.of(6, 30), useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalTime());
1818
}
1919
}

‎core-java/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,47 @@
88
import org.junit.Test;
99

1010
public class UseLocalDateUnitTest {
11-
11+
1212
UseLocalDate useLocalDate = new UseLocalDate();
13-
13+
1414
@Test
15-
public void givenValues_whenUsingFactoryOf_thenLocalDate(){
16-
Assert.assertEquals("2016-05-10",useLocalDate.getLocalDateUsingFactoryOfMethod(2016,5,10).toString());
15+
public void givenValues_whenUsingFactoryOf_thenLocalDate() {
16+
Assert.assertEquals("2016-05-10", useLocalDate.getLocalDateUsingFactoryOfMethod(2016, 5, 10).toString());
1717
}
18-
18+
1919
@Test
20-
public void givenString_whenUsingParse_thenLocalDate(){
21-
Assert.assertEquals("2016-05-10",useLocalDate.getLocalDateUsingParseMethod("2016-05-10").toString());
20+
public void givenString_whenUsingParse_thenLocalDate() {
21+
Assert.assertEquals("2016-05-10", useLocalDate.getLocalDateUsingParseMethod("2016-05-10").toString());
2222
}
23-
23+
2424
@Test
25-
public void whenUsingClock_thenLocalDate(){
26-
Assert.assertEquals(LocalDate.now(),useLocalDate.getLocalDateFromClock());
25+
public void whenUsingClock_thenLocalDate() {
26+
Assert.assertEquals(LocalDate.now(), useLocalDate.getLocalDateFromClock());
2727
}
28-
28+
2929
@Test
30-
public void givenDate_whenUsingPlus_thenNextDay(){
31-
Assert.assertEquals(LocalDate.now().plusDays(1),useLocalDate.getNextDay(LocalDate.now()));
30+
public void givenDate_whenUsingPlus_thenNextDay() {
31+
Assert.assertEquals(LocalDate.now().plusDays(1), useLocalDate.getNextDay(LocalDate.now()));
3232
}
33-
33+
3434
@Test
35-
public void givenDate_whenUsingMinus_thenPreviousDay(){
36-
Assert.assertEquals(LocalDate.now().minusDays(1),useLocalDate.getPreviousDay(LocalDate.now()));
35+
public void givenDate_whenUsingMinus_thenPreviousDay() {
36+
Assert.assertEquals(LocalDate.now().minusDays(1), useLocalDate.getPreviousDay(LocalDate.now()));
3737
}
38-
38+
3939
@Test
40-
public void givenToday_whenUsingGetDayOfWeek_thenDayOfWeek(){
41-
Assert.assertEquals(DayOfWeek.SUNDAY,useLocalDate.getDayOfWeek(LocalDate.parse("2016-05-22")));
40+
public void givenToday_whenUsingGetDayOfWeek_thenDayOfWeek() {
41+
Assert.assertEquals(DayOfWeek.SUNDAY, useLocalDate.getDayOfWeek(LocalDate.parse("2016-05-22")));
4242
}
43-
43+
4444
@Test
45-
public void givenToday_whenUsingWithTemporalAdjuster_thenFirstDayOfMonth(){
46-
Assert.assertEquals(1,useLocalDate.getFirstDayOfMonth().getDayOfMonth());
45+
public void givenToday_whenUsingWithTemporalAdjuster_thenFirstDayOfMonth() {
46+
Assert.assertEquals(1, useLocalDate.getFirstDayOfMonth().getDayOfMonth());
4747
}
48-
48+
4949
@Test
50-
public void givenLocalDate_whenUsingAtStartOfDay_thenReturnMidnight(){
51-
Assert.assertEquals(LocalDateTime.parse("2016-05-22T00:00:00"),useLocalDate.getStartOfDay(LocalDate.parse("2016-05-22")));
50+
public void givenLocalDate_whenUsingAtStartOfDay_thenReturnMidnight() {
51+
Assert.assertEquals(LocalDateTime.parse("2016-05-22T00:00:00"), useLocalDate.getStartOfDay(LocalDate.parse("2016-05-22")));
5252
}
5353

5454
}

‎core-java/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
import org.junit.Test;
77

88
public class UseLocalTimeUnitTest {
9-
9+
1010
UseLocalTime useLocalTime = new UseLocalTime();
11-
11+
1212
@Test
13-
public void givenValues_whenUsingFactoryOf_thenLocalTime(){
14-
Assert.assertEquals("07:07:07",useLocalTime.getLocalTimeUsingFactoryOfMethod(7,7,7).toString());
13+
public void givenValues_whenUsingFactoryOf_thenLocalTime() {
14+
Assert.assertEquals("07:07:07", useLocalTime.getLocalTimeUsingFactoryOfMethod(7, 7, 7).toString());
1515
}
16-
16+
1717
@Test
18-
public void givenString_whenUsingParse_thenLocalTime(){
19-
Assert.assertEquals("06:30",useLocalTime.getLocalTimeUsingParseMethod("06:30").toString());
18+
public void givenString_whenUsingParse_thenLocalTime() {
19+
Assert.assertEquals("06:30", useLocalTime.getLocalTimeUsingParseMethod("06:30").toString());
2020
}
21-
21+
2222
@Test
23-
public void givenTime_whenAddHour_thenLocalTime(){
24-
Assert.assertEquals("07:30",useLocalTime.addAnHour(LocalTime.of(6,30)).toString());
23+
public void givenTime_whenAddHour_thenLocalTime() {
24+
Assert.assertEquals("07:30", useLocalTime.addAnHour(LocalTime.of(6, 30)).toString());
2525
}
26-
26+
2727
@Test
28-
public void getHourFromLocalTime(){
29-
Assert.assertEquals(1, useLocalTime.getHourFromLocalTime(LocalTime.of(1,1)));
28+
public void getHourFromLocalTime() {
29+
Assert.assertEquals(1, useLocalTime.getHourFromLocalTime(LocalTime.of(1, 1)));
3030
}
31-
31+
3232
@Test
33-
public void getLocalTimeWithMinuteSetToValue(){
34-
Assert.assertEquals(LocalTime.of(10, 20), useLocalTime.getLocalTimeWithMinuteSetToValue(LocalTime.of(10,10), 20));
33+
public void getLocalTimeWithMinuteSetToValue() {
34+
Assert.assertEquals(LocalTime.of(10, 20), useLocalTime.getLocalTimeWithMinuteSetToValue(LocalTime.of(10, 10), 20));
3535
}
3636
}

‎core-java/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
import org.junit.Test;
88

99
public class UsePeriodUnitTest {
10-
UsePeriod usingPeriod=new UsePeriod();
11-
10+
UsePeriod usingPeriod = new UsePeriod();
11+
1212
@Test
13-
public void givenPeriodAndLocalDate_thenCalculateModifiedDate(){
13+
public void givenPeriodAndLocalDate_thenCalculateModifiedDate() {
1414
Period period = Period.ofDays(1);
1515
LocalDate localDate = LocalDate.parse("2007-05-10");
16-
Assert.assertEquals(localDate.plusDays(1),usingPeriod.modifyDates(localDate, period));
16+
Assert.assertEquals(localDate.plusDays(1), usingPeriod.modifyDates(localDate, period));
1717
}
18-
18+
1919
@Test
20-
public void givenDates_thenGetPeriod(){
20+
public void givenDates_thenGetPeriod() {
2121
LocalDate localDate1 = LocalDate.parse("2007-05-10");
2222
LocalDate localDate2 = LocalDate.parse("2007-05-15");
23-
23+
2424
Assert.assertEquals(Period.ofDays(5), usingPeriod.getDifferenceBetweenDates(localDate1, localDate2));
2525
}
2626
}

‎core-java/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import org.junit.Test;
99

1010
public class UseZonedDateTimeUnitTest {
11-
12-
UseZonedDateTime zonedDateTime=new UseZonedDateTime();
13-
11+
12+
UseZonedDateTime zonedDateTime = new UseZonedDateTime();
13+
1414
@Test
15-
public void givenZoneId_thenZonedDateTime(){
16-
ZoneId zoneId=ZoneId.of("Europe/Paris");
17-
ZonedDateTime zonedDatetime=zonedDateTime.getZonedDateTime(LocalDateTime.parse("2016-05-20T06:30"), zoneId);
18-
Assert.assertEquals(zoneId,ZoneId.from(zonedDatetime));
15+
public void givenZoneId_thenZonedDateTime() {
16+
ZoneId zoneId = ZoneId.of("Europe/Paris");
17+
ZonedDateTime zonedDatetime = zonedDateTime.getZonedDateTime(LocalDateTime.parse("2016-05-20T06:30"), zoneId);
18+
Assert.assertEquals(zoneId, ZoneId.from(zonedDatetime));
1919
}
2020
}

‎core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ private String encodeValue(String value) {
3232
return encoded;
3333
}
3434

35-
3635
private String decode(String value) {
3736
String decoded = null;
3837
try {
@@ -59,9 +58,7 @@ public void givenRequestParam_whenUTF8Scheme_thenEncode() throws Exception {
5958
requestParams.put("key2", "value@!$2");
6059
requestParams.put("key3", "value%3");
6160

62-
String encodedURL = requestParams.keySet().stream()
63-
.map(key -> key + "=" + encodeValue(requestParams.get(key)))
64-
.collect(joining("&", "http://www.baeldung.com?", ""));
61+
String encodedURL = requestParams.keySet().stream().map(key -> key + "=" + encodeValue(requestParams.get(key))).collect(joining("&", "http://www.baeldung.com?", ""));
6562

6663
Assert.assertThat(testUrl, CoreMatchers.is(encodedURL));
6764
}
@@ -72,12 +69,9 @@ public void givenRequestParam_whenUTF8Scheme_thenDecodeRequestParams() throws Ex
7269

7370
String query = url.getQuery();
7471

75-
String decodedQuery = Arrays.stream(query.split("&"))
76-
.map(param -> param.split("=")[0] + "=" + decode(param.split("=")[1]))
77-
.collect(joining("&"));
72+
String decodedQuery = Arrays.stream(query.split("&")).map(param -> param.split("=")[0] + "=" + decode(param.split("=")[1])).collect(joining("&"));
7873

79-
Assert.assertEquals(
80-
"http://www.baeldung.com?key1=value 1&key2=value@!$2&key3=value%3", url.getProtocol() + "://" + url.getHost() + "?" + decodedQuery);
74+
Assert.assertEquals("http://www.baeldung.com?key1=value 1&key2=value@!$2&key3=value%3", url.getProtocol() + "://" + url.getHost() + "?" + decodedQuery);
8175
}
8276

8377
}

‎core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.baeldung.enums;
22

3-
43
import org.junit.Test;
54

65
import java.util.ArrayList;

‎core-java/src/test/java/com/baeldung/java/networking/udp/UDPIntegrationTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.baeldung.java.networking.udp;
22

3-
43
import org.junit.After;
54
import org.junit.Before;
65
import org.junit.Test;

0 commit comments

Comments
 (0)