| com.ibm.emb.junit.EMBTestCaseBase com.ibm.emb.test.MediaTest
All known Subclasses: com.ibm.emb.test.MediaBeanTest,
MediaTest | abstract public class MediaTest extends EMBTestCaseBase (Code) | |
Line Item: MFB API
Subcategory 1: javax.emb
Subcategory 2: Media
This abstract class provides test methods for all methods described in the interface
Media. For testing implementations of this interface one needs to create a Tester
class which extends this interface and provide create methods for the concrete
implementers of the Media interface
|
MediaTest | public MediaTest(String name) throws MediaException(Code) | | |
createMedia | abstract public Media createMedia(File inputFile, String mimeType) throws MediaException(Code) | | abstract method to create an instance of Media this method needs to be
implemented in the test subclass and will create an instance of the
concrete implementation of the class under test
|
stdSuite | public static Test stdSuite(String TestCaseImplementor)(Code) | | stdSuite method of this test class instantiates all tests necesssary to
for the standard compliance tests
Parameters: String - complete class Name of the implementor of the abstract test |
testEMB001 | public void testEMB001()(Code) | |
Testcase Name: MIME_TYPE_UNKNOWN
Testcase Number: EMB001
setup:
test procedure:
1.query value of constant
expected result: "www/unknown"
|
testEMB002 | public void testEMB002() throws IOException, MediaException(Code) | |
Testcase Name: getContent()
Testcase Number: EMB002
setup:
test procedure:
1.rebind("test", new GenericMediaFormat), create file of maxMediaSize and fill with random content
create MediaBean by using file constructor, call getContent()
expected result: ContentTooLargeException
2.create small file, call getContent(), compare content with file content
expected result: content and file content are equal
|
testEMB003 | public void testEMB003() throws IOException, MediaException(Code) | |
Testcase Name: getFormat()
Testcase Number: EMB003
setup:
test procedure:
1.rebind("jpg", new JpegFormat()), create random content file with name test.jpg
create MediaBean from file, run getFormat()
expected result: not null and instance of JpegFormat
2.unbind("xxx") catch FormatNotFoundException
create random content file with name test.xxx, create MediaBean from file, run getFormat()
expected result: FormatNotFoundException
|
testEMB004 | public void testEMB004() throws IOException, MediaException(Code) | |
Testcase Name: getHeader()
Testcase Number: EMB004
setup:
test procedure:
1.rebind("jpg",new JpegFormat()), create file from JPEG image file with name test.jpg
create MediaBean from file, run getHeader()
expected result: return value not null and equals getFormat().extractHeader()
2.unbind("xxx") catch FormatNotFoundException
create random content file with name test.xxx, create MediaBean from file, run getHeader()
expected result: FormatNotFoundException is thrown
3.create file from random content, run getHeader()
expected result: FormatSyntaxException
4.use static byte array to create BMP file (contains unsupported version) and run getHeader()
expected result: MediaFormatException
|
testEMB005 | public void testEMB005() throws IOException, MediaException(Code) | |
Testcase Name: getMimeType()
Testcase Number: EMB005
setup:
test procedure:
1.rebind("jpg", new JpegFormat())
create random content file with name test.jpg, create MediaBean from file with mimetype null, run getMimeType()
expected result: result equals getFormat().getDefaultMimeType()
2.create random content file with name test.jpg, create MediaBean from file with mimetype "test", run getMimeType()
expected result: result is "test"
3.create random content file with name test.xxx and create MediaBean from file with null mimetype, run getMimeType()
expected result: FormatNotFoundException
|
testEMB006 | public void testEMB006() throws IOException, MediaException(Code) | |
Testcase Name: getName()
Testcase Number: EMB006
setup:
test procedure:
1.rebind("jpg", new JpegFormat()), create random content file with name test.jpg, create MediaBean from file with mimetype null, run getName()
expected result: result is not null and contains a '.'
2.create MediaBean from InputStream with null mimetype and random name, call getName
expected result: name matches original name
|
testEMB007 | public void testEMB007() throws MediaException, IOException(Code) | |
Testcase Name: getProxy()
Testcase Number: EMB007
setup:
test procedure:
1.create random content file with name test.jpg, create MediaBean from file, call getProxy()
expected result: not null
|
testEMB008 | public void testEMB008() throws IOException, MediaException, Exception(Code) | |
Testcase Name: getSize()
Testcase Number: EMB008
setup:
test procedure:
1.create random content file with name test.jpg and content size 1024, create MediaBean from file, run getSize()
expected result: result is 1024
|
testEMB009 | public void testEMB009() throws IOException, MediaException, Exception(Code) | |
Testcase Name: readContent(long position, byte[] buffer)
Testcase Number: EMB009
setup: create file (1024 byte), rebind("test", new GenericMediaFormat()), create MediaBean
create byte array buffer of size 1024 bytes
test procedure:
1.call readContent(-1,testBuffer)
expected result: IndexOutOfBoundsException
2.call readContent(1025,testBuffer)
expected result: IndexOutOfBoundsException
3.call readContent(0,null)
expected result: NullPointerException
4.call readContent(10,testBuffer) with buffer size 100 bytes
compare to media content offset 10, length of return value
expected result: same content
5.call readContent(1024,testBuffer)
expected result: -1 returned with empty buffer
6.create testInstance from nonexistent file and call readContent(0,buffer)
expected result: ContentAccessException
7.create testInstance of size 100 bytes and buffer of size 1024 bytes
call readContent(0,testBuffer) and compare content of media and buffer
expected result: buffer partially filled (return value is the length)
|
testEMB010 | public void testEMB010() throws IOException, MediaException, Exception(Code) | |
Testcase Name: readContent(long position, byte[] buffer, int offset, int length)
Testcase Number: EMB010
setup: create file (1024 byte), rebind("test", new GenericMediaFormat()), create MediaBean
create byte array buffer of size 1024 bytes
test procedure:
1.call readContent(-1,testBuffer,0,1024)
expected result: IndexOutOfBoundsException
2.call readContent(1025,testBuffer,0,1024)
expected result: IndexOutOfBoundsException
3.call readContent(0,testBuffer,-1,1024)
expected result: IndexOutOfBoundsException
4.call readContent(0,testBuffer,1025,1024)
expected result: IndexOutOfBoundsException
5.call readContent(0,testBuffer,0,-1)
expected result: NegativeIndexArrayException
6.call readContent(0,null,0,1024)
expected result: NullPointerException
7.create testInstance from nonexistent file and call readContent(0,testBuffer,0,1024)
expected result: ContentAccessException
8.call readContent(0,testBuffer,0,1024) (loop to fill buffer)
compare with file content
expected result: same content
9.call readContent(512,testBuffer,0,1024)
expected result: buffer partially filled with 512 bytes matching last 512 bytes
of media content (could be less if nonblocking)
10.call readContent(1024,testBuffer,0,1024)
expected result: return -1 with empty buffer
11.call readContent(0,testBuffer,100,924), compare buffer offset 100 with media content
(use return value as length)
expected result: same content
12.call readContent(200,testBuffer,100,100), compare buffer offset 100 with file offset 200
(use return value as length)
expected result: same content
13.call readContent(0,testBuffer,0,1048), compare buffer with file content
expected result: same content and no exceptions
|
|
|