Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Pavlin Radoslavov
2014-11-04 15:36:04 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
315d6c8b89c4d950443ee3d71f9bbb133c68d190
315d6c8b
1 parent
f182f015
Minor refactoring (for code consistency).
No functional changes.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
23 deletions
utils/misc/src/test/java/org/onlab/packet/Ip4AddressTest.java
utils/misc/src/test/java/org/onlab/packet/Ip6AddressTest.java
utils/misc/src/test/java/org/onlab/packet/IpAddressTest.java
utils/misc/src/test/java/org/onlab/packet/Ip4AddressTest.java
View file @
315d6c8
...
...
@@ -136,18 +136,19 @@ public class Ip4AddressTest {
@Test
public
void
testValueOfByteArrayIPv4
()
{
Ip4Address
ipAddress
;
byte
[]
value
;
final
byte
[]
value1
=
new
byte
[]
{
1
,
2
,
3
,
4
};
ipAddress
=
Ip4Address
.
valueOf
(
value
1
);
value
=
new
byte
[]
{
1
,
2
,
3
,
4
};
ipAddress
=
Ip4Address
.
valueOf
(
value
);
assertThat
(
ipAddress
.
toString
(),
is
(
"1.2.3.4"
));
final
byte
[]
value2
=
new
byte
[]
{
0
,
0
,
0
,
0
};
ipAddress
=
Ip4Address
.
valueOf
(
value
2
);
value
=
new
byte
[]
{
0
,
0
,
0
,
0
};
ipAddress
=
Ip4Address
.
valueOf
(
value
);
assertThat
(
ipAddress
.
toString
(),
is
(
"0.0.0.0"
));
final
byte
[]
value3
=
new
byte
[]
{(
byte
)
0xff
,
(
byte
)
0xff
,
(
byte
)
0xff
,
(
byte
)
0xff
};
ipAddress
=
Ip4Address
.
valueOf
(
value
3
);
value
=
new
byte
[]
{(
byte
)
0xff
,
(
byte
)
0xff
,
(
byte
)
0xff
,
(
byte
)
0xff
};
ipAddress
=
Ip4Address
.
valueOf
(
value
);
assertThat
(
ipAddress
.
toString
(),
is
(
"255.255.255.255"
));
}
...
...
@@ -157,9 +158,10 @@ public class Ip4AddressTest {
@Test
(
expected
=
NullPointerException
.
class
)
public
void
testInvalidValueOfNullArrayIPv4
()
{
Ip4Address
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
null
;
ipAddress
=
Ip4Address
.
valueOf
(
fromArray
);
value
=
null
;
ipAddress
=
Ip4Address
.
valueOf
(
value
);
}
/**
...
...
@@ -169,9 +171,10 @@ public class Ip4AddressTest {
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testInvalidValueOfShortArrayIPv4
()
{
Ip4Address
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
new
byte
[]
{
1
,
2
,
3
};
ipAddress
=
Ip4Address
.
valueOf
(
fromArray
);
value
=
new
byte
[]
{
1
,
2
,
3
};
ipAddress
=
Ip4Address
.
valueOf
(
value
);
}
/**
...
...
utils/misc/src/test/java/org/onlab/packet/Ip6AddressTest.java
View file @
315d6c8
...
...
@@ -154,9 +154,10 @@ public class Ip6AddressTest {
@Test
(
expected
=
NullPointerException
.
class
)
public
void
testInvalidValueOfNullArrayIPv6
()
{
Ip6Address
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
null
;
ipAddress
=
Ip6Address
.
valueOf
(
fromArray
);
value
=
null
;
ipAddress
=
Ip6Address
.
valueOf
(
value
);
}
/**
...
...
@@ -166,9 +167,10 @@ public class Ip6AddressTest {
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testInvalidValueOfShortArrayIPv6
()
{
Ip6Address
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
ipAddress
=
Ip6Address
.
valueOf
(
fromArray
);
value
=
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
ipAddress
=
Ip6Address
.
valueOf
(
value
);
}
/**
...
...
utils/misc/src/test/java/org/onlab/packet/IpAddressTest.java
View file @
315d6c8
...
...
@@ -234,9 +234,10 @@ public class IpAddressTest {
@Test
(
expected
=
NullPointerException
.
class
)
public
void
testInvalidValueOfNullArrayIPv4
()
{
IpAddress
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
null
;
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET
,
fromArray
);
value
=
null
;
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET
,
value
);
}
/**
...
...
@@ -245,9 +246,10 @@ public class IpAddressTest {
@Test
(
expected
=
NullPointerException
.
class
)
public
void
testInvalidValueOfNullArrayIPv6
()
{
IpAddress
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
null
;
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET6
,
fromArray
);
value
=
null
;
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET6
,
value
);
}
/**
...
...
@@ -257,9 +259,10 @@ public class IpAddressTest {
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testInvalidValueOfShortArrayIPv4
()
{
IpAddress
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
new
byte
[]
{
1
,
2
,
3
};
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET
,
fromArray
);
value
=
new
byte
[]
{
1
,
2
,
3
};
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET
,
value
);
}
/**
...
...
@@ -269,9 +272,10 @@ public class IpAddressTest {
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testInvalidValueOfShortArrayIPv6
()
{
IpAddress
ipAddress
;
byte
[]
value
;
final
byte
[]
fromArray
=
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET6
,
fromArray
);
value
=
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
ipAddress
=
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET6
,
value
);
}
/**
...
...
Please
register
or
login
to post a comment