Agreed - attempting to obtain 100% test coverage with only small-scale 
tests is not always the best usage of engineering time. Not just writing it 
the first time, but taking into account maintenance as well.

On Monday, April 1, 2019 at 12:07:03 PM UTC-7, Robert Engels wrote:
>
> I wouldn’t test that, test what is producing the response and that it is 
> the correct format. The testing of the encoding if the response is all that 
> is warranted - the other is tested in an integration test. 
>
> On Apr 1, 2019, at 8:07 AM, aniruddh...@nytimes.com <javascript:> wrote:
>
> Hi, 
>
> I am writing test cases in golang for one of service used in my 
> organisation. In one of file, I have below method --
>
>
> func encodeEdgeResp(_ context.Context, w http.ResponseWriter, response 
> interface{}) error {
> w.Header().Set("Content-Type", "application/json; charset=utf-8")
> return json.NewEncoder(w).Encode(response)
> }
>
>
> I am unable to understand how can I pass/mock http.ResponseWriter over 
> here to run my test cases.
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golan...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to