2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.binding.test;
10 import junit.framework.Assert;
13 import org.opendaylight.yangtools.yang.binding.Augmentable;
14 import org.opendaylight.yangtools.yang.binding.Augmentation;
16 public class AugmentationVerifier<T extends Augmentable<T>> {
20 public AugmentationVerifier(T objectToVerify) {
21 this.object = objectToVerify;
24 public AugmentationVerifier<T> assertHasAugmentation(Class<? extends Augmentation<T>> augmentation) {
25 assertHasAugmentation(object, augmentation);
26 return (AugmentationVerifier<T>) this;
29 public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
30 Class<? extends Augmentation<T>> augmentation) {
31 Assert.assertNotNull(object);
32 Assert.assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
35 public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
36 return new AugmentationVerifier<T>(obj);