package org.opennms.netmgt.model;

import junit.framework.TestCase;

import org.opennms.netmgt.model.OnmsIpInterface.CollectionType;

public class OnmsIpInterfaceTest extends TestCase {

	public void testCollectionTypeGetNull () {
		CollectionType collectionType = CollectionType.get(null);
		
		assertSame("The expected value is N for a null", CollectionType.NO_COLLECT, collectionType);
		
	}

	public void testCollectionTypeGetSpaces () {
		CollectionType collectionType = CollectionType.get("   ");
		
		assertSame("The expected valus is N for all spaces", CollectionType.NO_COLLECT, collectionType);
	}
	
	public void testCollectionTypeGetTwoChars () {
		
		try {
			CollectionType collectionType = CollectionType.get(" MN  ");
			fail("Expected to catch an exception here");
		} catch (IllegalArgumentException e) {
		}
	}

}

@@ -662,16 +662,47 @@
 %09%09try %7B%0A
+%09%09%09@SuppressWarnings(%22unused%22)%0A
 %09%09%09Colle
@@ -854,10 +854,505 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09public void testCollectionTypeGetZ () %7B%0A%09%09%0A%09%09try %7B%0A%09%09%09@SuppressWarnings(%22unused%22)%0A%09%09%09CollectionType collectionType = CollectionType.get(%22Z%22);%0A%09%09%09fail(%22Expected to catch an exception here%22);%0A%09%09%7D catch (IllegalArgumentException e) %7B%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void testCollectionTypeComparison () %7B%0A%09%09CollectionType left = new CollectionType('N');%0A%09%09CollectionType right = null;%0A%09%09try %7B%0A%09%09%09left.isLessThan(right);%0A%09%09%09fail(%22Expected to catch an exception here%22);%0A%09%09%7D catch (NullPointerException e) %7B%0A%09%09%7D%0A%09%7D%0A
 %7D%0A

Test for b00g 1654. Basically one of the issnmpprimary values being retrieved from ipinterface is null. I am unsure where we should deal with this. In the get? Should we constrain the table? Somewhere this is being written as a null, so that needs to be fixed too.