Open
Conversation
PersonTest.java , Tests zu isTeen() geschrieben
ideadapt
reviewed
Nov 10, 2021
| // 1. Test schneller machen | ||
| // 2. UserController.create so beinflussen, | ||
| // dass einmal der "if"- und einmal der "else"-Fall durchlaufen wird | ||
| //Warum NullPointerException? Musste Mockdatabase erzeugen.. |
Contributor
There was a problem hiding this comment.
Versuche das mit dem Debugger rauszufinden. Im UserController wird wohl irgendwo erwartet dass this.database gesetzt ist.
Author
There was a problem hiding this comment.
Habe zwei UserController konstruktoren. Habe den falschen aufgerufen ( ohne this.database) mit dem zweiten hats funktioniert, da ich dort this.userVaildator, this.database gesetzt habe.
|
|
||
| verify(db, times(2)).addUser(any(User.class)); | ||
|
|
||
|
|
Contributor
There was a problem hiding this comment.
sieht doch gut aus! was würde passieren wenn du zweimal den gleichen user addest? wäre das einen weiteren test case wert ;) ?
…dUser2xToDBSameUser__MOCKITO()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UserControllerTest erledigt. MIX aus lösungen abschauen und Freestyle gebastel ala Hauptsache Test ist grün....
Können wir das mal Besprechen? Ich stehe da echt auf dem Schlauch.. hab nicht das gefühl etwas gelernt zu haben seit der letzten Lektion...