Search in sources :

Example 6 with SchemaChange

use of org.zalando.nakadi.domain.SchemaChange in project nakadi by zalando.

the class SchemaEvolutionServiceTest method whenMinorChangesBumpVersion.

@Test
public void whenMinorChangesBumpVersion() throws Exception {
    final EventTypeTestBuilder builder = EventTypeTestBuilder.builder();
    final EventType oldEventType = builder.build();
    final EventType newEventType = builder.build();
    Mockito.doReturn(Optional.empty()).when(evolutionConstraint).validate(oldEventType, newEventType);
    Mockito.doReturn(MINOR).when(compatibleChanges).get(any());
    Mockito.doReturn(Lists.newArrayList(new SchemaChange(TITLE_CHANGED, "#/"))).when(schemaDiff).collectChanges(any(), any());
    final EventType eventType = service.evolve(oldEventType, newEventType);
    assertThat(eventType.getSchema().getVersion(), is(equalTo(new Version("1.1.0"))));
    verify(evolutionConstraint).validate(oldEventType, newEventType);
}
Also used : EventType(org.zalando.nakadi.domain.EventType) Version(org.zalando.nakadi.domain.Version) SchemaChange(org.zalando.nakadi.domain.SchemaChange) EventTypeTestBuilder(org.zalando.nakadi.utils.EventTypeTestBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 SchemaChange (org.zalando.nakadi.domain.SchemaChange)6 EventType (org.zalando.nakadi.domain.EventType)5 EventTypeTestBuilder (org.zalando.nakadi.utils.EventTypeTestBuilder)5 Version (org.zalando.nakadi.domain.Version)4 Schema (org.everit.json.schema.Schema)1 JSONObject (org.json.JSONObject)1 InvalidEventTypeException (org.zalando.nakadi.exceptions.InvalidEventTypeException)1