Akash Soni | b03636c | 2023-10-31 12:30:59 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022-present Open Networking Foundation |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | package controller |
| 17 | |
| 18 | import ( |
| 19 | "context" |
| 20 | "testing" |
| 21 | |
| 22 | ofp "github.com/opencord/voltha-protos/v5/go/openflow_13" |
| 23 | "github.com/stretchr/testify/assert" |
| 24 | ) |
| 25 | |
| 26 | func TestNewChangeEventTask(t *testing.T) { |
| 27 | type args struct { |
| 28 | ctx context.Context |
| 29 | event *ofp.ChangeEvent |
| 30 | device *Device |
| 31 | } |
| 32 | tests := []struct { |
| 33 | name string |
| 34 | args args |
| 35 | want *ChangeEventTask |
| 36 | }{ |
| 37 | { |
| 38 | name: "NewChangeEventTask", |
| 39 | args: args{ |
| 40 | ctx: context.Background(), |
| 41 | }, |
| 42 | }, |
| 43 | } |
| 44 | for _, tt := range tests { |
| 45 | t.Run(tt.name, func(t *testing.T) { |
| 46 | got := NewChangeEventTask(tt.args.ctx, tt.args.event, tt.args.device) |
| 47 | assert.NotNil(t, got) |
| 48 | }) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestChangeEventTask_Name(t *testing.T) { |
| 53 | cet := &ChangeEventTask{} |
| 54 | got := cet.Name() |
| 55 | assert.NotNil(t, got) |
| 56 | got1 := cet.TaskID() |
| 57 | assert.NotNil(t, got1) |
| 58 | got2 := cet.Timestamp() |
| 59 | assert.NotNil(t, got2) |
| 60 | } |