diff options
Diffstat (limited to 'infra/translate-utils/src')
3 files changed, 20 insertions, 16 deletions
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java index e058964a0..daf6f3566 100644 --- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java +++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java @@ -59,14 +59,14 @@ public class ReflexiveListReaderCustomizer<C extends DataObject & Identifiable<K public void readCurrentAttributes(final InstanceIdentifier<C> id, final B builder, final ReadContext context) throws ReadFailedException { final Optional<Method> method = - ReflectionUtils.findMethodReflex(builder.getClass(), "setKey", + ReflectionUtils.findMethodReflex(builder.getClass(), "withKey", Collections.singletonList(keyType), builder.getClass()); - checkArgument(method.isPresent(), "Unable to setKey to %s", builder); + checkArgument(method.isPresent(), "Unable to build withKey for %s", builder); try { method.get().invoke(builder, ((KeyedInstanceIdentifier)id).getKey()); } catch (IllegalAccessException | InvocationTargetException e) { - throw new IllegalArgumentException("Unable to setKey to " + builder, e); + throw new IllegalArgumentException("Unable to build withKey for " + builder, e); } } diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizerTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizerTest.java index 2cc934546..aa1d0f925 100644 --- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizerTest.java +++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizerTest.java @@ -95,7 +95,7 @@ public class ReflexiveListReaderCustomizerTest { } @Override - public TestingListKey getKey() { + public TestingListKey key() { return key; } @@ -133,7 +133,7 @@ public class ReflexiveListReaderCustomizerTest { return new TestingListObject(key); } - public TestingListObjectBuilder setKey(final TestingListObject.TestingListKey key) { + public TestingListObjectBuilder withKey(final TestingListObject.TestingListKey key) { this.key = key; return this; } diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizerTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizerTest.java index cf341a74e..977c0316a 100644 --- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizerTest.java +++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizerTest.java @@ -16,21 +16,25 @@ package io.fd.honeycomb.translate.util.read; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verifyZeroInteractions; + import com.google.common.collect.Lists; import io.fd.honeycomb.translate.read.ReadContext; +import java.util.Collections; +import java.util.List; +import javax.annotation.Nonnull; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yangtools.concepts.Builder; -import org.opendaylight.yangtools.yang.binding.*; - -import javax.annotation.Nonnull; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verifyZeroInteractions; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.DataContainer; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.binding.Identifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class ReflexiveReaderCustomizerTest { @@ -111,7 +115,7 @@ public class ReflexiveReaderCustomizerTest { } @Override - public TestingListKey getKey() { + public TestingListKey key() { return new TestingListKey(); } |