[BAEL-3090] Really added test this time
This commit is contained in:
parent
c3cc9a8336
commit
b9089ce067
|
@ -0,0 +1,20 @@
|
|||
package com.baeldung.memento;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class TextEditorTest {
|
||||
|
||||
@Test
|
||||
void givenTextEditor_whenAddTextSaveAddMoreAndUndo_thenSavecStateRestored() {
|
||||
TextEditor textEditor = new TextEditor(new TextWindow());
|
||||
textEditor.write("The Memento Design Pattern\n");
|
||||
textEditor.write("How to implement it in Java?\n");
|
||||
textEditor.hitSave();
|
||||
textEditor.write("Buy milk and eggs before coming home\n");
|
||||
textEditor.hitUndo();
|
||||
|
||||
assertThat(textEditor.print()).isEqualTo("The Memento Design Pattern\nHow to implement it in Java?\n");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue