@Test public void shouldMapSimpleRecordWithString() throws Throwable { // When OutputMapper mapper = mapper( SingleStringFieldRecord.class ); // Then assertThat( mapper.signature(), contains( outputField( "name", NTString ) ) ); assertThat( asList( mapper.apply( new SingleStringFieldRecord( "hello, world!" ) ) ), contains( "hello, world!" ) ); }
return new OutputMapper( signature, fieldMappers );
new ProcedureSignature( procName, inputSignature, outputMapper.signature(), Mode.DEFAULT, admin, null, new String[0], description, warning, procedure.eager(), false ); return new FailedLoadProcedure( signature ); new ProcedureSignature( procName, inputSignature, outputMapper.signature(), mode, admin, deprecated, config.rolesFor( procName.toString() ), description, warning, procedure.eager(), false ); return new ReflectiveProcedure( signature, constructor, method, outputMapper, setters );
return new OutputMapper( signature, fieldMappers );
@Override public Object[] next() throws ProcedureException { try { Object record = out.next(); return outputMapper.apply( record ); } catch ( Throwable throwable ) { throw closeAndCreateProcedureException( throwable ); } }
new ProcedureSignature( procName, inputSignature, outputMapper.signature(), Mode.DEFAULT, admin, null, new String[0], description, warning, procedure.eager(), false ); return new FailedLoadProcedure( signature ); new ProcedureSignature( procName, inputSignature, outputMapper.signature(), mode, admin, deprecated, config.rolesFor( procName.toString() ), description, warning, procedure.eager(), false ); return new ReflectiveProcedure( signature, constructor, method, outputMapper, setters );
@Test public void shouldSkipStaticFields() throws Throwable { // When OutputMapper mapper = mapper( RecordWithStaticFields.class ); // Then assertThat( mapper.signature(), contains( outputField( "includeMe", NTString ) ) ); assertThat( asList( mapper.apply( new RecordWithStaticFields( "hello, world!" ) ) ), contains( "hello, world!" ) ); }
@Override public Object[] next() throws ProcedureException { try { Object record = out.next(); return outputMapper.apply( record ); } catch ( Throwable throwable ) { throw closeAndCreateProcedureException( throwable ); } }
@Test public void shouldNoteDeprecatedFields() throws Exception { // when OutputMapper mapper = mapper( RecordWithDeprecatedFields.class ); // then assertThat( mapper.signature(), containsInAnyOrder( outputField( "deprecated", NTString, true ), outputField( "alsoDeprecated", NTString, true ), outputField( "replacement", NTString, false ) ) ); }