You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/04/17 21:46:00 UTC

[jira] [Commented] (PROTON-2035) Inability to mock Golang interfaces

    [ https://issues.apache.org/jira/browse/PROTON-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16820527#comment-16820527 ] 

ASF subversion and git services commented on PROTON-2035:
---------------------------------------------------------

Commit d0cd7d1c11aef7ac378ca47693931cb4de9934c5 in qpid-proton's branch refs/heads/master from Alan Conway
[ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=d0cd7d1 ]

PROTON-2035: [go] Inability to mock Golang interfaces

Moved unexported methods closed, wakeSync from electron.Endpoint to
an unexported interface endpointInternal.


> Inability to mock Golang interfaces
> -----------------------------------
>
>                 Key: PROTON-2035
>                 URL: https://issues.apache.org/jira/browse/PROTON-2035
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: go-binding
>    Affects Versions: proton-c-0.27.0
>         Environment: Centos 7, Golang 1.11
>            Reporter: Matt Threlfall
>            Assignee: Alan Conway
>            Priority: Minor
>
> I'll preface this by saying, I'm new to using Golang so this could entirely be my misunderstanding.
> I'm trying to use Proton-C 0.27's Golang bindings to connect to a broker and receive messages from it which works fine. However I'm finding it hard to mock the Receiver and Connection interfaces using either Go Mock or Testify's mocks. Both complain that the mock interfaces can't be used as they don't have an electron.closed function, despite it being defined. 
> I believe this to be due to the closed and waitSync functions being defined in lowercase, changing them throughout the implementation to start with capitals makes the mock interfaces work fine. I understand they're lowercase however to keep them private to the package. 
> Is this an oversight in the implementation or is there a better way to mock Connections and Receivers without editing the original source code?
> Again I apologise if this is a simple matter, this is my first Golang project and mock implementation.
>  
> Thank you,
> Matt



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org