diff --git a/RSTAUI/src/main/java/org/fife/rsta/ui/TextFilePropertiesDialog.java b/RSTAUI/src/main/java/org/fife/rsta/ui/TextFilePropertiesDialog.java index 260c2bc..41814fd 100644 --- a/RSTAUI/src/main/java/org/fife/rsta/ui/TextFilePropertiesDialog.java +++ b/RSTAUI/src/main/java/org/fife/rsta/ui/TextFilePropertiesDialog.java @@ -199,8 +199,7 @@ protected Container createButtonFooter(JButton ok, JButton cancel) { * @return The title for this dialog. */ protected String createTitle(String fileName) { - return MessageFormat.format( - MSG.getString("Title"), textArea.getFileName()); + return MessageFormat.format(MSG.getString("Title"), fileName); } diff --git a/RSTAUI/src/main/java/org/fife/rsta/ui/search/FindToolBar.java b/RSTAUI/src/main/java/org/fife/rsta/ui/search/FindToolBar.java index 4ca0b85..1ef5c29 100644 --- a/RSTAUI/src/main/java/org/fife/rsta/ui/search/FindToolBar.java +++ b/RSTAUI/src/main/java/org/fife/rsta/ui/search/FindToolBar.java @@ -68,7 +68,6 @@ public class FindToolBar extends JPanel { protected JCheckBox regexCheckBox; protected JCheckBox markAllCheckBox; protected JCheckBox wrapCheckBox; - private JLabel infoLabel; private Timer markAllTimer; /** diff --git a/RSTAUI/src/test/java/org/fife/rsta/ui/MaxWidthComboBoxTest.java b/RSTAUI/src/test/java/org/fife/rsta/ui/MaxWidthComboBoxTest.java index 72edc65..aa2527b 100644 --- a/RSTAUI/src/test/java/org/fife/rsta/ui/MaxWidthComboBoxTest.java +++ b/RSTAUI/src/test/java/org/fife/rsta/ui/MaxWidthComboBoxTest.java @@ -1,6 +1,5 @@ package org.fife.rsta.ui; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -50,6 +49,6 @@ void testGetMinimumSize() { void testGetPreferredSize() { comboBox = new MaxWidthComboBox<>(100); Dimension prefSize = comboBox.getPreferredSize(); - assertNotEquals(00, prefSize.width); + assertNotEquals(0, prefSize.width); } } diff --git a/RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java b/RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java index 453d260..e14b248 100644 --- a/RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java +++ b/RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java @@ -29,9 +29,7 @@ class TextFilePropertiesDialogTest { private TextEditorPane textArea; private static String createContent(int size) { - StringBuilder sb = new StringBuilder(); - sb.append("a".repeat(Math.max(0, size))); - return sb.toString(); + return "a".repeat(Math.max(0, size)); } @BeforeEach diff --git a/RSTAUI/src/test/java/org/fife/rsta/ui/UIUtilTest.java b/RSTAUI/src/test/java/org/fife/rsta/ui/UIUtilTest.java index 5a67ed0..13ba671 100644 --- a/RSTAUI/src/test/java/org/fife/rsta/ui/UIUtilTest.java +++ b/RSTAUI/src/test/java/org/fife/rsta/ui/UIUtilTest.java @@ -165,7 +165,7 @@ void testGetDescendantsOfType_topLevelMatch() { JLabel label = new JLabel(); List result = UIUtil.getDescendantsOfType(label, JLabel.class); Assertions.assertEquals(1, result.size()); - Assertions.assertEquals(label, result.get(0)); + Assertions.assertEquals(label, result.getFirst()); } @Test @@ -175,7 +175,7 @@ void testGetDescendantsOfType_nestedMatch() { panel.add(label); List result = UIUtil.getDescendantsOfType(panel, JLabel.class); Assertions.assertEquals(1, result.size()); - Assertions.assertEquals(label, result.get(0)); + Assertions.assertEquals(label, result.getFirst()); } @Test @@ -187,7 +187,7 @@ void testGetDescendantsOfType_nestedTwoDeepMatch() { nestedPanel.add(label); List result = UIUtil.getDescendantsOfType(panel, JLabel.class); Assertions.assertEquals(1, result.size()); - Assertions.assertEquals(label, result.get(0)); + Assertions.assertEquals(label, result.getFirst()); } @Test @@ -197,7 +197,7 @@ void testGetDescendantsOfType_subclass() { panel.add(label); List result = UIUtil.getDescendantsOfType(panel, JLabel.class); Assertions.assertEquals(1, result.size()); - Assertions.assertEquals(label, result.get(0)); + Assertions.assertEquals(label, result.getFirst()); } @Test @@ -300,9 +300,7 @@ void testMakeSpringCompactGrid_happyPath_components() { for (int i = 0; i < 6; i++) { panel.add(new JLabel()); } - Assertions.assertDoesNotThrow(() -> { - UIUtil.makeSpringCompactGrid(panel, 2, 2, 0, 0, 0, 0); - }); + Assertions.assertDoesNotThrow(() -> UIUtil.makeSpringCompactGrid(panel, 2, 2, 0, 0, 0, 0)); } @Test diff --git a/RSTAUI/src/test/java/org/fife/rsta/ui/search/FindToolBarTest.java b/RSTAUI/src/test/java/org/fife/rsta/ui/search/FindToolBarTest.java index f2d347b..67bc100 100644 --- a/RSTAUI/src/test/java/org/fife/rsta/ui/search/FindToolBarTest.java +++ b/RSTAUI/src/test/java/org/fife/rsta/ui/search/FindToolBarTest.java @@ -48,13 +48,13 @@ void testRemoveSearchListener() { @Test void testDoMarkAll_delay() { toolBar.doMarkAll(true); - assertEquals(0, listener.events.size());; + assertEquals(0, listener.events.size()); } @Test void testDoMarkAll_noDelay() { toolBar.doMarkAll(false); - assertEquals(1, listener.events.size());; + assertEquals(1, listener.events.size()); } @Test @@ -139,14 +139,14 @@ void testRequestFocusInWindow() { void testHandleSearchAction_findNext() { ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindNext"); toolBar.handleSearchAction(event); - assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); + assertEquals(SearchEvent.Type.FIND, listener.events.getFirst().getType()); } @Test void testHandleSearchAction_findPrevious() { ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindPrevious"); toolBar.handleSearchAction(event); - assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); + assertEquals(SearchEvent.Type.FIND, listener.events.getFirst().getType()); } @Test diff --git a/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceDialogTest.java b/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceDialogTest.java index 2d6a8a3..5a9b437 100644 --- a/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceDialogTest.java +++ b/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceDialogTest.java @@ -68,7 +68,7 @@ void testActionPerformed_find() { ActionEvent e = new ActionEvent(dialog, 0, SearchEvent.Type.FIND.name()); dialog.actionPerformed(e); assertEquals(1, listener.events.size()); - SearchEvent se = listener.events.get(0); + SearchEvent se = listener.events.getFirst(); assertEquals(SearchEvent.Type.FIND, se.getType()); SearchContext sc = se.getSearchContext(); assertEquals("searchFor", sc.getSearchFor()); @@ -81,7 +81,7 @@ void testActionPerformed_replace_noReplaceText() { ActionEvent e = new ActionEvent(dialog, 0, SearchEvent.Type.REPLACE.name()); dialog.actionPerformed(e); assertEquals(1, listener.events.size()); - SearchEvent se = listener.events.get(0); + SearchEvent se = listener.events.getFirst(); assertEquals(SearchEvent.Type.REPLACE, se.getType()); SearchContext sc = se.getSearchContext(); assertEquals("searchFor", sc.getSearchFor()); @@ -97,7 +97,7 @@ void testActionPerformed_replace_withReplaceText() { ActionEvent e = new ActionEvent(dialog, 0, SearchEvent.Type.REPLACE.name()); dialog.actionPerformed(e); assertEquals(1, listener.events.size()); - SearchEvent se = listener.events.get(0); + SearchEvent se = listener.events.getFirst(); assertEquals(SearchEvent.Type.REPLACE, se.getType()); SearchContext sc = se.getSearchContext(); assertEquals("searchFor", sc.getSearchFor()); @@ -122,7 +122,7 @@ void testActionPerformed_replaceAll_noReplaceText() { ActionEvent e = new ActionEvent(dialog, 0, SearchEvent.Type.REPLACE_ALL.name()); dialog.actionPerformed(e); assertEquals(1, listener.events.size()); - SearchEvent se = listener.events.get(0); + SearchEvent se = listener.events.getFirst(); assertEquals(SearchEvent.Type.REPLACE_ALL, se.getType()); SearchContext sc = se.getSearchContext(); assertEquals("searchFor", sc.getSearchFor()); @@ -137,7 +137,7 @@ void testActionPerformed_replace_withReplaceAllText() { ActionEvent e = new ActionEvent(dialog, 0, SearchEvent.Type.REPLACE_ALL.name()); dialog.actionPerformed(e); assertEquals(1, listener.events.size()); - SearchEvent se = listener.events.get(0); + SearchEvent se = listener.events.getFirst(); assertEquals(SearchEvent.Type.REPLACE_ALL, se.getType()); SearchContext sc = se.getSearchContext(); assertEquals("searchFor", sc.getSearchFor()); diff --git a/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceToolBarTest.java b/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceToolBarTest.java index 3280b65..4ea8264 100644 --- a/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceToolBarTest.java +++ b/RSTAUI/src/test/java/org/fife/rsta/ui/search/ReplaceToolBarTest.java @@ -86,28 +86,28 @@ void testGetSetReplaceText() { void testHandleSearchAction_findNext() { ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindNext"); toolBar.handleSearchAction(event); - assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); + assertEquals(SearchEvent.Type.FIND, listener.events.getFirst().getType()); } @Test void testHandleSearchAction_findPrevious() { ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindPrevious"); toolBar.handleSearchAction(event); - assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); + assertEquals(SearchEvent.Type.FIND, listener.events.getFirst().getType()); } @Test void testHandleSearchAction_replace() { ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "Replace"); toolBar.handleSearchAction(event); - assertEquals(SearchEvent.Type.REPLACE, listener.events.get(0).getType()); + assertEquals(SearchEvent.Type.REPLACE, listener.events.getFirst().getType()); } @Test void testHandleSearchAction_replaceAll() { ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "ReplaceAll"); toolBar.handleSearchAction(event); - assertEquals(SearchEvent.Type.REPLACE_ALL, listener.events.get(0).getType()); + assertEquals(SearchEvent.Type.REPLACE_ALL, listener.events.getFirst().getType()); } @Test @@ -133,7 +133,7 @@ void testHandleRegExCheckBoxClicked() { void testHandleSearchAction() { ActionEvent event = new ActionEvent(toolBar.findButton, ActionEvent.ACTION_PERFORMED, "FindNext"); toolBar.handleSearchAction(event); - assertEquals(SearchEvent.Type.FIND, listener.events.get(0).getType()); + assertEquals(SearchEvent.Type.FIND, listener.events.getFirst().getType()); } @Test diff --git a/RSTAUI/src/test/java/org/fife/rsta/ui/search/SearchComboBoxTest.java b/RSTAUI/src/test/java/org/fife/rsta/ui/search/SearchComboBoxTest.java index dabd5f7..b2bf62f 100644 --- a/RSTAUI/src/test/java/org/fife/rsta/ui/search/SearchComboBoxTest.java +++ b/RSTAUI/src/test/java/org/fife/rsta/ui/search/SearchComboBoxTest.java @@ -32,7 +32,7 @@ void testAddItem_existingItem_moveToTopOfList() { List items = comboBox.getSearchStrings(); Assertions.assertEquals(3, items.size()); Assertions.assertEquals("222", comboBox.getSelectedItem()); - Assertions.assertEquals("222", items.get(0)); + Assertions.assertEquals("222", items.getFirst()); } @Test @@ -45,7 +45,7 @@ void testAddItem_existingItem_firstItem_orderNotChanged() { List items = comboBox.getSearchStrings(); Assertions.assertEquals(3, items.size()); Assertions.assertEquals("111", comboBox.getSelectedItem()); - Assertions.assertEquals("111", items.get(0)); + Assertions.assertEquals("111", items.getFirst()); } @Test @@ -54,7 +54,7 @@ void testGetSearchStrings_noSelectedIndex_addsTextInTextComponent() { UIUtil.getTextComponent(comboBox).setText("foo"); List items = comboBox.getSearchStrings(); Assertions.assertEquals(1, items.size()); - Assertions.assertEquals("foo", items.get(0)); + Assertions.assertEquals("foo", items.getFirst()); } @Test