Org.springframework.util.AssertAssert translated to Chinese as "assertion". You should know this concept by using JUnit. It is to determine that an actual value is what you expect, and if not, throw an exception. Assert is often used to: 1. Determine whether the parameter of the method is of normal value. Used in 2.JUNIT. I found a bug in SPRING1.2.6, please see:
in Org.springframework.core.io.support.EncodedResource Public Encodedresource (Resource Resource, String encoding) { assert.notnull ("Resource is required"); this. Resource = resource; this. Encoding = encoding;}
Assert.notnull ("Resource is required");
This sentence should be for
Assert.notnull (Resource, "resource is required");
Otherwise resource didn't pass over, also broken what say Ah, hehe. ------------------------------------------------------------------------above is seen on the internet, but I entered spring inside to look at the source code, as follows:
/*** Assert that a object is not <code>null</code>. * <pre class= "code" >assert.notnull (Clazz, "the CLA SS must not is null "); </pre>*@paramobject The object to check*@parammessage The exception message to use if the assertion fails*@throwsIllegalArgumentException If the object is <code>null</code>*/ Public Static voidNotnull (Object object, String message) {if(Object = =NULL) {Throw Newillegalargumentexception (message); }}
The function means that the incoming object must not be empty. Throws an exception if it is empty. Transferred from: http://jack-chen10.blog.163.com/blog/static/6775128201348545984/
Spring Source of-assert.notnull