Skip to content

Commit 5f3defa

Browse files
committed
---
yaml --- r: 3541 b: refs/heads/pubsub-alpha c: adf5c1c h: refs/heads/master i: 3539: 2b6fe61
1 parent c6184bb commit 5f3defa

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 36a62ef856d199f8efd09501b5ba65c422c01f23
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 7406918e071dd2c5677a638ae2a06e7592b6542c
5-
refs/heads/pubsub-alpha: e17bedb4640e6d5c434670eb03a4ea6b2f9028c9
5+
refs/heads/pubsub-alpha: adf5c1cda7b849d7e1064dba7dae24e1fea5061d
66
refs/heads/update-datastore: 47aae517c2cb33f1dccd909adaced73ec9d0f4df
77
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
88
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd

branches/pubsub-alpha/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)