I have a method to test which accept the issue, so i need to create a issue from with junit.I use the code below.
but ComponentAccessor.getIssueFactory() always return NULL with i run the test case.
How do i fix this.
MutableIssue issueObject;
IssueFactory issueFactory = ComponentAccessor.getIssueFactory();
ProjectManager projectManager = ComponentAccessor.getProjectManager();
ConstantsManager constantsManager = ComponentAccessor.getConstantsManager();
VersionManager versionManager = ComponentAccessor.getVersionManager();
issueObject = issueFactory.getIssue();
issueObject.setProject(projectManager.getProject(new Long(10200)));
issueObject.setIssueType(constantsManager.getIssueType("1"));
issueObject.setSummary("Test Issue");
issueObject.setReporter(UserUtils.getUser("admin"));
issueObject.setAssignee(UserUtils.getUser("admin"));
issueObject.setPriorityId(constantsManager.getPriorityName("1"));
issueObject.setDescription("Test description");
issueObject.setAffectedVersions(EasyList.build(versionManager.getVersion(new Long(10000)), versionManager.getVersion(new Long(10001))));
issueObject.setFixVersions(EasyList.build(versionManager.getVersion(new Long(10002))));
issueObject.setComponents(EasyList.build(projectManager.getComponent(new Long(10000)), projectManager.getComponent(new Long(10001))));
ComponentAccessor can be used only within the container, and will not work if you run a test like a normal JUnit test. You've got two options
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.