Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AssessmentZooProgram
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
a-j.towse
AssessmentZooProgram
Commits
292c1928
Commit
292c1928
authored
May 14, 2022
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working UnitTest constructors
parent
6ddf0d83
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
5 deletions
+21
-5
Animal.class
ZooProgram/bin/Animal.class
+0
-0
App.class
ZooProgram/bin/App.class
+0
-0
unitTest.class
ZooProgram/bin/unitTest.class
+0
-0
hamcrest-core-1.3.jar
ZooProgram/lib/hamcrest-core-1.3.jar
+0
-0
Animal.java
ZooProgram/src/Animal.java
+8
-0
App.java
ZooProgram/src/App.java
+0
-1
unitTest.java
ZooProgram/src/unitTest.java
+13
-4
No files found.
ZooProgram/bin/Animal.class
View file @
292c1928
No preview for this file type
ZooProgram/bin/App.class
View file @
292c1928
No preview for this file type
ZooProgram/bin/unitTest.class
View file @
292c1928
No preview for this file type
ZooProgram/lib/hamcrest-core-1.3.jar
0 → 100644
View file @
292c1928
File added
ZooProgram/src/Animal.java
View file @
292c1928
...
...
@@ -44,5 +44,13 @@ public abstract class Animal {
return
this
.
environment
;
}
public
String
getName
(){
return
this
.
name
;
}
public
String
getDescription
(){
return
this
.
description
;
}
}
ZooProgram/src/App.java
View file @
292c1928
...
...
@@ -4,7 +4,6 @@ public class App {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Zoo
myZoo
=
new
Zoo
();
Fish
Rex
=
new
Fish
(
"Rex"
,
"red stripes"
,
"sea"
,
"sea-weed"
,
12.5
,
"freshwater"
);
Fish
Pix
=
new
Fish
(
"Pix"
,
"gold"
,
"river"
,
"smaller fish"
,
5.0
,
"saltwater"
);
...
...
ZooProgram/src/unitTest.java
View file @
292c1928
...
...
@@ -2,12 +2,21 @@ import static org.junit.Assert.assertEquals;
import
org.junit.Test
;
public
class
unitTest
{
@Test
public
void
Constructors
(){
Zoo
myZoo
=
new
Zoo
();
public
void
testConstructors
(){
//Fish Constructor
Fish
Rex
=
new
Fish
(
"Rex"
,
"red stripes"
,
"sea"
,
"sea-weed"
,
12.5
,
"freshwater"
);
Fish
Pix
=
new
Fish
(
"Pix"
,
"gold"
,
"river"
,
"smaller fish"
,
5.0
,
"saltwater"
);
Bird
Rob
=
new
Bird
(
"Rob"
,
"red robin"
,
"large tree"
,
"seeds"
,
false
,
true
);
Mammal
Tom
=
new
Mammal
(
"Tom"
,
"striped tiger"
,
"jungle"
,
"meat"
,
90.0
,
120.0
);
Reptile
Cameron
=
new
Reptile
(
"Cam"
,
"green eyed crocodile"
,
"salt water"
,
"chicken"
,
182.5
,
230.0
);
assertEquals
(
"Rex"
,
Rex
.
getName
()
);
assertEquals
(
"river"
,
Pix
.
getEnvironment
());
assertEquals
(
"seeds"
,
Rob
.
getFoodType
());
assertEquals
(
"Tom"
,
Tom
.
getName
());
assertEquals
(
"green eyed crocodile"
,
Cameron
.
getDescription
());
}
}
Write
Preview
Markdown
is supported
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