List of usage examples for java.lang IllegalArgumentException getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testConvertIfNotNull01() <br>//from ww w. j a v a 2 s . com * <br> * () <br> * G <br> * <br> * () obj:"object"<br> * () clazz:null<br> * <br> * () :IllegalArgumentException<br> * ?: "Argument 'clazz' (" + Object.class.getName() + ") is null"<br> * <br> * clazz?null?????IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testConvertIfNotNull01() throws Exception { // try { ConvertUtil.convertIfNotNull("object", null); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertEquals("Argument 'clazz' (" + Object.class.getName() + ") is null", e.getMessage()); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testToList01() <br>/*from w ww . j a v a 2s . co m*/ * <br> * () <br> * C,G <br> * <br> * () obj:null<br> * () elementClass:null<br> * <br> * () :IllegalArgumentException<br> * ?: "Argument 'elementClass' (" + Class.class.getName() + ") is null"<br> * <br> * elementClass?null?????IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testToList01() throws Exception { // try { ConvertUtil.toList(null, null); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertEquals("Argument 'elementClass' (" + Class.class.getName() + ") is null", e.getMessage()); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testConvertObjectClass01() <br> * <br>//from w w w. ja v a 2s . com * () <br> * G <br> * <br> * () obj:"object"<br> * () clazz:null<br> * <br> * () :IllegalArgumentException<br> * ?: "Argument 'clazz' (" + Object.class.getName() + ") is null"<br> * <br> * clazz?null?????IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testConvertObjectClass01() throws Exception { // try { ConvertUtil.convert("object", null); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertEquals("Argument 'clazz' (" + Object.class.getName() + ") is null", e.getMessage()); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testConvertObjectClassboolean01() <br> * <br>//from www . j ava 2 s.c om * () <br> * G <br> * <br> * () obj:null<br> * () clazz:null<br> * () allowsNull:true<br> * <br> * () :IllegalArgumentException<br> * ?: "Argument 'clazz' (" + Object.class.getName() + ") is null"<br> * <br> * clazz?null?????IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testConvertObjectClassboolean01() throws Exception { // try { ConvertUtil.convert(null, null, true); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertEquals("Argument 'clazz' (" + Object.class.getName() + ") is null", e.getMessage()); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testConvertObjectClassboolean07() <br> * <br>/*from w ww . jav a 2 s . c om*/ * () <br> * G <br> * <br> * () obj:"abc"<br> * () clazz:BigInteger.class<br> * () allowsNull:false<br> * <br> * () :IllegalArgumentException<br> * ??:ConversionException<br> * <br> * CnvertUtils#convert??????IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testConvertObjectClassboolean07() throws Exception { // try { ConvertUtil.convert("abc", BigInteger.class, false); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertTrue(e.getCause() instanceof ConversionException); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testConvertIfNotNull02() <br>//from w w w .j ava2s. c om * <br> * () <br> * C <br> * <br> * () obj:null<br> * () clazz:Object.class<br> * <br> * () :IllegalArgumentException<br> * ?: "Unable to cast 'null' to '" + clazz??? + "'"<br> * ??:ClassCastException<br> * ???: "Unable to cast 'null' to '" + clazz??? + "'"<br> * <br> * obj?null?????IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testConvertIfNotNull02() throws Exception { // try { ConvertUtil.convertIfNotNull(null, Object.class); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertEquals("Unable to cast 'null' to '" + Object.class.getName() + "'", e.getMessage()); assertEquals(ClassCastException.class.getName(), e.getCause().getClass().getName()); assertEquals("Unable to cast 'null' to '" + Object.class.getName() + "'", e.getCause().getMessage()); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testConvertObjectClassboolean02() <br> * <br>//ww w .ja v a 2 s .com * () <br> * G <br> * <br> * () obj:null<br> * () clazz:Object.class<br> * () allowsNull:false<br> * <br> * () :IllegalArgumentException<br> * ?: "Unable to cast 'null' to '" + clazz??? + "'"<br> * ??:ClassCastException<br> * ???: "Unable to cast 'null' to '" + clazz??? + "'"<br> * <br> * clazz?null??????obj?null?allowsNull?false????? IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testConvertObjectClassboolean02() throws Exception { // try { ConvertUtil.convert(null, Object.class, false); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertEquals("Unable to cast 'null' to '" + Object.class.getName() + "'", e.getMessage()); assertEquals(ClassCastException.class.getName(), e.getCause().getClass().getName()); assertEquals("Unable to cast 'null' to '" + Object.class.getName() + "'", e.getCause().getMessage()); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testToList06() <br>// www. ja v a 2s .co m * <br> * () <br> * G <br> * <br> * () obj:"list"<br> * () elementClass:Thread.class<br> * <br> * () :IllegalArgumentException<br> * ?: "Unable to cast '" + obj??? + "' to '" + elementClass??? + "'"<br> * ??:ClassCastException<br> * ???:"Unable to cast '" + obj??? + "' to '" + elementClass??? + "'"<br> * <br> * obj??elementClass???????????? ??????IllegalArgumentException?????? <br> * @throws Exception ????? */ @Test public void testToList06() throws Exception { // try { ConvertUtil.toList("list", Thread.class); fail("IllegalArgumentException???????"); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertEquals("Unable to cast '" + "list".getClass().getName() + "' to '" + Thread.class.getName() + "'", e.getMessage()); assertEquals(ClassCastException.class.getName(), e.getCause().getClass().getName()); assertEquals("Unable to cast '" + "list".getClass().getName() + "' to '" + Thread.class.getName() + "'", e.getCause().getMessage()); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testToListOfMap08() <br>//from w w w . j av a2 s . c o m * <br> * () <br> * G <br> * <br> * () obj:JavaBean<br> * A="value00"<br> * () PropertyUtils#describe??: InvocationTargetException JavaBean?getter?RuntimeException<br> * <br> * () :IllegalArgumentException<br> * ??InvocationTargetException<br> * <br> * PropertyUtils#descrive?InvocationTargetException????? <br> * @throws Exception ????? */ @Test public void testToListOfMap08() throws Exception { // ?? ConvertUtil_Stub02 obj = new ConvertUtil_Stub02(); obj.setA("value00"); try { // ConvertUtil.toListOfMap(obj); fail(); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertTrue(e.getCause() instanceof InvocationTargetException); } }
From source file:jp.terasoluna.fw.util.ConvertUtilTest.java
/** * testToListOfMap09() <br>/*from w ww. j a v a 2s . c o m*/ * <br> * () <br> * G <br> * <br> * () obj:JavaBean<br> * A="value00"<br> * () PropertyUtils#describe??: IllegalAccessException PropertyUtilsBean??IllegalAccessException<br> * <br> * () :IllegalArgumentException<br> * ??IllegalAccessException<br> * <br> * PropertyUtils#descrive?IllegalAccessException????? <br> * @throws Exception ????? */ @Test public void testToListOfMap09() throws Exception { // ?? List<ConvertUtil_Stub01> obj = new ArrayList<ConvertUtil_Stub01>(); ConvertUtil_Stub01 bean = new ConvertUtil_Stub01(); bean.setA("value00"); obj.add(bean); BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance(); ReflectionTestUtils.setField(beanUtilsBean, "propertyUtilsBean", new ConvertUtil_PropertyUtilsBeanStub01()); try { // ConvertUtil.toListOfMap(obj); fail(); } catch (IllegalArgumentException e) { // assertEquals(IllegalArgumentException.class.getName(), e.getClass().getName()); assertTrue(e.getCause() instanceof IllegalAccessException); } }