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.qos;
11 import java.util.Collections;
12 import org.junit.Rule;
13 import org.junit.Test;
14 import org.opendaylight.controller.packetcable.provider.test.rules.Params;
15 import org.opendaylight.controller.packetcable.provider.validation.ValidationException;
16 import org.opendaylight.controller.packetcable.provider.validation.Validator;
17 import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.pcmm.qos.gates.Apps;
18 import org.opendaylight.yang.gen.v1.urn.packetcable.rev161017.pcmm.qos.gates.AppsBuilder;
23 @Params.AlwaysUseParams
24 public class AppsValidatorTest {
27 public Params<Validator.Extent> extentParams = Params.of(Validator.Extent.class);
29 private final AppsValidator validator = new AppsValidator();
31 @Test(expected = ValidationException.class)
32 public void nullApps() throws ValidationException {
33 validator.validate(null, extentParams.getCurrentParam());
36 @Params.DoNotUseParams
37 @Test(expected = NullPointerException.class)
38 public void nullExtent() throws ValidationException {
39 validator.validate(buildValidApps(), null);
43 public void valid() throws ValidationException {
44 validator.validate(buildValidApps(), extentParams.getCurrentParam());
47 public static Apps buildValidApps() {
48 return new AppsBuilder()
49 .setApp(Collections.singletonList(AppValidatorTest.buildValidApp()))