Skip to content

Commit 0abcb0f

Browse files
committed
---
yaml --- r: 4079 b: refs/heads/gcs-nio c: adf5c1c h: refs/heads/master i: 4077: afb5e4b 4075: abb4f71 4071: 62e17a9 4063: a785daa
1 parent fb1f5d1 commit 0abcb0f

3 files changed

Lines changed: 72 additions & 2 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ refs/tags/v0.0.12: 2fd8066e891fb3dfea69b65f6bf6461db79342b9
1111
refs/heads/compute-alpha: 969cba2627f1d53d352cc4a5ffe0879dacf65e6c
1212
refs/heads/dns-alpha: 2f90e7e338349287ace33375896907af0f032ca1
1313
refs/heads/dns-alpha-batch: 17442b07867021b85d0452f5f3eda29a3413288f
14-
refs/heads/gcs-nio: e17bedb4640e6d5c434670eb03a4ea6b2f9028c9
14+
refs/heads/gcs-nio: adf5c1cda7b849d7e1064dba7dae24e1fea5061d
1515
refs/heads/logging-alpha: db5312bffa7fccac194f6a7feb8cc3066de16aff
1616
refs/tags/v0.1.0: a615317f7424ed58621b1f65d5c4d8cbbe8a6ed8
1717
refs/tags/v0.1.1: 7a7f6985fe465e9dd6a075af55493f42b4933be0

branches/gcs-nio/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ enum SortingOrder {
193193
DESCENDING, ASCENDING;
194194

195195
public String selector() {
196-
return this.name().toLowerCase();
196+
return name().toLowerCase();
197197
}
198198
}
199199

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.gcloud.dns;
18+
19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotEquals;
21+
import static org.junit.Assert.fail;
22+
23+
import com.google.gcloud.spi.DnsRpc;
24+
25+
import org.junit.Test;
26+
27+
public class AbstractOptionTest {
28+
29+
private static final DnsRpc.Option RPC_OPTION = DnsRpc.Option.DNS_TYPE;
30+
private static final DnsRpc.Option ANOTHER_RPC_OPTION = DnsRpc.Option.DNS_NAME;
31+
private static final String VALUE = "some value";
32+
private static final String OTHER_VALUE = "another value";
33+
private static final AbstractOption OPTION = new AbstractOption(RPC_OPTION, VALUE) {
34+
};
35+
private static final AbstractOption OPTION_EQUALS = new AbstractOption(RPC_OPTION, VALUE) {
36+
};
37+
private static final AbstractOption OPTION_NOT_EQUALS1 =
38+
new AbstractOption(RPC_OPTION, OTHER_VALUE) {
39+
};
40+
private static final AbstractOption OPTION_NOT_EQUALS2 =
41+
new AbstractOption(ANOTHER_RPC_OPTION, VALUE) {
42+
};
43+
44+
@Test
45+
public void testEquals() {
46+
assertEquals(OPTION, OPTION_EQUALS);
47+
assertNotEquals(OPTION, OPTION_NOT_EQUALS1);
48+
assertNotEquals(OPTION, OPTION_NOT_EQUALS2);
49+
}
50+
51+
@Test
52+
public void testHashCode() {
53+
assertEquals(OPTION.hashCode(), OPTION_EQUALS.hashCode());
54+
}
55+
56+
@Test
57+
public void testConstructor() {
58+
assertEquals(RPC_OPTION, OPTION.rpcOption());
59+
assertEquals(VALUE, OPTION.value());
60+
try {
61+
new AbstractOption(null, VALUE) {
62+
};
63+
fail("Cannot build with empty option.");
64+
} catch (NullPointerException e) {
65+
// expected
66+
}
67+
new AbstractOption(RPC_OPTION, null) {
68+
}; // null value is ok
69+
}
70+
}

0 commit comments

Comments
 (0)