Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5DCF7200C8C for ; Tue, 6 Jun 2017 19:17:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5C3D7160BC6; Tue, 6 Jun 2017 17:17:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A32B5160BB7 for ; Tue, 6 Jun 2017 19:17:07 +0200 (CEST) Received: (qmail 41267 invoked by uid 500); 6 Jun 2017 17:17:06 -0000 Mailing-List: contact commits-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list commits@geode.apache.org Received: (qmail 41258 invoked by uid 99); 6 Jun 2017 17:17:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jun 2017 17:17:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A53CCDFF16; Tue, 6 Jun 2017 17:17:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dschneider@apache.org To: commits@geode.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: geode git commit: cleaned up unit test Date: Tue, 6 Jun 2017 17:17:06 +0000 (UTC) archived-at: Tue, 06 Jun 2017 17:17:08 -0000 Repository: geode Updated Branches: refs/heads/feature/GEODE-3027 01675fa29 -> 4a901bfcc cleaned up unit test Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/4a901bfc Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/4a901bfc Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/4a901bfc Branch: refs/heads/feature/GEODE-3027 Commit: 4a901bfcc9b1644d5bed02a329612b895188cdc3 Parents: 01675fa Author: Darrel Schneider Authored: Tue Jun 6 10:16:56 2017 -0700 Committer: Darrel Schneider Committed: Tue Jun 6 10:16:56 2017 -0700 ---------------------------------------------------------------------- .../StringPrefixPartitionResolverJUnitTest.java | 41 +++++++++----------- 1 file changed, 18 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/4a901bfc/geode-core/src/test/java/org/apache/geode/cache/StringPrefixPartitionResolverJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/cache/StringPrefixPartitionResolverJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/StringPrefixPartitionResolverJUnitTest.java index e311453..2b53315 100644 --- a/geode-core/src/test/java/org/apache/geode/cache/StringPrefixPartitionResolverJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/cache/StringPrefixPartitionResolverJUnitTest.java @@ -44,56 +44,51 @@ public class StringPrefixPartitionResolverJUnitTest { @Test public void testNonStringKey() { - @SuppressWarnings("unchecked") - EntryOperation eo = - new EntryOperationImpl(null, null, new Object(), null, null); + Object key = new Object(); StringPrefixPartitionResolver pr = new StringPrefixPartitionResolver(); - assertThatThrownBy(() -> pr.getRoutingObject(eo)).isInstanceOf(ClassCastException.class); + assertThatThrownBy(() -> pr.getRoutingObject(createEntryOperation(key))) + .isInstanceOf(ClassCastException.class); } @Test public void testNoDelimiterKey() { - @SuppressWarnings("unchecked") - EntryOperation eo = new EntryOperationImpl(null, null, "foobar", null, null); + String key = "foobar"; StringPrefixPartitionResolver pr = new StringPrefixPartitionResolver(); - assertThatThrownBy(() -> pr.getRoutingObject(eo)).isInstanceOf(IllegalArgumentException.class) + assertThatThrownBy(() -> pr.getRoutingObject(createEntryOperation(key))) + .isInstanceOf(IllegalArgumentException.class) .hasMessage("The key \"foobar\" does not contains the \"" + DELIMITER + "\" delimiter."); } @Test public void testEmptyPrefix() { - @SuppressWarnings("unchecked") - EntryOperation eo = - new EntryOperationImpl(null, null, DELIMITER + "foobar", null, null); + String key = DELIMITER + "foobar"; StringPrefixPartitionResolver pr = new StringPrefixPartitionResolver(); - assertEquals("", pr.getRoutingObject(eo)); + assertEquals("", pr.getRoutingObject(createEntryOperation(key))); } @Test public void testAllPrefix() { - @SuppressWarnings("unchecked") - EntryOperation eo = - new EntryOperationImpl(null, null, "foobar" + DELIMITER, null, null); + String key = "foobar" + DELIMITER; StringPrefixPartitionResolver pr = new StringPrefixPartitionResolver(); - assertEquals("foobar", pr.getRoutingObject(eo)); + assertEquals("foobar", pr.getRoutingObject(createEntryOperation(key))); } @Test public void testSimpleKey() { - @SuppressWarnings("unchecked") - EntryOperation eo = - new EntryOperationImpl(null, null, "1" + DELIMITER + "2", null, null); + String key = "1" + DELIMITER + "2"; StringPrefixPartitionResolver pr = new StringPrefixPartitionResolver(); - assertEquals("1", pr.getRoutingObject(eo)); + assertEquals("1", pr.getRoutingObject(createEntryOperation(key))); } @Test public void testMulitPrefix() { - @SuppressWarnings("unchecked") - EntryOperation eo = new EntryOperationImpl(null, null, - "one" + DELIMITER + "two" + DELIMITER + "three", null, null); + String key = "one" + DELIMITER + "two" + DELIMITER + "three"; StringPrefixPartitionResolver pr = new StringPrefixPartitionResolver(); - assertEquals("one", pr.getRoutingObject(eo)); + assertEquals("one", pr.getRoutingObject(createEntryOperation(key))); } + @SuppressWarnings("unchecked") + private EntryOperation createEntryOperation(Object key) { + return new EntryOperationImpl(null, null, key, null, null); + } }