You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2014/10/07 22:37:52 UTC
git commit: More unit tests for util classes
Repository: qpid-jms
Updated Branches:
refs/heads/master 6ed98ed91 -> e5fbb3b27
More unit tests for util classes
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/e5fbb3b2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/e5fbb3b2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/e5fbb3b2
Branch: refs/heads/master
Commit: e5fbb3b27dd685af1b42bb21214092e45220cb34
Parents: 6ed98ed
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Oct 7 16:37:43 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Oct 7 16:37:43 2014 -0400
----------------------------------------------------------------------
.../qpid/jms/util/IOExceptionSupportTest.java | 60 ++++++++++++++++++++
.../org/apache/qpid/jms/util/LRUCacheTest.java | 8 +++
2 files changed, 68 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e5fbb3b2/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/IOExceptionSupportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/IOExceptionSupportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/IOExceptionSupportTest.java
new file mode 100644
index 0000000..1bf6b08
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/IOExceptionSupportTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.qpid.jms.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class IOExceptionSupportTest {
+
+ @Test
+ public void test() {
+ new IOExceptionSupport();
+ }
+
+ @Test
+ public void testPassthrough() {
+ IOException cause = new IOException();
+ assertSame(cause, IOExceptionSupport.create(cause));
+ }
+
+ @Test
+ public void testCreateWithMessage() {
+ IOException ex = IOExceptionSupport.create(new RuntimeException("error"));
+ assertEquals("error", ex.getMessage());
+ }
+
+ @Test
+ public void testCreateWithoutMessage() {
+ IOException ex = IOExceptionSupport.create(new RuntimeException());
+ assertNotNull(ex.getMessage());
+ }
+
+ @Test
+ public void testCreateWithEmptyMessage() {
+ IOException ex = IOExceptionSupport.create(new RuntimeException(""));
+ assertNotNull(ex.getMessage());
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e5fbb3b2/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/LRUCacheTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/LRUCacheTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/LRUCacheTest.java
index ce3b08e..43fd146 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/LRUCacheTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/LRUCacheTest.java
@@ -32,6 +32,14 @@ public class LRUCacheTest {
protected static final Logger LOG = LoggerFactory.getLogger(LRUCacheTest.class);
@Test
+ public void testLRUCache() {
+ LRUCache<Long, Long> underTest = new LRUCache<Long, Long>();
+ assertEquals(10000, underTest.getMaxCacheSize());
+ underTest.setMaxCacheSize(1000);
+ assertEquals(1000, underTest.getMaxCacheSize());
+ }
+
+ @Test
public void testResize() throws Exception {
LRUCache<Long, Long> underTest = new LRUCache<Long, Long>(1000);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org