### Question:
ExternalSystemRecentTaskListModel extends DefaultListModel { @SuppressWarnings("unchecked") public void setFirst(@Nonnull ExternalTaskExecutionInfo task) { insertElementAt(task, 0); for (int i = 1; i < size(); i++) { if (task.equals(getElementAt(i))) { remove(i); break; } } ensureSize(ExternalSystemConstants.RECENT_TASKS_NUMBER); } ExternalSystemRecentTaskListModel(@Nonnull ProjectSystemId externalSystemId, @Nonnull Project project); @SuppressWarnings("unchecked") void setTasks(@Nonnull List<ExternalTaskExecutionInfo> tasks); @SuppressWarnings("unchecked") void setFirst(@Nonnull ExternalTaskExecutionInfo task); @Nonnull List<ExternalTaskExecutionInfo> getTasks(); @SuppressWarnings("unchecked") void ensureSize(int elementsNumber); void forgetTasksFrom(@Nonnull String externalProjectPath);  }### Answer:
@Test public void testSetFirst() throws Exception { List<ExternalTaskExecutionInfo> tasks = ContainerUtilRt.newArrayList(); for (int i = 0; i <= ExternalSystemConstants.RECENT_TASKS_NUMBER; i++) { new ExternalTaskExecutionInfo(new ExternalSystemTaskExecutionSettings(), "task" + i); } myModel.setTasks(tasks); myModel.setFirst(new ExternalTaskExecutionInfo(new ExternalSystemTaskExecutionSettings(), "newTask")); Assert.assertEquals(ExternalSystemConstants.RECENT_TASKS_NUMBER, myModel.getSize()); myModel.setFirst(new ExternalTaskExecutionInfo(new ExternalSystemTaskExecutionSettings(), "task1")); Assert.assertEquals(ExternalSystemConstants.RECENT_TASKS_NUMBER, myModel.getSize()); }