Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): sample checkstyle violations #457

Merged
merged 2 commits into from Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -119,7 +119,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 @@ -177,7 +177,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 @@ -412,7 +412,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 fs_write_batch]
Expand Down
Expand Up @@ -109,7 +109,7 @@ void prepareExamples() throws Exception {
*
* @return query
*/
Query createAQuery() throws Exception {
Query createQuery() throws Exception {
// [START fs_create_query]
// Create a reference to the cities collection
CollectionReference cities = db.collection("cities");
Expand All @@ -130,7 +130,7 @@ Query createAQuery() throws Exception {
*
* @return query
*/
Query createAQueryAlternate() throws Exception {
Query createQueryAlternate() throws Exception {
// [START fs_create_query_country]
// Create a reference to the cities collection
CollectionReference cities = db.collection("cities");
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]
// Reference to the collection "users"
CollectionReference collection = db.collection("users");
Expand All @@ -47,7 +47,7 @@ public CollectionReference getACollectionRef() {
*
* @return document reference
*/
public DocumentReference getADocumentRef() {
public DocumentReference getDocumentRef() {
// [START fs_document_ref]
// Reference to a document with id "alovelace" in the collection "users"
DocumentReference document = db.collection("users").document("alovelace");
Expand All @@ -60,7 +60,7 @@ public DocumentReference getADocumentRef() {
*
* @return document reference
*/
public DocumentReference getADocumentRefUsingPath() {
public DocumentReference getDocumentRefUsingPath() {
// [START fs_document_path_ref]
// Reference to a document with id "alovelace" in the collection "users"
DocumentReference document = db.document("users/alovelace");
Expand All @@ -73,7 +73,7 @@ public DocumentReference getADocumentRefUsingPath() {
*
* @return document reference in a subcollection
*/
public DocumentReference getASubCollectionDocumentRef() {
public DocumentReference getSubCollectionDocumentRef() {
// [START fs_subcollection_ref]
// Reference to a document in subcollection "messages"
DocumentReference document =
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