blob: 061b4dbba1ff37783e9faed943ab084169d955c8 [file] [log] [blame]
aishwaryarana01b06a3042019-10-03 12:05:17 -05001/*
2 * Copyright 2019-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package afrouter
18
19import (
20 "reflect"
21 "testing"
22)
23
24func Test_newMethodDetails(t *testing.T) {
25 type args struct {
26 fullMethodName string
27 }
28 tests := []struct {
29 name string
30 args args
31 want methodDetails
32 }{
33 // TODO: Add test cases.
34 {"newMethodDetails-1", args{fullMethodName: "/voltha.VolthaService/EnableDevice"},
35 methodDetails{all: "/voltha.VolthaService/EnableDevice", pkg: "voltha", service: "VolthaService", method: "EnableDevice"}},
36 {"newMethodDetails-2", args{fullMethodName: "/voltha.VolthaService/DisableDevice"},
37 methodDetails{all: "/voltha.VolthaService/DisableDevice", pkg: "voltha", service: "VolthaService", method: "DisableDevice"}},
38 {"newMethodDetails-3", args{fullMethodName: "/voltha.VolthaService/ListDevicePorts"},
39 methodDetails{all: "/voltha.VolthaService/ListDevicePorts", pkg: "voltha", service: "VolthaService", method: "ListDevicePorts"}},
40 }
41 for _, tt := range tests {
42 t.Run(tt.name, func(t *testing.T) {
43 if got := newMethodDetails(tt.args.fullMethodName); !reflect.DeepEqual(got, tt.want) {
44 t.Errorf("newMethodDetails() = %v, want %v", got, tt.want)
45 }
46 })
47 }
48}