[
https://issues.apache.org/jira/browse/COLLECTIONS-811?focusedWorklogId=764713&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-764713
]
ASF GitHub Bot logged work on COLLECTIONS-811:
----------------------------------------------
Author: ASF GitHub Bot
Created on: 01/May/22 00:22
Start Date: 01/May/22 00:22
Worklog Time Spent: 10m
Work Description: kinow commented on code in PR #301:
URL:
https://github.com/apache/commons-collections/pull/301#discussion_r862407940
##########
src/test/java/org/apache/commons/collections4/GuavaTestlibTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.collections4;
+
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.commons.collections4.map.HashedMap;
+import org.apache.commons.collections4.map.LRUMap;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.commons.collections4.map.ReferenceMap;
+
+import com.google.common.collect.testing.MapTestSuiteBuilder;
+import com.google.common.collect.testing.TestStringMapGenerator;
+import com.google.common.collect.testing.features.CollectionFeature;
+import com.google.common.collect.testing.features.CollectionSize;
+import com.google.common.collect.testing.features.MapFeature;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * This test uses Google's Guava Testlib testing libraries to validate the
+ * contract of collection classes in Commons Collections. This was introduced
+ * after COLLECTIONS-802, where the issue reported was found with Testlib,
+ * with thanks to Ben Manes.
+ *
+ * @since 4.5.0
+ * @see <a
href="https://github.com/google/guava/tree/master/guava-testlib">https://github.com/google/guava/tree/master/guava-testlib</a>
+ * @see <a
href="https://issues.apache.org/jira/browse/COLLECTIONS-802">https://issues.apache.org/jira/browse/COLLECTIONS-802</a>
+ */
+public final class GuavaTestlibTest extends TestCase {
+
+ public static Test suite() {
Review Comment:
Thanks @ben-manes !
I will leave the List, Set, etc., for follow-up issues. I had some 5 minutes
to test it, and managed to write some tests for Lists, but these tests found
issues in some of the Lists. I'd have to confirm if the features I selected are
actually pertinent to the List implementations I used, or if we have other bugs
:slightly_smiling_face:
So it's definitely useful, but I prefer to get this merged first for Maps,
and later add other Map, List, Set implementations too :+1:
Here's the diff of what I had FWIW, thanks!!!
Bruno
```diff
diff --git
a/src/test/java/org/apache/commons/collections4/GuavaTestlibTest.java
b/src/test/java/org/apache/commons/collections4/GuavaTestlibTest.java
index 88108c6a..7d068e17 100644
-
Issue Time Tracking
-------------------
Worklog Id: (was: 764713)
Time Spent: 1.5h (was: 1h 20m)
> Consider integration Guava testlib tests
> ----------------------------------------
>
> Key: COLLECTIONS-811
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-811
> Project: Commons Collections
> Issue Type: Test
> Affects Versions: 4.4
> Reporter: Bruno P. Kinoshita
> Assignee: Bruno P. Kinoshita
> Priority: Minor
> Fix For: 4.5
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> In COLLECTIONS-802 an issue reported was found with the help of Google Guava
> testlib tests.
> Maybe we could either have something similar (i.e. build ourselves?), use
> Google Guava's testlib, or find another similar solution. From what I
> understood, it uses a factory function to create an implementation of a
> collection interface (e.g. Map) and then runs a series of functional tests
> over the created object, failing tests if a contract is broken (e.g.
> iterating a map doesn't leave the next-object as null, as it was the case of
> the 802 issue).
--
This message was sent by Atlassian Jira
(v8.20.7#820007)