EventStoredByPreProcessor implements Processor { @Override public void process( Event event, WorkContext ctx ) { final String storedBy = EventUtils.getValidUsername( event.getStoredBy(), ctx.getImportOptions() ); event.setStoredBy( storedBy ); Set<DataValue> dataValues = event.getDataValues(); for ( DataValue dataValue : dataValues ) { dataValue.setStoredBy( storedBy ); } }  @Override void process( Event event, WorkContext ctx );  }
@Test public void t1() { WorkContext ctx = WorkContext.builder() .importOptions( ImportOptions.getDefaultImportOptions() ) .build(); Event event = new Event(); event.setDataValues( Sets.newHashSet( new DataValue( "aaa", "one" ), new DataValue( "bbb", "two" ) ) ); preProcessor.process( event, ctx ); assertThat( event.getStoredBy(), is( FALLBACK_USERNAME ) ); assertThat( event.getDataValues(), hasItems( allOf( Matchers.hasProperty( "storedBy", is( FALLBACK_USERNAME ) ) ) ) ); }