title: How to mock a gin.Context?
body: <p>Hi I've been trying to mock a gin.Context but I have not been able to make it work
  I was trying what they did in this <a href="https://stackoverflow.com/questions/41742988/make-mock-gin-context-in-golang">solution</a> but it does not work with my router this is the error I have been getting</p>
  <p><code>r.POST(&quot;/urls&quot;, urlRepo.CreateUrl)</code></p>
  <p><code>cannot use urlRepo.CreateUrl (value of type func(c controllers.Icontext)) as gin.HandlerFunc value in argument to r.POSTcompilerIncompatibleAssign</code></p>
  <p>This is the interface I created to later mock and the method in which I will be testing</p>
  <pre><code>type Icontext interface {
    BindJSON(obj interface{}) error
    JSON(code int, obj interface{})
    AbortWithStatus(code int)
    AbortWithStatusJSON(code int, jsonObj interface{})
  </code></pre>
  <p>}</p>
  <pre><code>func (repository *UrlRepo) CreateUrl(c Icontext) {
      var url models.Url
      c.BindJSON(&amp;url)
      if !validators.IsCreateJsonCorrect(url) {
          c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{&quot;error&quot;: &quot;Error format in Short or Full&quot;})
          return
      }
      err := repository.reposito.CreateUrl(repository.Db, &amp;url)
      if err != nil {
          c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{&quot;error&quot;: err})
          return
      }
      c.JSON(http.StatusOK, url)
  } 
  </code></pre>
  <p>Instead of</p>
  <pre><code>func (repository *UrlRepo) CreateUrl(c Icontext)
  </code></pre>
  <p>it was</p>
  <pre><code>func (repository *UrlRepo) CreateUrl(c *gin.Context) 
  </code></pre>