Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Queue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
Queue
Merge requests
!341
Add tests for LabStatisticsViewDto
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Add tests for LabStatisticsViewDto
labstatisticsdto-test
into
development
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Add tests for LabStatisticsViewDto
Thijs Nulle
requested to merge
labstatisticsdto-test
into
development
May 17, 2020
Overview
0
Commits
1
Pipelines
0
Changes
1
This MR adds tests for LabStatisticsViewDto
0
0
Merge request reports
Compare
development
development (base)
and
latest version
latest version
c70faefd
1 commit,
May 17, 2020
1 file
+
215
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/test/java/nl/tudelft/ewi/queue/view/LabStatisticsViewDtoTest.java
0 → 100644
+
215
−
0
View file @ c70faefd
Edit in single-file editor
Open in Web IDE
/*
* Queue - A Queueing system that can be used to handle labs in higher education
* Copyright (C) 2016-2020 Delft University of Technology
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
nl.tudelft.ewi.queue.view
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
nl.tudelft.ewi.queue.dto.view.LabStatisticsViewDto
;
import
nl.tudelft.ewi.queue.model.Course
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
class
LabStatisticsViewDtoTest
{
private
LabStatisticsViewDto
dto
,
other
;
@Before
public
void
init
()
{
dto
=
new
LabStatisticsViewDto
(
1L
,
1L
,
1L
,
1L
,
"assignment"
,
"room"
,
1L
,
1L
);
other
=
new
LabStatisticsViewDto
(
1L
,
1L
,
1L
,
1L
,
"assignment"
,
"room"
,
1L
,
1L
);
}
@Test
public
void
equalsThis
()
{
assertThat
(
dto
.
equals
(
dto
)).
isTrue
();
}
@Test
public
void
equalsOtherInstance
()
{
assertThat
(
dto
.
equals
(
new
Course
())).
isFalse
();
}
@Test
public
void
equalsOther
()
{
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
}
@Test
public
void
equalsThisNumStudentsNull
()
{
dto
.
setNumStudents
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothNumStudentsNull
()
{
dto
.
setNumStudents
(
null
);
other
.
setNumStudents
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentNumStudents
()
{
dto
.
setNumStudents
(
2L
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsThisNumAssistantsNull
()
{
dto
.
setNumAssistants
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothNumAssistantsNull
()
{
dto
.
setNumAssistants
(
null
);
other
.
setNumAssistants
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentNumAssistants
()
{
dto
.
setNumAssistants
(
2L
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsThisNumOpenNull
()
{
dto
.
setNumOpen
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothNumOpenNull
()
{
dto
.
setNumOpen
(
null
);
other
.
setNumOpen
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentNumOpen
()
{
dto
.
setNumOpen
(
2L
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsThisNumHandledNull
()
{
dto
.
setNumHandled
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothNumHandledNull
()
{
dto
.
setNumHandled
(
null
);
other
.
setNumHandled
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentNumHandled
()
{
dto
.
setNumHandled
(
2L
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsThisAssignmentNull
()
{
dto
.
setAssignment
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothAssignmentNull
()
{
dto
.
setAssignment
(
null
);
other
.
setAssignment
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentAssignment
()
{
dto
.
setAssignment
(
""
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsThisRoomNull
()
{
dto
.
setRoom
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothRoomNull
()
{
dto
.
setRoom
(
null
);
other
.
setRoom
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentRoom
()
{
dto
.
setRoom
(
""
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsThisAvgWaitingTimeNull
()
{
dto
.
setAvgWaitingTime
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothAvgWaitingTimeNull
()
{
dto
.
setAvgWaitingTime
(
null
);
other
.
setAvgWaitingTime
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentAvgWaitingTime
()
{
dto
.
setAvgWaitingTime
(
2L
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsThisAvgProcessingTimeNull
()
{
dto
.
setAvgProcessingTime
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
@Test
public
void
equalsBothAvgProcessingTimeNull
()
{
dto
.
setAvgProcessingTime
(
null
);
other
.
setAvgProcessingTime
(
null
);
assertThat
(
dto
.
equals
(
other
)).
isTrue
();
assertThat
(
dto
.
hashCode
()).
isEqualTo
(
other
.
hashCode
());
}
@Test
public
void
equalsDifferentAvgProcessingTime
()
{
dto
.
setAvgProcessingTime
(
2L
);
assertThat
(
dto
.
equals
(
other
)).
isFalse
();
}
}
Loading