Skip to content

Commit

Permalink
fix(build): sample checkstyle violations (#457)
Browse files Browse the repository at this point in the history
* build: fix sample checkstyle violations

* fix(build): test sample
  • Loading branch information
athakor committed Nov 13, 2020
1 parent 7d91776 commit 777ecab
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Expand Up @@ -129,7 +129,7 @@ void addDocument(String docName) throws Exception {
}
}

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

// retrieve all users born before 1900
System.out.println("########## users born before 1900 ##########");
runAQuery();
runQuery();

// retrieve all users
System.out.println("########## All users ##########");
Expand Down
Expand Up @@ -445,7 +445,7 @@ void writeBatch() throws Exception {
ApiFuture<List<WriteResult>> future = batch.commit();
// ...
// future.get() blocks on batch commit operation
for (WriteResult result :future.get()) {
for (WriteResult result : future.get()) {
System.out.println("Update time : " + result.getUpdateTime());
}
// [END firestore_data_batch_writes]
Expand Down
Expand Up @@ -111,7 +111,7 @@ void prepareExamples() throws Exception {
*
* @return query
*/
Query createAQuery() throws Exception {
Query createQuery() throws Exception {
// [START fs_create_query]
// [START firestore_query_filter_eq_boolean]
// Create a reference to the cities collection
Expand All @@ -134,7 +134,7 @@ Query createAQuery() throws Exception {
*
* @return query
*/
Query createAQueryAlternate() throws Exception {
Query createQueryAlternate() throws Exception {
// [START fs_create_query_country]
// [START firestore_query_filter_eq_string]
// Create a reference to the cities collection
Expand Down
Expand Up @@ -34,7 +34,7 @@ public References(Firestore db) {
*
* @return collection reference
*/
public CollectionReference getACollectionRef() {
public CollectionReference getCollectionRef() {
// [START fs_collection_ref]
// [START firestore_data_reference_collection]
// Reference to the collection "users"
Expand All @@ -49,7 +49,7 @@ public CollectionReference getACollectionRef() {
*
* @return document reference
*/
public DocumentReference getADocumentRef() {
public DocumentReference getDocumentRef() {
// [START fs_document_ref]
// [START firestore_data_reference_document]
// Reference to a document with id "alovelace" in the collection "users"
Expand All @@ -64,7 +64,7 @@ public DocumentReference getADocumentRef() {
*
* @return document reference
*/
public DocumentReference getADocumentRefUsingPath() {
public DocumentReference getDocumentRefUsingPath() {
// [START fs_document_path_ref]
// [START firestore_data_reference_document_path]
// Reference to a document with id "alovelace" in the collection "users"
Expand All @@ -79,7 +79,7 @@ public DocumentReference getADocumentRefUsingPath() {
*
* @return document reference in a subcollection
*/
public DocumentReference getASubCollectionDocumentRef() {
public DocumentReference getSubCollectionDocumentRef() {
// [START fs_subcollection_ref]
// [START firestore_data_reference_subcollection]
// Reference to a document in subcollection "messages"
Expand Down
Expand Up @@ -55,7 +55,7 @@ public void testQuickstart() throws Exception {
addData();

bout.reset();
quickstart.runAQuery();
quickstart.runQuery();
String output = bout.toString();
// confirm that results do not contain aturing
assertTrue(output.contains("alovelace"));
Expand Down
Expand Up @@ -53,8 +53,8 @@ public static void setUpBeforeClass() throws Exception {
}

@Test
public void testCreateAQuery() throws Exception {
Query q = queryDataSnippets.createAQuery();
public void testCreateQuery() throws Exception {
Query q = queryDataSnippets.createQuery();
Set<String> result = getResultsAsSet(q);
Set<String> expectedResults = new HashSet<>(Arrays.asList("DC", "TOK", "BJ"));
assertTrue(Objects.equals(result, expectedResults));
Expand Down

0 comments on commit 777ecab

Please sign in to comment.