1 package org.opendaylight.controller.sal.binding.test;
3 import junit.framework.Assert;
6 import org.opendaylight.yangtools.yang.binding.Augmentable;
7 import org.opendaylight.yangtools.yang.binding.Augmentation;
9 public class AugmentationVerifier<T extends Augmentable<T>> {
13 public AugmentationVerifier(T objectToVerify) {
14 this.object = objectToVerify;
17 public AugmentationVerifier<T> assertHasAugmentation(Class<? extends Augmentation<T>> augmentation) {
18 assertHasAugmentation(object, augmentation);
19 return (AugmentationVerifier<T>) this;
22 public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
23 Class<? extends Augmentation<T>> augmentation) {
24 Assert.assertNotNull(object);
25 Assert.assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
28 public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
29 return new AugmentationVerifier<T>(obj);