[FOray-commit] SF.net SVN: foray:[11928] trunk/foray/foray-common/src
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2021-10-23 18:23:05
|
Revision: 11928
http://sourceforge.net/p/foray/code/11928
Author: victormote
Date: 2021-10-23 18:23:02 +0000 (Sat, 23 Oct 2021)
Log Message:
-----------
1. Disable some unneeded methods. 2. Add missing test.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeMap.java
trunk/foray/foray-common/src/test/java/org/foray/common/data/TernaryTreeMapTests.java
trunk/foray/foray-common/src/test/java/org/foray/common/primitive/StringLatin1Tests.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeMap.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeMap.java 2021-10-23 17:55:41 UTC (rev 11927)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTreeMap.java 2021-10-23 18:23:02 UTC (rev 11928)
@@ -138,13 +138,14 @@
@Override
public V remove(final Object key) {
- /* TODO: Implement this. */
throw new UnsupportedOperationException("Operation not supported: remove");
}
@Override
public void putAll(final Map<? extends CharSequence, ? extends V> m) {
- /* TODO: Implement this. */
+ for (Map.Entry<? extends CharSequence, ? extends V> entry : m.entrySet()) {
+ this.put(entry.getKey(), entry.getValue());
+ }
}
@Override
@@ -154,8 +155,7 @@
@Override
public Set<CharSequence> keySet() {
- /* TODO: Implement this. */
- return Collections.emptySet();
+ throw new UnsupportedOperationException("Operation not supported: keySet");
}
@Override
@@ -165,8 +165,7 @@
@Override
public Set<Entry<CharSequence, V>> entrySet() {
- /* TODO: Implement this. */
- return Collections.emptySet();
+ throw new UnsupportedOperationException("Operation not supported: entrySet");
}
/**
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/data/TernaryTreeMapTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/data/TernaryTreeMapTests.java 2021-10-23 17:55:41 UTC (rev 11927)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/data/TernaryTreeMapTests.java 2021-10-23 18:23:02 UTC (rev 11928)
@@ -30,10 +30,11 @@
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
/**
* Tests of {@link TernaryTreeMap}.
@@ -113,9 +114,13 @@
* Test method for {@link org.foray.common.data.TernaryTreeMap#remove(java.lang.Object)}.
*/
@Test
- @Ignore
public void testRemove() {
- Assert.fail("Not yet implemented");
+ try {
+ this.out.remove("Key 1");
+ Assert.fail("Expected an UnsupportedOperationException.");
+ } catch (final UnsupportedOperationException e) {
+ /* This is the expected path. */
+ }
}
/**
@@ -122,9 +127,15 @@
* Test method for {@link org.foray.common.data.TernaryTreeMap#putAll(java.util.Map)}.
*/
@Test
- @Ignore
public void testPutAll() {
- Assert.fail("Not yet implemented");
+ final Map<CharSequence, String> otherMap = new HashMap<CharSequence, String>();
+ otherMap.put("Key 100", "Value 100");
+ otherMap.put("Key 2001", "Value 2001");
+ this.out.putAll(otherMap);
+ Assert.assertEquals(7, out.size());
+ Assert.assertEquals("Value 2", out.get("Key 2"));
+ Assert.assertEquals("Value 100", out.get("Key 100"));
+ Assert.assertEquals("Value 2001", out.get("Key 2001"));
}
/**
@@ -142,9 +153,13 @@
* Test method for {@link org.foray.common.data.TernaryTreeMap#keySet()}.
*/
@Test
- @Ignore
public void testKeySet() {
- Assert.fail("Not yet implemented");
+ try {
+ this.out.keySet();
+ Assert.fail("Expected an UnsupportedOperationException.");
+ } catch (final UnsupportedOperationException e) {
+ /* This is the expected path. */
+ }
}
/**
@@ -162,9 +177,13 @@
* Test method for {@link org.foray.common.data.TernaryTreeMap#entrySet()}.
*/
@Test
- @Ignore
public void testEntrySet() {
- Assert.fail("Not yet implemented");
+ try {
+ this.out.entrySet();
+ Assert.fail("Expected an UnsupportedOperationException.");
+ } catch (final UnsupportedOperationException e) {
+ /* This is the expected path. */
+ }
}
}
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/primitive/StringLatin1Tests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/primitive/StringLatin1Tests.java 2021-10-23 17:55:41 UTC (rev 11927)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/primitive/StringLatin1Tests.java 2021-10-23 18:23:02 UTC (rev 11928)
@@ -29,7 +29,6 @@
package org.foray.common.primitive;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -41,7 +40,6 @@
* Test of storing and retrieving a Latin-1 string.
*/
@Test
- @Ignore
/* @TODO: This test fails in Java 8, probably because of the new String features, which I think store the
"testString" internally as bytes instead of chars. */
public void test01() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|