Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting: [Feature request] Better error report format #63

Closed
Albert-Gao opened this issue Apr 23, 2018 · 1 comment
Closed

Formatting: [Feature request] Better error report format #63

Albert-Gao opened this issue Apr 23, 2018 · 1 comment

Comments

@Albert-Gao
Copy link

So, for a error report like this

Verification failed: call 2 of 2: class nz.salect.kotlinidiom.http.HttpKt.post(eq(http://localhost:8080/Login), eq({devid=, password=iAmNotAPassword!}), null())). Only one matching call to HttpKt(static HttpKt)/post(String, Map, Map) happened, but arguments are not matching:
[0]: argument: http://localhost:8080/Login, matcher: eq(http://localhost:8080/Login), result: +
[1]: argument: {devid=fake-dev-id, password=iAmNotAPassword!}, matcher: eq({devid=, password=iAmNotAPassword!}), result: -
[2]: argument: null, matcher: null(), result: +

Stack trace:
                                                       nz.salect.kotlinidiom.http.HttpKt.post              (http.kt:57)                               
                                                  nz.salect.kmoblib.services.AuthService.login             (AuthService.kt:40)                        
                                       nz.salect.kmoblib.AuthServiceTest$login_success$1.invoke            (AuthServiceTest.kt:165)                   
                                       nz.salect.kmoblib.AuthServiceTest$login_success$1.invoke            (AuthServiceTest.kt:17)                    
                                                       nz.salect.kmoblib.AuthServiceTest.mockHttpPost      (AuthServiceTest.kt:253)                   
                                                       nz.salect.kmoblib.AuthServiceTest.login_success     (AuthServiceTest.kt:164)                   
                                                    sun.reflect.NativeMethodAccessorImpl.invoke0           (NativeMethodAccessorImpl.java:-2)N        
                                                    sun.reflect.NativeMethodAccessorImpl.invoke            (NativeMethodAccessorImpl.java:62)         
                                                sun.reflect.DelegatingMethodAccessorImpl.invoke            (DelegatingMethodAccessorImpl.java:43)     
                                                                java.lang.reflect.Method.invoke            (Method.java:498)                          
                                               org.junit.runners.model.FrameworkMethod$1.runReflectiveCall (FrameworkMethod.java:50)                  
                                     org.junit.internal.runners.model.ReflectiveCallable.run               (ReflectiveCallable.java:12)      

It's detailed but still one more problem:

  1. Some lines are too long such that you need horizontal scroll in order to inspect them all.

I think we can't avoid horizontal scroll in every cases, but still I think mockk can deliever a better report like this:

Verification failed: call 2 of 2: 

class nz.salect.kotlinidiom.http.HttpKt.post(). 

Only one matching call to HttpKt(static HttpKt)/post(String, Map, Map) happened, but arguments are not matching:

[0]: 2nd argument mismatch: 
    expect: {devid=fake-dev-id, password=iAmNotAPassword!}, 
    actual: {devid=, password=iAmNotAPassword!}
    
Stack trace:
nz.salect.kotlinidiom.http.HttpKt.post                      (http.kt:57)                               
nz.salect.kmoblib.services.AuthService.login                (AuthService.kt:40)                        
nz.salect.kmoblib.AuthServiceTest$login_success$1.invoke    (AuthServiceTest.kt:165)                   
nz.salect.kmoblib.AuthServiceTest$login_success$1.invoke    (AuthServiceTest.kt:17)                    
nz.salect.kmoblib.AuthServiceTest.mockHttpPost              (AuthServiceTest.kt:253)                   
nz.salect.kmoblib.AuthServiceTest.login_success             (AuthServiceTest.kt:164)   
@Albert-Gao Albert-Gao changed the title [Feature request] [Feature request] Better error report format Apr 23, 2018
@oleksiyp oleksiyp changed the title [Feature request] Better error report format Formatting: [Feature request] Better error report format May 16, 2018
@oleksiyp
Copy link
Collaborator

What can I say? I like centered stacktraces 😄 Not a bug, so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants