AbstractValueFactory implements ValueFactory<T> { public TextDecoder getDecoder() { return this.decoder; } protected  AbstractValueFactory( PropertyType type,
                                    TextDecoder decoder,
                                    ValueFactories valueFactories ); TextDecoder getDecoder(); @Override PropertyType getPropertyType(); @Override T create( Object value ); @Override T[] create( BigDecimal[] values ); @Override T[] create( boolean[] values ); @Override T[] create( byte[][] values ); @Override T[] create( Calendar[] values ); @Override T[] create( Date[] values ); @Override T[] create( DateTime[] values ); @Override T[] create( double[] values ); @Override T[] create( float[] values ); @Override T[] create( int[] values ); @Override T[] create( long[] values ); @Override T[] create( Name[] values ); @Override T[] create( Object[] values ); @Override T[] create( Path[] values ); @Override T[] create( Reference[] values ); @Override T[] create( String[] values,
                       TextDecoder decoder ); @Override T[] create( String[] values ); @Override T[] create( URI[] values ); @Override T[] create( UUID[] values ); @Override T[] create( NodeKey[] values ); @Override T[] create( BinaryValue[] values ); @Override Iterator<T> create( Iterator<?> values ); @Override Iterable<T> create( final Iterable<?> valueIterable ); @Override T create( InputStream stream, String hint );  }
@Test public void shouldHaveDefaultEncoderIfNullPassedIntoConstructor() { assertThat(factory.getDecoder(), is(notNullValue())); assertThat(factory.getDecoder(), is(sameInstance(ValueFactory.DEFAULT_DECODER))); }
@Test public void shouldReturnTextEncoderPassedIntoConstructor() { factory = new MockFactory(CUSTOM_DECODER, null); assertThat(factory.getDecoder(), is(notNullValue())); assertThat(factory.getDecoder(), is(sameInstance(CUSTOM_DECODER))); }
@Test public void shouldReturnDefaultTextEncoderWhenNullPassedToGetEncoder() { assertThat(factory.getDecoder(), is(sameInstance(ValueFactory.DEFAULT_DECODER))); assertThat(factory.getDecoder(null), is(sameInstance(ValueFactory.DEFAULT_DECODER))); assertThat(factory.getDecoder(CUSTOM_DECODER), is(sameInstance(CUSTOM_DECODER))); }
@Test public void shouldReturnSuppliedTextEncoderWhenNonNullPassedToGetEncoder() { assertThat(factory.getDecoder(), is(sameInstance(ValueFactory.DEFAULT_DECODER))); assertThat(factory.getDecoder(null), is(sameInstance(ValueFactory.DEFAULT_DECODER))); assertThat(factory.getDecoder(CUSTOM_DECODER), is(sameInstance(CUSTOM_DECODER))); }