@Test public void setAndGetCacheable() { MessageSourceMacroDescriptor desc = descriptor.cacheable(true); assertSame(descriptor, desc); assertTrue(descriptor.isCacheable()); descriptor.cacheable(false); assertFalse(descriptor.isCacheable()); }
@Before public void setUp() { MessageSourceMacroDescriptor desc = new MessageSourceMacroDescriptor(MACRO); Whitebox.setInternalState(desc, messageSource); when(beanFactory.getBean(MessageSourceMacroDescriptor.ID, MACRO)).thenReturn(desc); when(messageSource.getMessage( "macro." + MACRO + ".title", null, LOCALE)) // $NON-NLS-1$ //$NON-NLS-2$ .thenReturn(TITLE); when(messageSource.getMessage( "macro." + MACRO + ".description", null, LOCALE)) // $NON-NLS-1$ //$NON-NLS-2$ .thenReturn(DESCRIPTION); descriptor = MessageSourceMacroDescriptor.create(MACRO, beanFactory); }
@Test public void getDescription() { assertEquals(DESCRIPTION, descriptor.getDescription(LOCALE)); }
@Test public void getTitle() { assertEquals(TITLE, descriptor.getTitle(LOCALE)); }
@Test public void setAndGetInsertText() { MessageSourceMacroDescriptor desc = descriptor.insertText("insertText"); // $NON-NLS-1$ assertSame(descriptor, desc); assertEquals("insertText", descriptor.getInsertText()); // $NON-NLS-1$ }
@Test public void getMacroName() { assertEquals(MACRO, descriptor.getMacroName()); }