| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This is a shared comparison library for validating MongoDB Java Driver output against expected results. It supports both the Sync Driver and Reactive Streams Driver through a unified API.
java/ ├── pom.xml # Parent POM for multi-module project ├── comparison-library/ # Shared comparison library ├── comparison-library-reactive/ # Reactive-specific wrappers for RS driver ├── driver-sync/ # Java Sync Driver examples and tests └── driver-reactive/ # Java Reactive Streams Driver examples and tests (TBD - currently a stub implementation)
import utils.TestDataLoader;
import mongodb.comparison.Expect;
// Simple validation
List<Document> results = collection.find(eq("year", 2015)).into(new ArrayList<>());
Expect.that(results)
.withIgnoredFields("_id")
.shouldMatch("expected-results.txt");import utils.TestDataLoader;
import mongodb.comparison.Expect;
// Simple validation
Publisher<Document> publisher = collection.find(eq("year", 2015));
ExpectReactive.that(publisher)
.withIgnoredFields("_id")
.shouldMatch("expected-results.txt");# Build and run tests in all modules
mvn clean install
# Build and run tests in specific module
cd comparison-library && mvn clean test
cd comparison-library-reactive && mvn clean test
cd driver-sync && mvn clean test
cd driver-reactive && mvn clean testThis project uses Spotless with Palantir Java Format to enforce consistent code style across all modules.
Spotless runs automatically as part of the build (during mvn install or mvn verify), so your code is formatted whenever you compile. You can also run it manually from the java/ directory:
# Apply formatting to all modules
mvn spotless:apply
# Check formatting without modifying files (useful in CI)
mvn spotless:checkThe library supports multiple input formats:
{"name": "Alice", "age": 30}
{"name": "Bob", "age": 25}
[
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25}
]{name: 'Alice', _id: ObjectId('507f1f77bcf86cd799439011')}
{name: 'Bob', createdAt: Date('2023-01-01T00:00:00Z')}
Use "..." for flexible matching:
{"name": "Alice", "id": "..."} // Matches any id value
{"status": "...active"} // Matches any status ending with "active"
| Back | FazBrowse Home | New Git URL |