2 * Copyright (c) 2015 CableLabs 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
9 package org.opendaylight.controller.packetcable.provider.validation.impl.validators.ccaps;
11 import org.junit.Rule;
12 import org.junit.Test;
13 import org.opendaylight.controller.packetcable.provider.test.rules.Params;
14 import org.opendaylight.controller.packetcable.provider.validation.ValidationException;
15 import org.opendaylight.controller.packetcable.provider.validation.Validator;
16 import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.ccap.attributes.AmId;
17 import org.opendaylight.yang.gen.v1.urn.packetcable.rev151101.ccap.attributes.AmIdBuilder;
22 @Params.AlwaysUseParams
23 public class AmIdValidatorTest {
26 public Params<Validator.Extent> extentParams = Params.of(Validator.Extent.class);
28 private final AmIdValidator validator = new AmIdValidator();
31 public void testValid() throws Exception {
32 AmId amId = new AmIdBuilder()
37 // this throw an exception if invalid
38 validator.validate(amId, extentParams.getCurrentParam());
41 @Test(expected = ValidationException.class)
42 public void testNoAmTag() throws Exception {
43 AmId amId = new AmIdBuilder()
47 // this throw an exception if invalid
48 validator.validate(amId, extentParams.getCurrentParam());
51 @Test(expected = ValidationException.class)
52 public void testNoAmType() throws Exception {
53 AmId amId = new AmIdBuilder()
57 // this throw an exception if invalid
58 validator.validate(amId, extentParams.getCurrentParam());
61 @Test(expected = ValidationException.class)
62 public void testNullAmId() throws Exception {
63 // this throw an exception if invalid
64 validator.validate(null, extentParams.getCurrentParam());
67 public static AmId buildValidAmIdTree() {
68 return new AmIdBuilder()