@Test public void testNullIssue() { IssueKeyIndexer indexer = new IssueKeyIndexer(null); Document doc = new Document(); indexer.addIndex(doc, null); assertTrue(doc.getFields().isEmpty()); }
@Test public void testNoNumberWithDash() { Issue issue = getMockIssue("NICK-"); IssueKeyIndexer indexer = new IssueKeyIndexer(null); Document doc = new Document(); indexer.addIndex(doc, issue); assertEquals("NICK-", doc.get(DocumentConstants.ISSUE_KEY)); assertEquals("nick-", doc.get(DocumentConstants.ISSUE_KEY_FOLDED)); assertEquals(null, doc.get(DocumentConstants.ISSUE_KEY_NUM_PART)); assertNull(doc.get(DocumentConstants.ISSUE_KEY_NUM_PART_RANGE)); }
@Test public void testGoodKey() { Issue issue = getMockIssue("NICK-1234"); IssueKeyIndexer indexer = new IssueKeyIndexer(null); Document doc = new Document(); indexer.addIndex(doc, issue); assertEquals("NICK-1234", doc.get(DocumentConstants.ISSUE_KEY)); assertEquals("nick-1234", doc.get(DocumentConstants.ISSUE_KEY_FOLDED)); assertEquals("1234", doc.get(DocumentConstants.ISSUE_KEY_NUM_PART)); // This is NumberTools.longToString(1234L). It is a base-36 padded number. assertEquals("000000000000ya", doc.get(DocumentConstants.ISSUE_KEY_NUM_PART_RANGE)); }