Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andreas Skifjeld
examples
Commits
4099b8b5
Commit
4099b8b5
authored
Jan 30, 2018
by
Hallvard Trætteberg
Browse files
Enda en test, bedrer coverage
parent
c917ab20
Changes
1
Hide whitespace changes
Inline
Side-by-side
tdt4140-gr1800/app.core/src/test/java/tdt4140/gr1800/app/core/LatLongTest.java
0 → 100644
View file @
4099b8b5
package
tdt4140.gr1800.app.core
;
import
org.junit.Assert
;
import
org.junit.Test
;
public
class
LatLongTest
{
@Test
public
void
testToString
()
{
LatLong
latLong
=
new
LatLong
(
63.0
,
10.0
);
Assert
.
assertEquals
(
Double
.
toString
(
63
)
+
","
+
Double
.
toString
(
10
),
latLong
.
toString
());
}
@Test
public
void
testValueOf
()
{
testLatLong
(
LatLong
.
valueOf
(
"63.0, 10.0"
),
63.0
,
10.0
);
testLatLong
(
LatLong
.
valueOf
(
"63.0, 10.0"
,
","
),
63.0
,
10.0
);
testLatLong
(
LatLong
.
valueOf
(
"63.0; 10.0"
,
";"
),
63.0
,
10.0
);
}
private
void
testLatLong
(
LatLong
latLong
,
double
lat
,
double
lon
)
{
Assert
.
assertEquals
(
lat
,
latLong
.
latitude
,
0.0
);
Assert
.
assertEquals
(
lon
,
latLong
.
longitude
,
0.0
);
}
@Test
public
void
testEquals
()
{
Assert
.
assertTrue
(
new
LatLong
(
63.0
,
10.0
).
equals
(
new
LatLong
(
63.0
,
10.0
)));
Assert
.
assertFalse
(
new
LatLong
(
10.0
,
63.0
).
equals
(
new
LatLong
(
63.0
,
10.0
)));
Assert
.
assertFalse
(
new
LatLong
(
10.0
,
63.0
).
equals
(
null
));
Assert
.
assertFalse
(
new
LatLong
(
10.0
,
63.0
).
equals
(
"10.0, 63.0"
));
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment