Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gla-client-template
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
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Enseignants GLA
gla-client-template
Commits
d56da81a
Commit
d56da81a
authored
7 months ago
by
Arnaud LABOUREL
Browse files
Options
Downloads
Patches
Plain Diff
added test for DayGenerator
parent
f4e033b6
No related branches found
No related tags found
No related merge requests found
Pipeline
#44822
passed
7 months ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/fr/univ_amu/m1info/client/util/DayGeneratorTest.java
+59
-0
59 additions, 0 deletions
...java/fr/univ_amu/m1info/client/util/DayGeneratorTest.java
with
59 additions
and
0 deletions
src/test/java/fr/univ_amu/m1info/client/util/DayGeneratorTest.java
0 → 100644
+
59
−
0
View file @
d56da81a
package
fr.univ_amu.m1info.client.util
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
java.time.LocalDate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.*;
class
DayGeneratorTest
{
private
static
final
LocalDate
DATE_06_01_2025
=
LocalDate
.
of
(
2025
,
1
,
6
);
private
static
final
LocalDate
DATE_11_01_2025
=
LocalDate
.
of
(
2025
,
1
,
11
);
private
static
final
LocalDate
DATE_06_06_2026
=
LocalDate
.
of
(
2026
,
6
,
6
);
private
static
final
LocalDate
DATE_10_07_2026
=
LocalDate
.
of
(
2026
,
7
,
10
);
private
DayGenerator
generator06_01_to_11_01_2025
;
private
DayGenerator
generator06_06_to_10_07_2026
;
@BeforeEach
void
setUp
()
{
generator06_01_to_11_01_2025
=
new
DayGenerator
(
new
DateInterval
(
DATE_06_01_2025
,
DATE_11_01_2025
));
generator06_06_to_10_07_2026
=
new
DayGenerator
(
new
DateInterval
(
DATE_06_06_2026
,
DATE_10_07_2026
));
}
@Test
void
iterator
()
{
}
@Test
void
getNumberOfDays
()
{
assertThat
(
generator06_01_to_11_01_2025
.
getNumberOfDays
()).
isEqualTo
(
5
);
assertThat
(
generator06_06_to_10_07_2026
.
getNumberOfDays
()).
isEqualTo
(
34
);
}
@Test
void
getStartDate
()
{
assertThat
(
generator06_01_to_11_01_2025
.
getStartDate
()).
isEqualTo
(
DATE_06_01_2025
);
assertThat
(
generator06_06_to_10_07_2026
.
getStartDate
()).
isEqualTo
(
DATE_06_06_2026
);
}
@Test
void
getEndDate
()
{
assertThat
(
generator06_06_to_10_07_2026
.
getEndDate
()).
isEqualTo
(
DATE_10_07_2026
);
assertThat
(
generator06_01_to_11_01_2025
.
getEndDate
()).
isEqualTo
(
DATE_11_01_2025
);
}
@Test
void
getDayIndex
()
{
assertThat
(
generator06_01_to_11_01_2025
.
getDayIndex
(
LocalDate
.
of
(
2025
,
1
,
6
)))
.
isEqualTo
(
0
);
assertThat
(
generator06_01_to_11_01_2025
.
getDayIndex
(
LocalDate
.
of
(
2025
,
1
,
8
)))
.
isEqualTo
(
2
);
assertThat
(
generator06_06_to_10_07_2026
.
getDayIndex
(
LocalDate
.
of
(
2025
,
1
,
6
)))
.
isEqualTo
(-
1
);
}
@Test
void
testToString
()
{
assertThat
(
generator06_01_to_11_01_2025
.
toString
())
.
isEqualTo
(
"DayGenerator{interval=DateInterval[start=2025-01-06, end=2025-01-11]}"
);
}
}
\ No newline at end of file
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