Skip to content

Elevate access level to support mocking #3562

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

Merged
merged 1 commit into from
Aug 15, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public class DocumentReference {
private final ResourcePath path;
private final FirestoreImpl firestore;

DocumentReference(FirestoreImpl firestore, ResourcePath path) {
protected DocumentReference(
FirestoreImpl firestore, ResourcePath path) { // Elevated access level for mocking.
this.path = path;
this.firestore = firestore;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public class DocumentSnapshot {
@Nullable private final Timestamp updateTime;
@Nullable private final Timestamp createTime;

DocumentSnapshot(
protected DocumentSnapshot(
FirestoreImpl firestore,
DocumentReference docRef,
@Nullable Map<String, Value> fields,
@Nullable Timestamp readTime,
@Nullable Timestamp updateTime,
@Nullable Timestamp createTime) {
@Nullable Timestamp createTime) { // Elevated access level for mocking.
this.firestore = firestore;
this.docRef = docRef;
this.fields = fields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ public int hashCode() {
this(firestore, path, new QueryOptions());
}

private Query(FirestoreImpl firestore, ResourcePath path, QueryOptions queryOptions) {
protected Query(
FirestoreImpl firestore,
ResourcePath path,
QueryOptions queryOptions) { // Elevated access level for mocking.
Preconditions.checkArgument(
path.isCollection(), "Invalid path specified. Path should point to a collection");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
* that does so.
*/
public class QueryDocumentSnapshot extends DocumentSnapshot {
private QueryDocumentSnapshot(
protected QueryDocumentSnapshot(
FirestoreImpl firestore,
DocumentReference docRef,
Map<String, Value> fields,
Timestamp readTime,
Timestamp updateTime,
Timestamp createTime) {
Timestamp createTime) { // Elevated access level for mocking.
super(firestore, docRef, fields, readTime, updateTime, createTime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public abstract class QuerySnapshot implements Iterable<QueryDocumentSnapshot> {
private final Query query;
private final Timestamp readTime;

private QuerySnapshot(Query query, Timestamp readTime) {
protected QuerySnapshot(Query query, Timestamp readTime) { // Elevated access level for mocking.
this.query = query;
this.readTime = readTime;
}
Expand Down