Code example for ObjectStreamField

Methods: getName, getType

0
    ObjectStreamField bamField;
 
    ObjectStreamField holaField;
 
    public void test_ConstructorLjava_lang_StringLjava_lang_Class() { 
        ObjectStreamField osf = new ObjectStreamField("aField", int.class);
        assertTrue("Test 1: Name member not set correctly.",
                   osf.getName().equals("aField"));
        assertTrue("Test 2: Type member not set correctly.",
                   osf.getType().equals(int.class));
 
        // Repeat the tests with a different object to make sure 
        // that we have not tested against default values. 
        osf = new ObjectStreamField("anotherField", String.class);
        assertTrue("Test 3: Name member not set correctly.",
                   osf.getName().equals("anotherField"));
        assertTrue("Test 4: Type member not set correctly.",
                   osf.getType().equals(String.class));
 
        // Invalid argument tests. 
        try {