@Test public void testGetPasswordEncoder_ClassNotFound() throws Exception { config = new SpringSecurityHibernateConfig(document); Node node = mock(Node.class); when(node.getText()).thenReturn("org.pentaho.ClassNotFoundEncoder"); when(document.selectSingleNode(anyString())).thenReturn(node); PasswordEncoder passwordEncoder = config.getPasswordEncoder(); assertNull(passwordEncoder); }
@Test public void testGetPasswordEncoder() throws Exception { config = new SpringSecurityHibernateConfig(document); Node node = mock(Node.class); when(node.getText()).thenReturn(DefaultPentahoPasswordEncoder.class.getName()); when(document.selectSingleNode(anyString())).thenReturn(node); PasswordEncoder passwordEncoder = config.getPasswordEncoder(); assertTrue(passwordEncoder instanceof DefaultPentahoPasswordEncoder); }
@Test public void testConstructor_xmlString() throws Exception { config = new SpringSecurityHibernateConfig("<beans>no beans</beans>"); assertNotNull(config); assertNotNull(config.getDocument()); }
@Test public void testGetDocument() throws Exception { config = new SpringSecurityHibernateConfig(document); assertEquals(document, config.getDocument()); }