Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
V
vadere
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
110
Issues
110
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
3
Merge Requests
3
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vadere
vadere
Commits
db76c70e
Commit
db76c70e
authored
Dec 13, 2016
by
Jakob Schöttl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unncessary clone method and related tests
parent
3f189de9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
48 deletions
+0
-48
VadereState/src/org/vadere/state/attributes/Attributes.java
VadereState/src/org/vadere/state/attributes/Attributes.java
+0
-8
VadereState/tests/org/vadere/state/attributes/TestAttributesCloneable.java
.../org/vadere/state/attributes/TestAttributesCloneable.java
+0
-40
No files found.
VadereState/src/org/vadere/state/attributes/Attributes.java
View file @
db76c70e
...
...
@@ -22,12 +22,4 @@ public abstract class Attributes extends DefaultSealable implements Cloneable {
public
Attributes
()
{}
public
Attributes
cloneAttributes
()
{
try
{
return
(
Attributes
)
super
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
throw
new
RuntimeException
(
"This should never happen because the base class Attributes is Cloneable."
);
}
}
}
VadereState/tests/org/vadere/state/attributes/TestAttributesCloneable.java
View file @
db76c70e
package
org.vadere.state.attributes
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Test
;
public
class
TestAttributesCloneable
{
private
static
class
SimpleAttributes
extends
Attributes
{
int
id
=
1
;
}
private
static
class
NestedAttributes
extends
Attributes
{
int
id
=
1
;
SimpleAttributes
c
=
new
SimpleAttributes
();
SimpleCloneable
d
=
new
SimpleCloneable
();
}
private
static
class
SimpleCloneable
implements
Cloneable
{
int
id
=
1
;
}
private
static
class
NotCloneableClass
{
@Override
public
Object
clone
()
throws
CloneNotSupportedException
{
...
...
@@ -27,30 +11,6 @@ public class TestAttributesCloneable {
}
}
@Test
public
void
testSimpleCloneable
()
{
try
{
SimpleAttributes
a
=
new
SimpleAttributes
();
SimpleAttributes
b
=
(
SimpleAttributes
)
a
.
cloneAttributes
();
assertEquals
(
a
.
id
,
b
.
id
);
}
catch
(
Exception
e
)
{
fail
(
"clone should not throw exception"
);
}
}
@Test
public
void
testExtendedCloneable
()
{
try
{
NestedAttributes
a
=
new
NestedAttributes
();
NestedAttributes
b
=
(
NestedAttributes
)
a
.
cloneAttributes
();
assertEquals
(
a
.
id
,
b
.
id
);
assertEquals
(
a
.
c
.
id
,
b
.
c
.
id
);
assertEquals
(
a
.
d
.
id
,
b
.
d
.
id
);
}
catch
(
Exception
e
)
{
fail
(
"clone should not throw exception"
);
}
}
@Test
(
expected
=
CloneNotSupportedException
.
class
)
public
void
testNotCloneableClass
()
throws
CloneNotSupportedException
{
new
NotCloneableClass
().
clone
();
...
...
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