From 83f777939fac67f626b11c796aff2cefe05dca2e Mon Sep 17 00:00:00 2001 From: Alex Moore Date: Tue, 21 Feb 2017 14:18:17 -0500 Subject: [PATCH] Fix some whitespace, simplify some test code --- .../api/commands/buckets/ListBuckets.java | 4 ++-- .../riak/client/api/commands/kv/ListKeys.java | 4 ++-- .../api/commands/mapreduce/BucketMapReduce.java | 4 ++-- .../api/commands/timeseries/ListKeys.java | 4 ++-- .../api/commands/buckets/ListBucketsTest.java | 17 +++-------------- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/basho/riak/client/api/commands/buckets/ListBuckets.java b/src/main/java/com/basho/riak/client/api/commands/buckets/ListBuckets.java index 9ab34bc12..fb22ef7b3 100644 --- a/src/main/java/com/basho/riak/client/api/commands/buckets/ListBuckets.java +++ b/src/main/java/com/basho/riak/client/api/commands/buckets/ListBuckets.java @@ -74,7 +74,7 @@ public final class ListBuckets extends StreamableRiakCommand.StreamableRiakComma this.timeout = builder.timeout; this.type = builder.type; - if (builder.allowListing == false) + if (!builder.allowListing) { throw new ListException(); } @@ -196,7 +196,7 @@ public Builder(String type) *

* @return a reference to this object. */ - public Builder withAllowListing() + public Builder withAllowListing() { this.allowListing = true; return this; diff --git a/src/main/java/com/basho/riak/client/api/commands/kv/ListKeys.java b/src/main/java/com/basho/riak/client/api/commands/kv/ListKeys.java index b552131ee..5e01be6ed 100644 --- a/src/main/java/com/basho/riak/client/api/commands/kv/ListKeys.java +++ b/src/main/java/com/basho/riak/client/api/commands/kv/ListKeys.java @@ -84,7 +84,7 @@ public final class ListKeys extends StreamableRiakCommand.StreamableRiakCommandW this.namespace = builder.namespace; this.timeout = builder.timeout; - if (builder.allowListing == false) + if (!builder.allowListing) { throw new ListException(); } @@ -193,7 +193,7 @@ public Builder(Namespace namespace) *

* @return a reference to this object. */ - public Builder withAllowListing() + public Builder withAllowListing() { this.allowListing = true; return this; diff --git a/src/main/java/com/basho/riak/client/api/commands/mapreduce/BucketMapReduce.java b/src/main/java/com/basho/riak/client/api/commands/mapreduce/BucketMapReduce.java index 9f7b8927c..374cabb6d 100644 --- a/src/main/java/com/basho/riak/client/api/commands/mapreduce/BucketMapReduce.java +++ b/src/main/java/com/basho/riak/client/api/commands/mapreduce/BucketMapReduce.java @@ -18,7 +18,7 @@ protected BucketMapReduce(BucketInput input, Builder builder) throws ListExcepti { super(input, builder); - if (builder.allowListing == false) + if (!builder.allowListing) { throw new ListException(); } @@ -48,7 +48,7 @@ protected Builder self() *

* @return a reference to this object. */ - public Builder withAllowListing() + public Builder withAllowListing() { this.allowListing = true; return this; diff --git a/src/main/java/com/basho/riak/client/api/commands/timeseries/ListKeys.java b/src/main/java/com/basho/riak/client/api/commands/timeseries/ListKeys.java index 101de8a56..46098bba0 100644 --- a/src/main/java/com/basho/riak/client/api/commands/timeseries/ListKeys.java +++ b/src/main/java/com/basho/riak/client/api/commands/timeseries/ListKeys.java @@ -23,7 +23,7 @@ private ListKeys(ListKeys.Builder builder) throws ListException this.tableName = builder.tableName; this.timeout = builder.timeout; - if (builder.allowListing == false) + if (!builder.allowListing) { throw new ListException(); } @@ -69,7 +69,7 @@ public Builder(String tableName) *

* @return a reference to this object. */ - public Builder withAllowListing() + public Builder withAllowListing() { this.allowListing = true; return this; diff --git a/src/test/java/com/basho/riak/client/api/commands/buckets/ListBucketsTest.java b/src/test/java/com/basho/riak/client/api/commands/buckets/ListBucketsTest.java index 87b1c044a..d1635b1c9 100644 --- a/src/test/java/com/basho/riak/client/api/commands/buckets/ListBucketsTest.java +++ b/src/test/java/com/basho/riak/client/api/commands/buckets/ListBucketsTest.java @@ -71,22 +71,11 @@ private void testListBuckets(String bucketType) throws Exception Assert.assertEquals(ByteString.copyFrom(type.unsafeGetValue()), builder.getType()); } - @Test - public void listBucketsThrowsListException() + @Test(expected = ListException.class) + public void listBucketsThrowsListException() throws ListException { - boolean sawException = false; - ListBuckets.Builder b = new ListBuckets.Builder("bucket_type"); - try - { - b.build(); - } - catch (ListException ex) - { - sawException = true; - } - - Assert.assertTrue(sawException); + b.build(); } @Test