Docstash
Bootstrap

Phase 1 Tests

Total: 16 tests, all passing

Test Files

FileTestsDescription
OAuthClientTest3hashSecret(), matchesSecret(), toString()
TokenTest4calculateExpiry(), isExpired(), isValid()
ScimUserTest3setEmails() (list→comma-string), setGroups(), toScimSchema()
AuditEventTest3toMap() (JSONB serialization)
ApiGatewayApplicationTest3Spring context loads, actuator health returns UP

Test Configuration

@ActiveProfiles("test")

Activates src/test/resources/application.yml with H2 in-memory database. PostgreSQL is not required for tests.

# src/test/resources/application.yml
spring:
  datasource:
    url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
  jpa:
    hibernate:
      ddl-auto: create-drop  # H2 creates schema from entities
  flyway:
    enabled: false           # No Flyway in tests

Explicit Test Configuration Classes

@SpringBootTest(classes = AuthCoreTestApplication.class)
@ActiveProfiles("test")
class OAuthClientTest { }

AuthCoreTestApplication is a minimal @Configuration class that provides the beans needed for testing, avoiding full component scan in test context.

@MockBean for Redis

Redis is not available in the test environment, so it's mocked:

@MockBean
private RedisTemplate<String, Object> redisTemplate;

Running Tests

./mvnw test                                    # All modules
./mvnw test -pl backend/auth-core              # auth-core only
./mvnw test -pl backend/api-gateway            # api-gateway only

Test Results

OAuthClientTest         3 tests  ✓
TokenTest              4 tests  ✓
ScimUserTest           3 tests  ✓
AuditEventTest         3 tests  ✓
ApiGatewayApplicationTest  3 tests  ✓
────────────────────────────────
Total:                16 tests  ✓  BUILD SUCCESS

On this page