[BAEL-3090] Really added test this time

This commit is contained in:
dupirefr 2019-07-27 11:35:16 +02:00
parent c3cc9a8336
commit b9089ce067
1 changed files with 20 additions and 0 deletions

View File

@ -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");
}
}