diff --git a/src/test/java/net/kemitix/text/fit/BoxFitterTest.java b/src/test/java/net/kemitix/text/fit/BoxFitterTest.java index f90994f..c0606e5 100644 --- a/src/test/java/net/kemitix/text/fit/BoxFitterTest.java +++ b/src/test/java/net/kemitix/text/fit/BoxFitterTest.java @@ -53,7 +53,7 @@ public class BoxFitterTest "extralongword", 44 ); wordMap.forEach((word, expectedSize) -> - assertThat(invoke(word)) + assertThat(fit(word)) .as(word) .isEqualTo(expectedSize)); } @@ -74,7 +74,7 @@ public class BoxFitterTest longStringGenerator(196), 3 ); wordMap.forEach((word, expectedSize) -> - assertThat(invoke(word)) + assertThat(fit(word)) .as(word) .isEqualTo(expectedSize)); } @@ -85,18 +85,18 @@ public class BoxFitterTest public void tooLongThrows() { String longText = longStringGenerator(197); assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> invoke(longText)); + .isThrownBy(() -> fit(longText)); } @Test @DisplayName("Long text can be fitted down to a font size of 3") public void veryLongFits() { String longText = longStringGenerator(196); - assertThatCode(() -> invoke(longText)) + assertThatCode(() -> fit(longText)) .doesNotThrowAnyException(); } - private int invoke(String longText) { + private int fit(String longText) { return boxFitter.fit(longText, fontFactory, graphics2D, box); } } @@ -110,7 +110,7 @@ public class BoxFitterTest private Rectangle2D box = new Rectangle(imageSize, imageSize); private List boxes = Arrays.asList(box, box); - private int invoke(String longText) { + private int fit(String longText) { return boxFitter.fit(longText, fontFactory, graphics2D, boxes); } @@ -118,7 +118,7 @@ public class BoxFitterTest @DisplayName("Text too long to fit single box - fits into two") public void tooLongThrows() { String longText = longStringGenerator(197); - int result = invoke(longText); + int result = fit(longText); assertThat(result).isGreaterThan(3); } diff --git a/src/test/java/net/kemitix/text/fit/TextLineWrapTest.java b/src/test/java/net/kemitix/text/fit/TextLineWrapTest.java index e4f14bf..8314a2c 100644 --- a/src/test/java/net/kemitix/text/fit/TextLineWrapTest.java +++ b/src/test/java/net/kemitix/text/fit/TextLineWrapTest.java @@ -130,7 +130,7 @@ public class TextLineWrapTest private List boxes = new ArrayList<>(); - private List> invoke(String in) { + private List> wrap(String in) { return textLineWrap.wrap(in, font, graphics2D, boxes); } @@ -146,13 +146,13 @@ public class TextLineWrapTest @Test @DisplayName("Empty String give empty List") public void emptyStringEmptyList() { - assertThat(invoke("")).containsExactly(Collections.emptyList()); + assertThat(wrap("")).containsExactly(Collections.emptyList()); } @Test @DisplayName("Short string fits on one line") public void shortStringOnOneLine() { - assertThat(invoke("x")) + assertThat(wrap("x")) .containsExactly(Collections.singletonList("x")); } @@ -160,7 +160,7 @@ public class TextLineWrapTest @DisplayName("Fits max 'words' per line on one line") public void fitMaxWordsOneLine() { String input = words(wordsPerLine, WORD); - assertThat(invoke(input)) + assertThat(wrap(input)) .containsExactly(Collections.singletonList(input)); } @@ -168,7 +168,7 @@ public class TextLineWrapTest @DisplayName("Wraps just over max 'words' per line onto two lines") public void wrapOneWordTooManyOntoTwoLines() { String input = words(wordsPerLine + 1, WORD); - assertThat(invoke(input)).containsExactly(Arrays.asList( + assertThat(wrap(input)).containsExactly(Arrays.asList( words(wordsPerLine, WORD), WORD)); } @@ -178,7 +178,7 @@ public class TextLineWrapTest public void longerStringOnThreeLines() { String input = words(wordsPerLine + wordsPerLine + 1, WORD); String oneLinesWorthOfWords = words(wordsPerLine, WORD); - assertThat(invoke(input)).containsExactly(Arrays.asList( + assertThat(wrap(input)).containsExactly(Arrays.asList( oneLinesWorthOfWords, oneLinesWorthOfWords, WORD)); @@ -189,7 +189,7 @@ public class TextLineWrapTest public void textFillsBox() { String lineOfWords = words(wordsPerLine, WORD); String words = words(linesPerBox, lineOfWords); - assertThat(invoke(words).get(0)) + assertThat(wrap(words).get(0)) .hasSize(linesPerBox) .allSatisfy(line -> assertThat(line).isEqualTo(lineOfWords)); @@ -220,7 +220,7 @@ public class TextLineWrapTest @Test @DisplayName("Empty String give empty List") public void emptyStringEmptyList() { - assertThat(invoke("")).containsExactly( + assertThat(wrap("")).containsExactly( Collections.emptyList(), Collections.emptyList()); } @@ -228,7 +228,7 @@ public class TextLineWrapTest @Test @DisplayName("Short string fits on one line") public void shortStringOnOneLine() { - assertThat(invoke("x")) + assertThat(wrap("x")) .containsExactly( Collections.singletonList("x"), Collections.emptyList()); @@ -238,7 +238,7 @@ public class TextLineWrapTest @DisplayName("Fits max 'words' per line on one line") public void fitMaxWordsOneLine() { String input = words(wordsPerLine, WORD); - assertThat(invoke(input)) + assertThat(wrap(input)) .containsExactly( Collections.singletonList(input), Collections.emptyList() ); @@ -248,7 +248,7 @@ public class TextLineWrapTest @DisplayName("Wraps just over max 'words' per line onto two lines") public void wrapOneWordTooManyOntoTwoLines() { String input = words(wordsPerLine + 1, WORD); - assertThat(invoke(input)).containsExactly(Arrays.asList( + assertThat(wrap(input)).containsExactly(Arrays.asList( words(wordsPerLine, WORD), WORD), Collections.emptyList()); @@ -259,7 +259,7 @@ public class TextLineWrapTest public void longerStringOnThreeLines() { String input = words(wordsPerLine + wordsPerLine + 1, WORD); String oneLinesWorthOfWords = words(wordsPerLine, WORD); - assertThat(invoke(input)).containsExactly(Arrays.asList( + assertThat(wrap(input)).containsExactly(Arrays.asList( oneLinesWorthOfWords, oneLinesWorthOfWords, WORD), @@ -271,7 +271,7 @@ public class TextLineWrapTest public void fitMaxLinesInFirstBox() { String oneLinesWorthOfWords = words(wordsPerLine, WORD); String input = words(linesPerBox, oneLinesWorthOfWords); - List> result = invoke(input); + List> result = wrap(input); List linesBoxOne = result.get(0); assertThat(linesBoxOne) .hasSize(linesPerBox) @@ -285,7 +285,7 @@ public class TextLineWrapTest public void overflowMaxPlusOneLinesIntoSecondBox() { String oneLinesWorthOfWords = words(wordsPerLine, WORD); String input = words(linesPerBox + 1, oneLinesWorthOfWords); - List> result = invoke(input); + List> result = wrap(input); List linesBoxOne = result.get(0); assertThat(linesBoxOne) .hasSize(linesPerBox)