Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public class FindToolBar extends JPanel {
protected JCheckBox regexCheckBox;
protected JCheckBox markAllCheckBox;
protected JCheckBox wrapCheckBox;
private JLabel infoLabel;
private Timer markAllTimer;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -50,6 +49,6 @@ void testGetMinimumSize() {
void testGetPreferredSize() {
comboBox = new MaxWidthComboBox<>(100);
Dimension prefSize = comboBox.getPreferredSize();
assertNotEquals(00, prefSize.width);
assertNotEquals(0, prefSize.width);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
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
Expand Down Expand Up @@ -72,7 +70,7 @@
void testConstructor_rtl() {
Locale origDefault = Locale.getDefault();
try {
Locale.setDefault(new Locale("ar", "SA"));

Check warning on line 73 in RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java

View workflow job for this annotation

GitHub Actions / build (25)

[deprecation] Locale(String,String) in Locale has been deprecated

Check warning on line 73 in RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java

View workflow job for this annotation

GitHub Actions / build (26)

[deprecation] Locale(String,String) in Locale has been deprecated

Check warning on line 73 in RSTAUI/src/test/java/org/fife/rsta/ui/TextFilePropertiesDialogTest.java

View workflow job for this annotation

GitHub Actions / Analyze (java)

[deprecation] Locale(String,String) in Locale has been deprecated
assertDoesNotThrow(() -> new TextFilePropertiesDialog((Frame) null, textArea));
} finally {
Locale.setDefault(origDefault);
Expand Down
12 changes: 5 additions & 7 deletions RSTAUI/src/test/java/org/fife/rsta/ui/UIUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void testGetDescendantsOfType_topLevelMatch() {
JLabel label = new JLabel();
List<JLabel> result = UIUtil.getDescendantsOfType(label, JLabel.class);
Assertions.assertEquals(1, result.size());
Assertions.assertEquals(label, result.get(0));
Assertions.assertEquals(label, result.getFirst());
}

@Test
Expand All @@ -175,7 +175,7 @@ void testGetDescendantsOfType_nestedMatch() {
panel.add(label);
List<JLabel> result = UIUtil.getDescendantsOfType(panel, JLabel.class);
Assertions.assertEquals(1, result.size());
Assertions.assertEquals(label, result.get(0));
Assertions.assertEquals(label, result.getFirst());
}

@Test
Expand All @@ -187,7 +187,7 @@ void testGetDescendantsOfType_nestedTwoDeepMatch() {
nestedPanel.add(label);
List<JLabel> result = UIUtil.getDescendantsOfType(panel, JLabel.class);
Assertions.assertEquals(1, result.size());
Assertions.assertEquals(label, result.get(0));
Assertions.assertEquals(label, result.getFirst());
}

@Test
Expand All @@ -197,7 +197,7 @@ void testGetDescendantsOfType_subclass() {
panel.add(label);
List<JLabel> result = UIUtil.getDescendantsOfType(panel, JLabel.class);
Assertions.assertEquals(1, result.size());
Assertions.assertEquals(label, result.get(0));
Assertions.assertEquals(label, result.getFirst());
}

@Test
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void testAddItem_existingItem_moveToTopOfList() {
List<String> 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
Expand All @@ -45,7 +45,7 @@ void testAddItem_existingItem_firstItem_orderNotChanged() {
List<String> 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
Expand All @@ -54,7 +54,7 @@ void testGetSearchStrings_noSelectedIndex_addsTextInTextComponent() {
UIUtil.getTextComponent(comboBox).setText("foo");
List<String> items = comboBox.getSearchStrings();
Assertions.assertEquals(1, items.size());
Assertions.assertEquals("foo", items.get(0));
Assertions.assertEquals("foo", items.getFirst());
}

@Test
Expand Down
Loading