Skip to content

Commit 777ecab

Browse files
authored
fix(build): sample checkstyle violations (#457)
* build: fix sample checkstyle violations * fix(build): test sample
1 parent 7d91776 commit 777ecab

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

samples/snippets/src/main/java/com/example/firestore/Quickstart.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void addDocument(String docName) throws Exception {
129129
}
130130
}
131131

132-
void runAQuery() throws Exception {
132+
void runQuery() throws Exception {
133133
// [START fs_add_query]
134134
// asynchronously query for all users born before 1900
135135
ApiFuture<QuerySnapshot> query =
@@ -187,7 +187,7 @@ void run() throws Exception {
187187

188188
// retrieve all users born before 1900
189189
System.out.println("########## users born before 1900 ##########");
190-
runAQuery();
190+
runQuery();
191191

192192
// retrieve all users
193193
System.out.println("########## All users ##########");

samples/snippets/src/main/java/com/example/firestore/snippets/ManageDataSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ void writeBatch() throws Exception {
445445
ApiFuture<List<WriteResult>> future = batch.commit();
446446
// ...
447447
// future.get() blocks on batch commit operation
448-
for (WriteResult result :future.get()) {
448+
for (WriteResult result : future.get()) {
449449
System.out.println("Update time : " + result.getUpdateTime());
450450
}
451451
// [END firestore_data_batch_writes]

samples/snippets/src/main/java/com/example/firestore/snippets/QueryDataSnippets.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void prepareExamples() throws Exception {
111111
*
112112
* @return query
113113
*/
114-
Query createAQuery() throws Exception {
114+
Query createQuery() throws Exception {
115115
// [START fs_create_query]
116116
// [START firestore_query_filter_eq_boolean]
117117
// Create a reference to the cities collection
@@ -134,7 +134,7 @@ Query createAQuery() throws Exception {
134134
*
135135
* @return query
136136
*/
137-
Query createAQueryAlternate() throws Exception {
137+
Query createQueryAlternate() throws Exception {
138138
// [START fs_create_query_country]
139139
// [START firestore_query_filter_eq_string]
140140
// Create a reference to the cities collection

samples/snippets/src/main/java/com/example/firestore/snippets/References.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public References(Firestore db) {
3434
*
3535
* @return collection reference
3636
*/
37-
public CollectionReference getACollectionRef() {
37+
public CollectionReference getCollectionRef() {
3838
// [START fs_collection_ref]
3939
// [START firestore_data_reference_collection]
4040
// Reference to the collection "users"
@@ -49,7 +49,7 @@ public CollectionReference getACollectionRef() {
4949
*
5050
* @return document reference
5151
*/
52-
public DocumentReference getADocumentRef() {
52+
public DocumentReference getDocumentRef() {
5353
// [START fs_document_ref]
5454
// [START firestore_data_reference_document]
5555
// Reference to a document with id "alovelace" in the collection "users"
@@ -64,7 +64,7 @@ public DocumentReference getADocumentRef() {
6464
*
6565
* @return document reference
6666
*/
67-
public DocumentReference getADocumentRefUsingPath() {
67+
public DocumentReference getDocumentRefUsingPath() {
6868
// [START fs_document_path_ref]
6969
// [START firestore_data_reference_document_path]
7070
// Reference to a document with id "alovelace" in the collection "users"
@@ -79,7 +79,7 @@ public DocumentReference getADocumentRefUsingPath() {
7979
*
8080
* @return document reference in a subcollection
8181
*/
82-
public DocumentReference getASubCollectionDocumentRef() {
82+
public DocumentReference getSubCollectionDocumentRef() {
8383
// [START fs_subcollection_ref]
8484
// [START firestore_data_reference_subcollection]
8585
// Reference to a document in subcollection "messages"

samples/snippets/src/test/java/com/example/firestore/QuickstartIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void testQuickstart() throws Exception {
5555
addData();
5656

5757
bout.reset();
58-
quickstart.runAQuery();
58+
quickstart.runQuery();
5959
String output = bout.toString();
6060
// confirm that results do not contain aturing
6161
assertTrue(output.contains("alovelace"));

samples/snippets/src/test/java/com/example/firestore/snippets/QueryDataSnippetsIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public static void setUpBeforeClass() throws Exception {
5353
}
5454

5555
@Test
56-
public void testCreateAQuery() throws Exception {
57-
Query q = queryDataSnippets.createAQuery();
56+
public void testCreateQuery() throws Exception {
57+
Query q = queryDataSnippets.createQuery();
5858
Set<String> result = getResultsAsSet(q);
5959
Set<String> expectedResults = new HashSet<>(Arrays.asList("DC", "TOK", "BJ"));
6060
assertTrue(Objects.equals(result, expectedResults));

0 commit comments

Comments
 (0)