Skip to content

Commit 5eaf3cc

Browse files
javier-godoypaodb
authored andcommitted
test: refactor helper method into utility class
1 parent ba8ea0e commit 5eaf3cc

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/test/java/com/flowingcode/vaadin/addons/xterm/integration/ConsoleFeatureIT.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,15 @@
1919
*/
2020
package com.flowingcode.vaadin.addons.xterm.integration;
2121

22+
import static com.flowingcode.vaadin.addons.xterm.integration.XTermTestUtils.makeFullLine;
2223
import static org.hamcrest.Matchers.is;
2324
import static org.hamcrest.Matchers.isEmptyString;
2425
import static org.junit.Assert.assertThat;
25-
import org.apache.commons.lang3.StringUtils;
2626
import org.junit.Test;
2727
import org.openqa.selenium.Keys;
2828

2929
public class ConsoleFeatureIT extends AbstractViewTest {
3030

31-
/** Returns a line that runs up to the right margin */
32-
private String makeFullLine(XTermElement term, boolean hasPrompt) {
33-
int cols = term.getColumnWidth();
34-
int x = hasPrompt ? term.cursorPosition().x : 0;
35-
return StringUtils.repeat("0123456789", cols / 10 + 1).substring(0, cols - x);
36-
}
37-
3831
@Test
3932
public void testWriteWrappedLine() throws InterruptedException {
4033
XTermElement term = $(XTermElement.class).first();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.flowingcode.vaadin.addons.xterm.integration;
2+
3+
import org.apache.commons.lang3.StringUtils;
4+
5+
public class XTermTestUtils {
6+
7+
/** Returns a line that runs up to the right margin */
8+
public static String makeFullLine(XTermElement term, boolean hasPrompt) {
9+
int cols = term.getColumnWidth();
10+
int x = hasPrompt ? term.cursorPosition().x : 0;
11+
return StringUtils.repeat("0123456789", cols / 10 + 1).substring(0, cols - x);
12+
}
13+
14+
}

0 commit comments

Comments
 (0)