cvs commit: spice/sandbox/metaclass/src/test/org/realityforge/metaclass/model FieldDescriptorTestCase.java
Peter Donald <[email protected]>
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
donaldp 03/10/28 03:23:19
Added: sandbox/metaclass/src/test/org/realityforge/metaclass/model
FieldDescriptorTestCase.java
Log:
Unit test the field descriptor
Revision Changes Path
1.1 spice/sandbox/metaclass/src/test/org/realityforge/metaclass/model/FieldDescriptorTestCase.java
Index: FieldDescriptorTestCase.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.realityforge.metaclass.model;
import junit.framework.TestCase;
/**
*
* @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
* @version $Revision: 1.1 $ $Date: 2003/10/28 11:23:18 $
*/
public class FieldDescriptorTestCase
extends TestCase
{
public void testFieldDescriptor()
throws Exception
{
final FieldDescriptor descriptor =
new FieldDescriptor( "x", "int", Attribute.EMPTY_SET );
assertEquals( "name", "x", descriptor.getName() );
assertEquals( "type", "int", descriptor.getType() );
}
public void testNullNamePassedToCtor()
throws Exception
{
try
{
new FieldDescriptor( null, "int", Attribute.EMPTY_SET );
}
catch( final NullPointerException npe )
{
assertEquals( "npe.getMessage()", "name", npe.getMessage() );
return;
}
fail( "Expected to fail due to null Name passed into Ctor" );
}
public void testNulltypePassedToCtor()
throws Exception
{
try
{
new FieldDescriptor( "blah", null, Attribute.EMPTY_SET );
}
catch( final NullPointerException npe )
{
assertEquals( "npe.getMessage()", "type", npe.getMessage() );
return;
}
fail( "Expected to fail due to null type passed into Ctor" );
}
}
-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/