title: How to write the test case of When a function having the parameters of c *gin.Context
body: <p>I'm writing the test cases of the controllers for my project in golang. In the controllers there is the function name <code>SaveProvider()</code>having parameter <code>c *gin.Context</code> and I don't know how to pass the JSON to the <code>c *gin.Context</code> this parameter and How I test my functions used in the controllers Can anyone tell me that How What is the problem in this code.It is also called table driven test.</p>
  
  <pre><code>package controllers
  
  import (
      "bkapiv1/models"
      "fmt"
      "testing"
  
      "github.com/gin-gonic/gin"
  )
  
  func TestSaveProvider(t *testing.T) {
      type args struct {
          c    *gin.Context
          json ProviderProfile
      }
      tests := []struct {
          name string
          args args
          want bool
      }{
          {
              "SaveProvider",
              args{
                  &amp;gin.Context{
                     //How to pass here a JSON means the below JSON ProviderProfile.
                  },
                  ProviderProfile{
                       models.User{
                           FirstName:                  "Harry",
                           LastName:                   "Potter",
                           FullName:                   "Harry Potter",
                           CompanyName:                "TheIronNetwork",
                           EmailId:                   "harry@gmail.com",
                           Password:                   "vadhera123",
                       },
                       models.AddressStruct{},
                       models.Provider{
                          ProviderCategory: "IC",
                          Priority:         1,
                       },
                  },
              },
              true,
           },
       }
       for _, tt := range tests {
          t.Run(tt.name, func(t *testing.T) {
              SaveProvider(tt.args.c)
          })
       }
  }
  </code></pre>
  
  <p>The function in the controller is:-</p>
  
  <pre><code>func SaveProvider(c *gin.Context){
  
  }
  </code></pre>