Skip to content

Uebung fakes#27

Open
cm-clodos wants to merge 10 commits intoibwgr:masterfrom
cm-clodos:uebung-fakes
Open

Uebung fakes#27
cm-clodos wants to merge 10 commits intoibwgr:masterfrom
cm-clodos:uebung-fakes

Conversation

@cm-clodos
Copy link

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...

// 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..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Versuche das mit dem Debugger rauszufinden. Im UserController wird wohl irgendwo erwartet dass this.database gesetzt ist.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sieht doch gut aus! was würde passieren wenn du zweimal den gleichen user addest? wäre das einen weiteren test case wert ;) ?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants