Project

General

Profile

« Previous | Next » 

Revision 5348

Added by berkley almost 14 years ago

added exception testing to the crud test

View differences:

CrudServiceTest.java
122 122
            SystemMetadata sm = getSystemMetadata(token, id);
123 123
            assertTrue(sm.getIdentifier().getValue().equals(id.getValue()));
124 124
            assertTrue(sm.getChecksum().getValue().equals(checksum(getTestDoc())));
125
            
126
            try
127
            {
128
                Identifier fakeid = new Identifier();
129
                fakeid.setValue("somethingfake.234234");
130
                getSystemMetadata(token, fakeid);
131
                fail("getSystemMetadata should have thrown an exception.");
132
            }
133
            catch(Exception e)
134
            {
135
                assertTrue(true);
136
            }
125 137
        }
126 138
        catch(Exception e)
127 139
        {
......
153 165
            System.out.println("got doc: " + gotDoc);
154 166
            //compare the docs
155 167
            assertTrue(gotDoc.trim().equals(getTestDoc().trim()));
168
            
169
            try
170
            {
171
                Identifier fakeid = new Identifier();
172
                fakeid.setValue("somethingfake.234234");
173
                getDoc(token, fakeid);
174
                fail("testCreateAndGet should have thrown an exception.");
175
            }
176
            catch(Exception e)
177
            {
178
                assertTrue(true);
179
            }
156 180
        }
157 181
        catch(Exception e)
158 182
        {

Also available in: Unified diff