Author: simonetripodi
Date: Sat Jan 21 12:35:13 2012
New Revision: 1234315
URL: http://svn.apache.org/viewvc?rev=1234315&view=rev
Log:
reuse assertions to verify label nullability
label cannot be null in the hasCode() method
Modified:
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
Modified:
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java?rev=1234315&r1=1234314&r2=1234315&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
(original)
+++
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
Sat Jan 21 12:35:13 2012
@@ -20,6 +20,7 @@ package org.apache.commons.graph.model;
*/
import static java.lang.String.format;
+import static org.apache.commons.graph.utils.Assertions.checkNotNull;
import org.apache.commons.graph.Edge;
import org.apache.commons.graph.Labeled;
@@ -32,11 +33,7 @@ public class BaseLabeledEdge
public BaseLabeledEdge( String label )
{
- if ( label == null )
- {
- throw new IllegalArgumentException( "Argument 'label' must not be
null" );
- }
- this.label = label;
+ this.label = checkNotNull( label, "Argument 'label' must not be null"
);
}
/**
@@ -55,7 +52,7 @@ public class BaseLabeledEdge
{
final int prime = 31;
int result = 1;
- result = prime * result + ( ( label == null ) ? 0 : label.hashCode() );
+ result = prime * result + label.hashCode();
return result;
}