mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-87409 Issue tracker settings - {number} placeholder doesn't work properly
This commit is contained in:
@@ -107,13 +107,13 @@ public abstract class Task {
|
||||
|
||||
@Nullable
|
||||
public String getNumber() {
|
||||
String[] split = getId().split("\\-");
|
||||
return split.length > 1 ? split[1] : null;
|
||||
int i = getId().lastIndexOf('-');
|
||||
return i > 0 ? getId().substring(i + 1) : getId();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getProject() {
|
||||
String[] split = getId().split("\\-");
|
||||
return split.length > 1 ? split[0] : null;
|
||||
int i = getId().lastIndexOf('-');
|
||||
return i > 0 ? getId().substring(0, i) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,37 @@ public class TaskVcsTest extends TaskManagerTestCase {
|
||||
assertNotNull(associatedTask); // association should survive
|
||||
}
|
||||
|
||||
public void testProjectWithDash() throws Exception {
|
||||
LocalTaskImpl task = new LocalTaskImpl("foo-bar-001", "summary") {
|
||||
@Override
|
||||
public TaskRepository getRepository() {
|
||||
return myRepository;
|
||||
}
|
||||
};
|
||||
assertEquals("foo-bar", task.getProject());
|
||||
assertEquals("001", task.getNumber());
|
||||
String name = myManager.getChangelistName(task);
|
||||
assertEquals("foo-bar-001 summary", name);
|
||||
}
|
||||
|
||||
public void testIds() throws Exception {
|
||||
LocalTaskImpl task = new LocalTaskImpl("", "");
|
||||
assertEquals("", task.getNumber());
|
||||
assertEquals(null, task.getProject());
|
||||
|
||||
task = new LocalTaskImpl("-", "");
|
||||
assertEquals("-", task.getNumber());
|
||||
assertEquals(null, task.getProject());
|
||||
|
||||
task = new LocalTaskImpl("foo", "");
|
||||
assertEquals("foo", task.getNumber());
|
||||
assertEquals(null, task.getProject());
|
||||
|
||||
task = new LocalTaskImpl("112", "");
|
||||
assertEquals("112", task.getNumber());
|
||||
assertEquals(null, task.getProject());
|
||||
}
|
||||
|
||||
private void createChangelist(LocalTask localTask) throws InterruptedException {
|
||||
clearChangeLists();
|
||||
if (localTask.isActive()) {
|
||||
|
||||
Reference in New Issue
Block a user