Skip to content

Commit a879ecf

Browse files
Elevate access level to support mocking (#3562)
1 parent 5281f1b commit a879ecf

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentReference.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public class DocumentReference {
4646
private final ResourcePath path;
4747
private final FirestoreImpl firestore;
4848

49-
DocumentReference(FirestoreImpl firestore, ResourcePath path) {
49+
protected DocumentReference(
50+
FirestoreImpl firestore, ResourcePath path) { // Elevated access level for mocking.
5051
this.path = path;
5152
this.firestore = firestore;
5253
}

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSnapshot.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ public class DocumentSnapshot {
5353
@Nullable private final Timestamp updateTime;
5454
@Nullable private final Timestamp createTime;
5555

56-
DocumentSnapshot(
56+
protected DocumentSnapshot(
5757
FirestoreImpl firestore,
5858
DocumentReference docRef,
5959
@Nullable Map<String, Value> fields,
6060
@Nullable Timestamp readTime,
6161
@Nullable Timestamp updateTime,
62-
@Nullable Timestamp createTime) {
62+
@Nullable Timestamp createTime) { // Elevated access level for mocking.
6363
this.firestore = firestore;
6464
this.docRef = docRef;
6565
this.fields = fields;

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ public int hashCode() {
255255
this(firestore, path, new QueryOptions());
256256
}
257257

258-
private Query(FirestoreImpl firestore, ResourcePath path, QueryOptions queryOptions) {
258+
protected Query(
259+
FirestoreImpl firestore,
260+
ResourcePath path,
261+
QueryOptions queryOptions) { // Elevated access level for mocking.
259262
Preconditions.checkArgument(
260263
path.isCollection(), "Invalid path specified. Path should point to a collection");
261264

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/QueryDocumentSnapshot.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
* that does so.
3838
*/
3939
public class QueryDocumentSnapshot extends DocumentSnapshot {
40-
private QueryDocumentSnapshot(
40+
protected QueryDocumentSnapshot(
4141
FirestoreImpl firestore,
4242
DocumentReference docRef,
4343
Map<String, Value> fields,
4444
Timestamp readTime,
4545
Timestamp updateTime,
46-
Timestamp createTime) {
46+
Timestamp createTime) { // Elevated access level for mocking.
4747
super(firestore, docRef, fields, readTime, updateTime, createTime);
4848
}
4949

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/QuerySnapshot.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public abstract class QuerySnapshot implements Iterable<QueryDocumentSnapshot> {
3434
private final Query query;
3535
private final Timestamp readTime;
3636

37-
private QuerySnapshot(Query query, Timestamp readTime) {
37+
protected QuerySnapshot(Query query, Timestamp readTime) { // Elevated access level for mocking.
3838
this.query = query;
3939
this.readTime = readTime;
4040
}

0 commit comments

Comments
 (0)