Skip to content

Commit 1b28f5f

Browse files
chore: run mvn lint on youtube samples
1 parent 1ed1107 commit 1b28f5f

File tree

2 files changed

+27
-42
lines changed

2 files changed

+27
-42
lines changed

samples/snippets/src/main/java/com/example/json/YouTubeSample.java

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.example.json;
1718

1819
import com.google.api.client.http.HttpResponse;
1920
import com.google.api.client.util.Key;
20-
2121
import java.io.IOException;
2222
import java.util.List;
2323
import java.util.Map;
@@ -27,8 +27,7 @@ public static class ListResponse {
2727
@Key("items")
2828
private List<SearchResult> searchResults;
2929

30-
@Key
31-
private PageInfo pageInfo;
30+
@Key private PageInfo pageInfo;
3231

3332
public List<SearchResult> getSearchResults() {
3433
return searchResults;
@@ -40,11 +39,9 @@ public PageInfo getPageInfo() {
4039
}
4140

4241
public static class PageInfo {
43-
@Key
44-
private long totalResults;
42+
@Key private long totalResults;
4543

46-
@Key
47-
private long resultsPerPage;
44+
@Key private long resultsPerPage;
4845

4946
public long getTotalResults() {
5047
return totalResults;
@@ -56,14 +53,12 @@ public long getResultsPerPage() {
5653
}
5754

5855
public static class SearchResult {
59-
@Key
60-
private String kind;
56+
@Key private String kind;
6157

6258
@Key("id")
6359
private VideoId videoId;
6460

65-
@Key
66-
private Snippet snippet;
61+
@Key private Snippet snippet;
6762

6863
public String getKind() {
6964
return kind;
@@ -79,11 +74,9 @@ public Snippet getSnippet() {
7974
}
8075

8176
public static class VideoId {
82-
@Key
83-
private String kind;
77+
@Key private String kind;
8478

85-
@Key
86-
private String videoId;
79+
@Key private String videoId;
8780

8881
public String getKind() {
8982
return kind;
@@ -95,20 +88,15 @@ public String getVideoId() {
9588
}
9689

9790
public static class Snippet {
98-
@Key
99-
private String publishedAt;
91+
@Key private String publishedAt;
10092

101-
@Key
102-
private String channelId;
93+
@Key private String channelId;
10394

104-
@Key
105-
private String title;
95+
@Key private String title;
10696

107-
@Key
108-
private String description;
97+
@Key private String description;
10998

110-
@Key
111-
private Map<String, Thumbnail> thumbnails;
99+
@Key private Map<String, Thumbnail> thumbnails;
112100

113101
public String getPublishedAt() {
114102
return publishedAt;
@@ -132,14 +120,11 @@ public Map<String, Thumbnail> getThumbnails() {
132120
}
133121

134122
public static class Thumbnail {
135-
@Key
136-
private String url;
123+
@Key private String url;
137124

138-
@Key
139-
private long width;
125+
@Key private long width;
140126

141-
@Key
142-
private long height;
127+
@Key private long height;
143128

144129
public String getUrl() {
145130
return url;
@@ -170,5 +155,4 @@ public static ListResponse parseJson(HttpResponse httpResponse) throws IOExcepti
170155
}
171156
return listResponse;
172157
}
173-
174-
}
158+
}

samples/snippets/src/test/java/com/example/json/YouTubeSampleTest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.example.json;
1718

19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotNull;
21+
1822
import com.google.api.client.http.HttpRequest;
1923
import com.google.api.client.http.HttpResponse;
2024
import com.google.api.client.http.HttpTransport;
@@ -28,20 +32,17 @@
2832
import com.google.api.client.testing.http.MockLowLevelHttpRequest;
2933
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
3034
import com.google.common.base.Preconditions;
31-
import org.junit.Test;
32-
3335
import java.io.IOException;
3436
import java.io.InputStream;
3537
import java.util.Map;
36-
37-
import static org.junit.Assert.assertEquals;
38-
import static org.junit.Assert.assertNotNull;
38+
import org.junit.Test;
3939

4040
public class YouTubeSampleTest {
4141

4242
@Test
4343
public void testParsing() throws IOException {
44-
final InputStream contents = getClass().getClassLoader().getResourceAsStream("youtube-search.json");
44+
final InputStream contents =
45+
getClass().getClassLoader().getResourceAsStream("youtube-search.json");
4546
Preconditions.checkNotNull(contents);
4647
HttpTransport transport =
4748
new MockHttpTransport() {
@@ -91,4 +92,4 @@ public LowLevelHttpResponse execute() throws IOException {
9192
}
9293
}
9394
}
94-
}
95+
}

0 commit comments

Comments
 (0)