2 * Copyright (c) 2015 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
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf;
11 import static org.mockito.Mockito.mock;
13 import java.util.Arrays;
14 import java.util.List;
16 import org.junit.Assert;
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
21 public class ClassificationResultTest {
23 private ClassificationResult result;
25 private MatchBuilder matchBuilder;
26 private List<MatchBuilder> matches;
27 private String errorMessage = "errorMessage";
30 public void initialise() {
31 matchBuilder = mock(MatchBuilder.class);
32 matches = Arrays.asList(matchBuilder);
36 public void getMatchBuildersTestSuccess() {
37 result = new ClassificationResult(matches);
38 Assert.assertEquals(matches, result.getMatchBuilders());
41 @Test(expected = IllegalStateException.class)
42 public void getMatchBuildersTestFailure() {
43 result = new ClassificationResult(errorMessage);
44 result.getMatchBuilders();
48 public void getErrorMessageTest() {
49 result = new ClassificationResult(errorMessage);
50 Assert.assertEquals(errorMessage, result.getErrorMessage());
51 result = new ClassificationResult(matches);
52 Assert.assertTrue(result.getErrorMessage().isEmpty());
56 public void isSuccessfullTest() {
57 result = new ClassificationResult(errorMessage);
58 Assert.assertFalse(result.isSuccessfull());
59 result = new ClassificationResult(matches);
60 Assert.assertTrue(result.isSuccessfull());