SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
1.0 KiB

package de.superx.spring.service;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import de.superx.TestApplicationConfigPg;
import de.superx.jdbc.repository.MaskStatisticRepository;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = TestApplicationConfigPg.class)
public class BeanUtilTest {
@SuppressWarnings("static-method")
@Test
public void testActualBean() {
MaskStatisticRepository repo = null;
try {
repo = BeanUtil.getBean(MaskStatisticRepository.class);
}catch(NoSuchBeanDefinitionException e) {/**/}
assertNotNull(repo);
}
@SuppressWarnings({ "static-method", "unused" })
@Test
public void testNoBean() {
assertThrows(NoSuchBeanDefinitionException.class, () -> {
String s = BeanUtil.getBean(String.class);
});
}
}