gitee.com/go-spring2/spring-base@v1.1.3/util/type_mock_test.go (about)

     1  /*
     2   * Copyright 2012-2019 the original author or authors.
     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   *      https://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  
    17  package util_test
    18  
    19  import (
    20  	"reflect"
    21  	"testing"
    22  
    23  	"gitee.com/go-spring2/spring-base/assert"
    24  	"gitee.com/go-spring2/spring-base/util"
    25  	"github.com/golang/mock/gomock"
    26  )
    27  
    28  func TestBeanSelector(t *testing.T) {
    29  	ctrl := gomock.NewController(t)
    30  	defer ctrl.Finish()
    31  	g := util.NewMockBeanSelector(ctrl)
    32  	g.EXPECT()
    33  }
    34  
    35  func TestBeanDefinition(t *testing.T) {
    36  	ctrl := gomock.NewController(t)
    37  	defer ctrl.Finish()
    38  	g := util.NewMockBeanDefinition(ctrl)
    39  	g.EXPECT().Type().Return(reflect.TypeOf(3))
    40  	assert.Equal(t, g.Type(), reflect.TypeOf(3))
    41  	g.EXPECT().Value().Return(reflect.ValueOf(3))
    42  	assert.Equal(t, g.Value(), reflect.ValueOf(3))
    43  	g.EXPECT().BeanName().Return("")
    44  	assert.Equal(t, g.BeanName(), "")
    45  	g.EXPECT().TypeName().Return("")
    46  	assert.Equal(t, g.TypeName(), "")
    47  	g.EXPECT().ID().Return("")
    48  	assert.Equal(t, g.ID(), "")
    49  	g.EXPECT().Created().Return(false)
    50  	assert.Equal(t, g.Created(), false)
    51  	g.EXPECT().Wired().Return(true)
    52  	assert.Equal(t, g.Wired(), true)
    53  	g.EXPECT().Interface().Return(nil)
    54  	assert.Equal(t, g.Interface(), nil)
    55  }
    56  
    57  func TestConverter(t *testing.T) {
    58  	ctrl := gomock.NewController(t)
    59  	defer ctrl.Finish()
    60  	g := util.NewMockConverter(ctrl)
    61  	g.EXPECT()
    62  }