Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
48fb447c
Commit
48fb447c
authored
6 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
test modified to use mockito
parent
69cf66ee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!345
Resolve "Genes annotations don't show"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
model/src/test/java/lcsb/mapviewer/model/map/species/field/AntisenseRnaRegionTest.java
+150
-153
150 additions, 153 deletions
...iewer/model/map/species/field/AntisenseRnaRegionTest.java
with
150 additions
and
153 deletions
model/src/test/java/lcsb/mapviewer/model/map/species/field/AntisenseRnaRegionTest.java
+
150
−
153
View file @
48fb447c
...
...
@@ -8,166 +8,163 @@ import org.apache.commons.lang3.SerializationUtils;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
lcsb.mapviewer.common.Configuration
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
import
lcsb.mapviewer.model.map.modifier.Catalysis
;
import
lcsb.mapviewer.model.map.species.AntisenseRna
;
import
lcsb.mapviewer.model.map.species.Drug
;
public
class
AntisenseRnaRegionTest
{
@Before
public
void
setUp
()
throws
Exception
{
}
@After
public
void
tearDown
()
throws
Exception
{
}
@Test
public
void
testSerialization
()
{
try
{
SerializationUtils
.
serialize
(
new
AntisenseRnaRegion
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testConstructor1
()
{
try
{
AntisenseRnaRegion
antisenseRna
=
new
AntisenseRnaRegion
();
AntisenseRnaRegion
antisenseRna2
=
new
AntisenseRnaRegion
(
antisenseRna
);
assertNotNull
(
antisenseRna2
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testUpdate
()
{
try
{
AntisenseRnaRegion
antisenseRna
=
new
AntisenseRnaRegion
();
antisenseRna
.
setState
(
ModificationState
.
EMPTY
);
antisenseRna
.
setName
(
"as"
);
antisenseRna
.
setPos
(
3.0
);
AntisenseRnaRegion
antisenseRna2
=
new
AntisenseRnaRegion
();
antisenseRna2
.
update
(
antisenseRna
);
assertEquals
(
antisenseRna
.
getState
(),
antisenseRna2
.
getState
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testInvalidUpdate
()
{
try
{
AntisenseRnaRegion
antisenseRna
=
new
AntisenseRnaRegion
();
AntisenseRnaRegion
antisenseRna2
=
new
AntisenseRnaRegion
();
antisenseRna
.
setIdAntisenseRnaRegion
(
"@1"
);
antisenseRna2
.
setIdAntisenseRnaRegion
(
"@"
);
antisenseRna2
.
update
(
antisenseRna
);
fail
(
"Exception expected"
);
}
catch
(
InvalidArgumentException
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testGetters
()
{
try
{
AntisenseRnaRegion
region
=
new
AntisenseRnaRegion
(
new
AntisenseRnaRegion
());
int
id
=
91
;
AntisenseRna
species
=
new
AntisenseRna
(
"id"
);
double
pos
=
4.6
;
double
size
=
5.3
;
AntisenseRnaRegionType
type
=
AntisenseRnaRegionType
.
CODING_REGION
;
String
name
=
"nam"
;
String
idAntisenseRnaRegion
=
"iddd"
;
region
.
setId
(
id
);
region
.
setSpecies
(
species
);
region
.
setPos
(
pos
);
region
.
setSize
(
size
);
region
.
setType
(
type
);
region
.
setName
(
name
);
region
.
setIdAntisenseRnaRegion
(
idAntisenseRnaRegion
);
region
.
setState
(
ModificationState
.
ACETYLATED
);
assertEquals
(
id
,
region
.
getId
());
assertEquals
(
species
,
region
.
getSpecies
());
assertEquals
(
pos
,
region
.
getPos
(),
Configuration
.
EPSILON
);
assertEquals
(
size
,
region
.
getSize
(),
Configuration
.
EPSILON
);
assertEquals
(
type
,
region
.
getType
());
assertEquals
(
name
,
region
.
getName
());
assertEquals
(
idAntisenseRnaRegion
,
region
.
getIdAntisenseRnaRegion
());
assertEquals
(
ModificationState
.
ACETYLATED
,
region
.
getState
());
try
{
region
.
setSize
(
"text"
);
fail
(
"Exception expected"
);
}
catch
(
InvalidArgumentException
e
)
{
}
try
{
region
.
setPos
(
"text"
);
fail
(
"Exception expected"
);
}
catch
(
InvalidArgumentException
e
)
{
}
region
.
setSize
(
"1.0"
);
region
.
setPos
(
"1.0"
);
assertEquals
(
1.0
,
region
.
getPos
(),
Configuration
.
EPSILON
);
assertEquals
(
1.0
,
region
.
getSize
(),
Configuration
.
EPSILON
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testToString
()
{
try
{
assertNotNull
(
new
AntisenseRnaRegion
().
toString
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testCopy
()
{
try
{
AntisenseRnaRegion
degraded
=
new
AntisenseRnaRegion
().
copy
();
assertNotNull
(
degraded
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testInvalidCopy
()
{
try
{
new
AntisenseRnaRegion
()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
}.
copy
();
fail
(
"Exception expected"
);
}
catch
(
NotImplementedException
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Before
public
void
setUp
()
throws
Exception
{
}
@After
public
void
tearDown
()
throws
Exception
{
}
@Test
public
void
testSerialization
()
{
try
{
SerializationUtils
.
serialize
(
new
AntisenseRnaRegion
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testConstructor1
()
{
try
{
AntisenseRnaRegion
antisenseRna
=
new
AntisenseRnaRegion
();
AntisenseRnaRegion
antisenseRna2
=
new
AntisenseRnaRegion
(
antisenseRna
);
assertNotNull
(
antisenseRna2
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testUpdate
()
{
try
{
AntisenseRnaRegion
antisenseRna
=
new
AntisenseRnaRegion
();
antisenseRna
.
setState
(
ModificationState
.
EMPTY
);
antisenseRna
.
setName
(
"as"
);
antisenseRna
.
setPos
(
3.0
);
AntisenseRnaRegion
antisenseRna2
=
new
AntisenseRnaRegion
();
antisenseRna2
.
update
(
antisenseRna
);
assertEquals
(
antisenseRna
.
getState
(),
antisenseRna2
.
getState
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testInvalidUpdate
()
{
try
{
AntisenseRnaRegion
antisenseRna
=
new
AntisenseRnaRegion
();
AntisenseRnaRegion
antisenseRna2
=
new
AntisenseRnaRegion
();
antisenseRna
.
setIdAntisenseRnaRegion
(
"@1"
);
antisenseRna2
.
setIdAntisenseRnaRegion
(
"@"
);
antisenseRna2
.
update
(
antisenseRna
);
fail
(
"Exception expected"
);
}
catch
(
InvalidArgumentException
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testGetters
()
{
try
{
AntisenseRnaRegion
region
=
new
AntisenseRnaRegion
(
new
AntisenseRnaRegion
());
int
id
=
91
;
AntisenseRna
species
=
new
AntisenseRna
(
"id"
);
double
pos
=
4.6
;
double
size
=
5.3
;
AntisenseRnaRegionType
type
=
AntisenseRnaRegionType
.
CODING_REGION
;
String
name
=
"nam"
;
String
idAntisenseRnaRegion
=
"iddd"
;
region
.
setId
(
id
);
region
.
setSpecies
(
species
);
region
.
setPos
(
pos
);
region
.
setSize
(
size
);
region
.
setType
(
type
);
region
.
setName
(
name
);
region
.
setIdAntisenseRnaRegion
(
idAntisenseRnaRegion
);
region
.
setState
(
ModificationState
.
ACETYLATED
);
assertEquals
(
id
,
region
.
getId
());
assertEquals
(
species
,
region
.
getSpecies
());
assertEquals
(
pos
,
region
.
getPos
(),
Configuration
.
EPSILON
);
assertEquals
(
size
,
region
.
getSize
(),
Configuration
.
EPSILON
);
assertEquals
(
type
,
region
.
getType
());
assertEquals
(
name
,
region
.
getName
());
assertEquals
(
idAntisenseRnaRegion
,
region
.
getIdAntisenseRnaRegion
());
assertEquals
(
ModificationState
.
ACETYLATED
,
region
.
getState
());
try
{
region
.
setSize
(
"text"
);
fail
(
"Exception expected"
);
}
catch
(
InvalidArgumentException
e
)
{
}
try
{
region
.
setPos
(
"text"
);
fail
(
"Exception expected"
);
}
catch
(
InvalidArgumentException
e
)
{
}
region
.
setSize
(
"1.0"
);
region
.
setPos
(
"1.0"
);
assertEquals
(
1.0
,
region
.
getPos
(),
Configuration
.
EPSILON
);
assertEquals
(
1.0
,
region
.
getSize
(),
Configuration
.
EPSILON
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testToString
()
{
try
{
assertNotNull
(
new
AntisenseRnaRegion
().
toString
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testCopy
()
{
try
{
AntisenseRnaRegion
degraded
=
new
AntisenseRnaRegion
().
copy
();
assertNotNull
(
degraded
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testInvalidCopy
()
{
try
{
Mockito
.
mock
(
AntisenseRnaRegion
.
class
,
Mockito
.
CALLS_REAL_METHODS
).
copy
();
fail
(
"Exception expected"
);
}
catch
(
NotImplementedException
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment