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.restconf.impl.test;
10 import java.util.Collection;
11 import org.opendaylight.yangtools.yang.common.RpcError;
12 import org.opendaylight.yangtools.yang.common.RpcResult;
14 public class DummyRpcResult<T> implements RpcResult<T> {
16 private final boolean isSuccessful;
17 private final T result;
18 private final Collection<RpcError> errors;
20 public DummyRpcResult() {
26 private DummyRpcResult(final Builder<T> builder) {
27 isSuccessful = builder.isSuccessful;
28 result = builder.result;
29 errors = builder.errors;
33 public boolean isSuccessful() {
38 public T getResult() {
43 public Collection<RpcError> getErrors() {
47 public static class Builder<T> {
48 private boolean isSuccessful;
50 private Collection<RpcError> errors;
52 public Builder<T> isSuccessful(final boolean successful) {
53 this.isSuccessful = successful;
57 public Builder<T> result(final T newResult) {
58 this.result = newResult;
62 public Builder<T> errors(final Collection<RpcError> newErrors) {
63 this.errors = newErrors;
67 public RpcResult<T> build() {
68 return new DummyRpcResult<>(this);