You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2023/03/28 07:37:26 UTC
[causeway] branch master updated: CAUSEWAY-3129: [RO] purge obsolete utils
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new 91684fc36c CAUSEWAY-3129: [RO] purge obsolete utils
91684fc36c is described below
commit 91684fc36cdcc31826a21850f9f0a569d523faaa
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Mar 28 09:37:21 2023 +0200
CAUSEWAY-3129: [RO] purge obsolete utils
---
.../restfulobjects/rendering/util/ListUtils.java | 38 ----------------
.../restfulobjects/rendering/util/MapUtils.java | 48 --------------------
.../rendering/util/MapUtilsTest.java | 52 ----------------------
3 files changed, 138 deletions(-)
diff --git a/viewers/restfulobjects/rendering/src/main/java/org/apache/causeway/viewer/restfulobjects/rendering/util/ListUtils.java b/viewers/restfulobjects/rendering/src/main/java/org/apache/causeway/viewer/restfulobjects/rendering/util/ListUtils.java
deleted file mode 100644
index 850b3a3bf4..0000000000
--- a/viewers/restfulobjects/rendering/src/main/java/org/apache/causeway/viewer/restfulobjects/rendering/util/ListUtils.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.causeway.viewer.restfulobjects.rendering.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public final class ListUtils {
-
- private ListUtils() {
- }
-
- @SuppressWarnings("unchecked")
- public static <T> List<T> toList(final Object[] objects) {
- final List<T> list = new ArrayList<T>();
- for (final Object o : objects) {
- list.add((T) o);
- }
- return list;
- }
-
-}
diff --git a/viewers/restfulobjects/rendering/src/main/java/org/apache/causeway/viewer/restfulobjects/rendering/util/MapUtils.java b/viewers/restfulobjects/rendering/src/main/java/org/apache/causeway/viewer/restfulobjects/rendering/util/MapUtils.java
deleted file mode 100644
index 28a4b51f00..0000000000
--- a/viewers/restfulobjects/rendering/src/main/java/org/apache/causeway/viewer/restfulobjects/rendering/util/MapUtils.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.causeway.viewer.restfulobjects.rendering.util;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.causeway.commons.internal.collections._Maps;
-
-public final class MapUtils {
-
- /**
- * Returns an immutable map based on a list of key/value pairs.
- */
- public static Map<String, String> mapOf(final String... keyOrValues) {
- if (keyOrValues.length % 2 != 0) {
- throw new IllegalArgumentException("Must provide an even number of arguments");
- }
- final Map<String, String> map = _Maps.newLinkedHashMap();
- String key = null;
- for (final String keyOrValue : keyOrValues) {
- if (key != null) {
- map.put(key, keyOrValue);
- key = null;
- } else {
- key = keyOrValue;
- }
- }
- return Collections.unmodifiableMap(map);
- }
-
-}
diff --git a/viewers/restfulobjects/rendering/src/test/java/org/apache/causeway/viewer/restfulobjects/rendering/util/MapUtilsTest.java b/viewers/restfulobjects/rendering/src/test/java/org/apache/causeway/viewer/restfulobjects/rendering/util/MapUtilsTest.java
deleted file mode 100644
index 5fad0c5a2e..0000000000
--- a/viewers/restfulobjects/rendering/src/test/java/org/apache/causeway/viewer/restfulobjects/rendering/util/MapUtilsTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.causeway.viewer.restfulobjects.rendering.util;
-
-import java.util.Map;
-
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-class MapUtilsTest {
-
- @Test
- public void happyCase() throws Exception {
- final Map<String, String> map = MapUtils.mapOf("foo", "bar", "foz", "boz");
- assertThat(map.get("foo"), is("bar"));
- assertThat(map.get("foz"), is("boz"));
- assertThat(map.size(), is(2));
- }
-
- @Test
- public void emptyList() throws Exception {
- final Map<String, String> map = MapUtils.mapOf();
- assertThat(map.size(), is(0));
- }
-
- @Test
- public void uneven() throws Exception {
- assertThrows(IllegalArgumentException.class, ()->{
- MapUtils.mapOf("foo");
- });
- }
-
-}