public void testFileEditor() { final ParamProperties properties = new ParamProperties(File.class); properties.setLabel(LABEL_NAME); properties.setPhysicalUnit(UNIT_NAME); properties.setDefaultValue(new File("sabines_home")); final Parameter parameter = new Parameter(PARAM_NAME, properties); ParamEditor editor = parameter.getEditor(); assertTrue(editor instanceof FileEditor); final FileEditor fileEditor = (FileEditor) editor; final JComponent editorComponent = fileEditor.getEditorComponent(); assertEquals("theParamName.XEditor", editorComponent.getName()); assertEquals(JPanel.class.getName(), editorComponent.getClass().getSuperclass().getName()); final Component[] components = editorComponent.getComponents(); assertEquals(2, components.length); assertEquals("theParamName.Editor", components[0].getName()); assertEquals("theParamName.ButtonPanel", components[1].getName()); assertEquals(JTextField.class.getName(), components[0].getClass().getName()); assertEquals(JPanel.class.getName(), components[1].getClass().getName()); final JPanel buttonPanel = ((JPanel) components[1]); assertEquals(1, buttonPanel.getComponentCount()); assertEquals(JButton.class.getName(), buttonPanel.getComponents()[0].getClass().getName()); assertEquals("theParamName.Label", fileEditor.getLabelComponent().getName()); assertEquals(LABEL_NAME + ": ", fileEditor.getLabelComponent().getText()); assertEquals("theParamName.Unit", fileEditor.getPhysUnitLabelComponent().getName()); assertEquals(" " + UNIT_NAME, fileEditor.getPhysUnitLabelComponent().getText()); }