From 4365c90adfbd2cae0ff0f99a5aab3c839da115b9 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 28 Apr 2022 19:52:11 -0400 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BB=8E=20List=20=E4=B8=AD=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ossez/list/RemoveFirstElementTest.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-collections-list/src/test/java/com/ossez/list/RemoveFirstElementTest.java b/core-java-modules/core-java-collections-list/src/test/java/com/ossez/list/RemoveFirstElementTest.java index 9d0d300f76..7b7df9c9d3 100644 --- a/core-java-modules/core-java-collections-list/src/test/java/com/ossez/list/RemoveFirstElementTest.java +++ b/core-java-modules/core-java-collections-list/src/test/java/com/ossez/list/RemoveFirstElementTest.java @@ -3,6 +3,8 @@ package com.ossez.list; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.LinkedList; @@ -11,12 +13,18 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; /** - * List Remove Tes + * Test for remove list * - * @author YuCheng Hu + *

https://www.ossez.com/t/java-list/13919

+ * + * @author YuCheng */ + @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RemoveFirstElementTest { + private final static Logger logger = LoggerFactory.getLogger(RemoveFirstElementTest.class); + + private ArrayList list = new ArrayList(); private LinkedList linkedList = new LinkedList<>(); @@ -41,6 +49,8 @@ public class RemoveFirstElementTest { */ @Test public void testGivenList_whenRemoveFirst_thenRemoved() { + logger.debug("Get Size of List - [{}]", list.size()); + list.remove(0); assertThat(list, hasSize(4)); From 2dd6fafe4236f50947f6b19bfe6bd7c8f7dd8c70 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 28 Apr 2022 19:52:48 -0400 Subject: [PATCH 2/6] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=90=8C=E6=97=B6=E4=BF=AE=E6=94=B9=E7=9B=B8=E5=AF=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core-java-modules/core-java-collections-list/pom.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core-java-modules/core-java-collections-list/pom.xml b/core-java-modules/core-java-collections-list/pom.xml index d62275ab6d..5fcd835634 100644 --- a/core-java-modules/core-java-collections-list/pom.xml +++ b/core-java-modules/core-java-collections-list/pom.xml @@ -1,10 +1,9 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 core-java-collections-list - 0.1.0-SNAPSHOT core-java-collections-list jar @@ -12,7 +11,7 @@ com.ossez.core-java-modules core-java-modules 0.0.2-SNAPSHOT - + ../pom.xml From 42bcecc3980cc28c0354755b9a1d3bcd8a0c7e0c Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 28 Apr 2022 19:53:16 -0400 Subject: [PATCH 3/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20https://www.ossez.com/?= =?UTF-8?q?t/java-list/13934=20=E7=9A=84=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core-java-modules/core-java-collections-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-collections-list/README.md b/core-java-modules/core-java-collections-list/README.md index cbc33ffe82..9f05e36108 100644 --- a/core-java-modules/core-java-collections-list/README.md +++ b/core-java-modules/core-java-collections-list/README.md @@ -3,7 +3,7 @@ This module contains articles about the Java List collection ### Relevant Articles: -- [Java – Get Random Item/Element From a List](http://www.baeldung.com/java-random-list-element) +- [Java 如何从一个 List 中随机获得元素](https://www.ossez.com/t/java-list/13934) - [Removing all nulls from a List in Java](http://www.baeldung.com/java-remove-nulls-from-list) - [Removing all duplicates from a List in Java](http://www.baeldung.com/java-remove-duplicates-from-list) - [How to TDD a List Implementation in Java](http://www.baeldung.com/java-test-driven-list) From 578cb41f6a3e02b8a388754f8c0824f8fad76fc6 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 28 Apr 2022 19:54:07 -0400 Subject: [PATCH 4/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20logger=20=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/resources/logback.xml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core-java-modules/core-java-collections-list/src/test/resources/logback.xml diff --git a/core-java-modules/core-java-collections-list/src/test/resources/logback.xml b/core-java-modules/core-java-collections-list/src/test/resources/logback.xml new file mode 100644 index 0000000000..05a8dbeeff --- /dev/null +++ b/core-java-modules/core-java-collections-list/src/test/resources/logback.xml @@ -0,0 +1,23 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n + + + + + + + + + + \ No newline at end of file From 9c0e483d357bb7ec911c910de51b73e9ee57c71f Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 28 Apr 2022 19:55:52 -0400 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20pom=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=98=A0=E5=B0=84=E5=85=B3?= =?UTF-8?q?=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core-java-modules/core-java-8/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-8/pom.xml b/core-java-modules/core-java-8/pom.xml index c5ffa6e8ec..bdbc3e2508 100644 --- a/core-java-modules/core-java-8/pom.xml +++ b/core-java-modules/core-java-8/pom.xml @@ -4,7 +4,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 core-java-8 - 0.1.0-SNAPSHOT core-java-8 jar From ee0490a1f76b2e96b3b5264135487a3ce692a6c3 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 28 Apr 2022 19:56:29 -0400 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ossez/internationalization/DateFormatUnitTest.java | 3 ++- .../src/test/java/com/ossez/util/CurrentDateTimeUnitTest.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core-java-modules/core-java-8/src/test/java/com/ossez/internationalization/DateFormatUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/ossez/internationalization/DateFormatUnitTest.java index 2e7a140f5a..3b3e327c54 100644 --- a/core-java-modules/core-java-8/src/test/java/com/ossez/internationalization/DateFormatUnitTest.java +++ b/core-java-modules/core-java-8/src/test/java/com/ossez/internationalization/DateFormatUnitTest.java @@ -11,9 +11,10 @@ import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; + public class DateFormatUnitTest { - @Test + @Tes t public void givenGregorianCalendar_whenLocaleSpecificDateInstance_givenLanguageSpecificMonths() { GregorianCalendar gregorianCalendar = new GregorianCalendar(2018, 1, 1, 10, 15, 20); Date date = gregorianCalendar.getTime(); diff --git a/core-java-modules/core-java-8/src/test/java/com/ossez/util/CurrentDateTimeUnitTest.java b/core-java-modules/core-java-8/src/test/java/com/ossez/util/CurrentDateTimeUnitTest.java index ce4e29aeb7..2a2b03b3ef 100644 --- a/core-java-modules/core-java-8/src/test/java/com/ossez/util/CurrentDateTimeUnitTest.java +++ b/core-java-modules/core-java-8/src/test/java/com/ossez/util/CurrentDateTimeUnitTest.java @@ -1,6 +1,6 @@ package com.ossez.util; -import static org.junit.Assert.assertEquals; +//import static org.junit.Assert.assertEquals; import java.time.Clock; import java.time.Instant; @@ -9,7 +9,7 @@ import java.time.LocalTime; import java.time.ZoneId; import java.time.temporal.ChronoField; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CurrentDateTimeUnitTest {