Skip to content

Commit 738deda

Browse files
committed
---
yaml --- r: 6809 b: refs/heads/tswast-patch-1 c: adf5c1c h: refs/heads/master i: 6807: 13cc542
1 parent 1772af5 commit 738deda

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
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: e17bedb4640e6d5c434670eb03a4ea6b2f9028c9
60+
refs/heads/tswast-patch-1: adf5c1cda7b849d7e1064dba7dae24e1fea5061d
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/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)