Skip to content

Split UserDataConverter in two #21

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 6 commits into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -35,7 +35,6 @@
import com.google.firebase.firestore.Transaction.Function;
import com.google.firebase.firestore.testutil.IntegrationTestUtil;
import com.google.firebase.firestore.util.Consumer;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
Expand All @@ -44,6 +43,7 @@
import org.junit.runner.RunWith;

// NOTE: The SDK has exhaustive nullability checks, but we don't exhaustively test them. :-)
@SuppressWarnings("ConstantConditions")
@RunWith(AndroidJUnit4.class)
public class ValidationTest {

Expand Down Expand Up @@ -387,9 +387,8 @@ public void arrayTransformsRejectArrays() {
DocumentReference doc = testDocument();
// This would result in a directly nested array which is not supported.
String reason = "Invalid data. Nested arrays are not supported";
expectError(() -> doc.set(map("x", FieldValue.arrayUnion(1, Arrays.asList("nested")))), reason);
expectError(
() -> doc.set(map("x", FieldValue.arrayRemove(1, Arrays.asList("nested")))), reason);
expectError(() -> doc.set(map("x", FieldValue.arrayUnion(1, asList("nested")))), reason);
expectError(() -> doc.set(map("x", FieldValue.arrayRemove(1, asList("nested")))), reason);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.annotations.PublicApi;
import com.google.firebase.firestore.FirebaseFirestoreException.Code;
import com.google.firebase.firestore.UserDataConverter.ParsedDocumentData;
import com.google.firebase.firestore.UserDataConverter.ParsedUpdateData;
import com.google.firebase.firestore.core.EventManager.ListenOptions;
import com.google.firebase.firestore.core.QueryListener;
import com.google.firebase.firestore.core.UserData.ParsedSetData;
import com.google.firebase.firestore.core.UserData.ParsedUpdateData;
import com.google.firebase.firestore.core.ViewSnapshot;
import com.google.firebase.firestore.model.Document;
import com.google.firebase.firestore.model.DocumentKey;
Expand Down Expand Up @@ -166,7 +166,7 @@ public Task<Void> set(@NonNull Map<String, Object> data) {
public Task<Void> set(@NonNull Map<String, Object> data, @NonNull SetOptions options) {
checkNotNull(data, "Provided data must not be null.");
checkNotNull(options, "Provided options must not be null.");
ParsedDocumentData parsed =
ParsedSetData parsed =
options.isMerge()
? firestore.getDataConverter().parseMergeData(data, options.getFieldMask())
: firestore.getDataConverter().parseSetData(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.annotations.PublicApi;
import com.google.firebase.firestore.UserDataConverter.ParsedDocumentData;
import com.google.firebase.firestore.UserDataConverter.ParsedUpdateData;
import com.google.firebase.firestore.core.UserData.ParsedSetData;
import com.google.firebase.firestore.core.UserData.ParsedUpdateData;
import com.google.firebase.firestore.model.Document;
import com.google.firebase.firestore.model.MaybeDocument;
import com.google.firebase.firestore.model.NoDocument;
Expand Down Expand Up @@ -89,7 +89,7 @@ public Transaction set(
firestore.validateReference(documentRef);
checkNotNull(data, "Provided data must not be null.");
checkNotNull(options, "Provided options must not be null.");
ParsedDocumentData parsed =
ParsedSetData parsed =
options.isMerge()
? firestore.getDataConverter().parseMergeData(data, options.getFieldMask())
: firestore.getDataConverter().parseSetData(data);
Expand Down
Loading