This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
make test # Run unit tests (mvn test)
make integration-test # Run integration tests (requires SMARTY_AUTH_ID and SMARTY_AUTH_TOKEN env vars)
make compile # Clean, test, then compile
make clean # Clean and reset version files
make publish # Full publish workflow with version updatesRun a single test class:
mvn test -Dtest=ClientTestRun a single test method:
mvn test -Dtest=ClientTest#testMethodNameThis is the official SmartyStreets Java SDK for address validation and geocoding APIs. Requires Java 11+.
- Jackson 3.x (
tools.jackson.core:jackson-databind) for JSON serialization - OkHttp 5.x (
com.squareup.okhttp3:okhttp-jvm) for HTTP - JUnit 4 + Mockito 5 for testing
pom.xml version and Version.java both contain 0.0.0 as a placeholder. DO NOT EDIT — these are updated automatically by the build job during release.
HTTP requests flow through a chain of decorators, each implementing Sender. Built bottom-up in ClientBuilder.buildSender():
LicenseSender → RetrySender → URLPrefixSender → SigningSender →
CustomQuerySender → CustomHeaderSender → StatusCodeSender → SmartySender
SmartySender: OkHttp-based HTTP client (innermost)StatusCodeSender: Maps HTTP status codes to exceptions (401→BadCredentialsException, etc.)CustomHeaderSender/CustomQuerySender: Added conditionally when custom headers/queries are configuredSigningSender: Adds authentication credentials to the requestRetrySender: Exponential backoff, handles 429 rate limitingLicenseSender: Adds license query parameter (outermost)
Each API (us_street, us_zipcode, international_street, etc.) follows the same structure:
Client.java: Sends lookups and populates results. ImplementsCloseable— must be closed to shut down OkHttp threads.Lookup.java: Input container for address/parametersBatch.java: Container for 1-100 lookups (batch operations)Candidate.javaorResult.java: Output container with validated data
Single lookups are sent as GET with query parameters. Batch (2+) lookups use POST with a JSON body.
ClientBuilder.java: Fluent builder for creating API clientssrc/main/java/com/smartystreets/api/{api_name}/Client.java: Per-API client implementationssrc/main/java/examples/: Usage examples for each API
StaticCredentials: Auth ID + Auth Token (server-to-server)SharedCredentials: Web Token + Referer (browser/mobile)
Test doubles are in src/test/java/com/smartystreets/api/mocks/:
MockSender,RequestCapturingSender: Capture and verify requestsFakeSerializer,FakeSleeper,FakeLogger: Stub implementations
- US Street Address (
us_street/) - US ZIP Code (
us_zipcode/) - US Reverse Geo (
us_reverse_geo/) - US Autocomplete Pro (
us_autocomplete_pro/) - US Extract (
us_extract/) - US Enrichment (
us_enrichment/) - International Street (
international_street/) - International Autocomplete (
international_autocomplete/) - International Postal Code (
international_postal_code/)