RowMapper rowMapper2 = new RowMapper() {
public int[] getRowsForPaths(TreePath[] path) {
return null;
}
};
TreeSelectionModel model1 = new DefaultTreeSelectionModel();
TreeSelectionModel model2 = new DefaultTreeSelectionModel();
RowMapper mapper = tree.getSelectionModel().getRowMapper();
tree.setSelectionModel(model1);
assertTrue(propertyChangeController.isChanged("selectionModel"));
assertEquals(model1, tree.getSelectionModel());
assertSame(mapper, tree.getSelectionModel().getRowMapper());
tree.setSelectionModel(model2);
assertEquals(model2, tree.getSelectionModel());
assertSame(mapper, tree.getSelectionModel().getRowMapper());
propertyChangeController.reset();
TreeSelectionModel oldModel = tree.getSelectionModel();
tree.setSelectionModel(null);
assertNotNull(tree.getSelectionModel());
assertTrue(tree.getSelectionModel() instanceof JTree.EmptySelectionModel);
assertSame(mapper, tree.getSelectionModel().getRowMapper());
assertTrue(propertyChangeController.isChanged("selectionModel"));
propertyChangeController.checkPropertyFired(tree, "selectionModel", oldModel, tree
.getSelectionModel());
TreeSelectionModel emptyModel = tree.getSelectionModel();
tree.setSelectionModel(model2);
tree.setSelectionModel(null);
assertSame(emptyModel, tree.getSelectionModel());
model1.setRowMapper(rowMapper1);
tree.setSelectionModel(model1);