Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
idatt1002_2023_9
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Andreas Kluge Svendsrud
idatt1002_2023_9
Commits
8d8acb4a
Commit
8d8acb4a
authored
1 year ago
by
HSoreide
Browse files
Options
Downloads
Patches
Plain Diff
Remove file-io assertion from unit tests of FileHandler
parent
59744086
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!42
Hs frontend recipes
,
!41
Hs frontend recipes
Pipeline
#217851
passed
1 year ago
Stage: build
Stage: test
Stage: package
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/no/ntnu/idatt1002/demo/data/recipes/FileHandlerTest.java
+0
-11
0 additions, 11 deletions
.../no/ntnu/idatt1002/demo/data/recipes/FileHandlerTest.java
with
0 additions
and
11 deletions
src/test/java/no/ntnu/idatt1002/demo/data/recipes/FileHandlerTest.java
+
0
−
11
View file @
8d8acb4a
...
...
@@ -4,7 +4,6 @@ import org.junit.jupiter.api.BeforeEach;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.api.Test
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Objects
;
...
...
@@ -76,24 +75,18 @@ class FileHandlerTest {
void
writeEmptyRegister
()
{
RecipeRegister
emptyRegister
=
new
RecipeRegister
();
assertAll
(()
->
FileHandler
.
writeRegister
(
emptyRegister
,
"emptyRegister"
));
File
emptyFile
=
new
File
(
"src/main/resources/recipes/emptyRegister.register"
);
assertTrue
(
emptyFile
.
exists
());
}
@Test
@DisplayName
(
"Test that writing null register to file throws exception."
)
void
writeNullRegister
()
{
assertThrows
(
IllegalArgumentException
.
class
,
()
->
FileHandler
.
writeRegister
(
null
,
"noRegister"
));
File
nullFile
=
new
File
(
"src/main/resources/recipes/noRegister.register"
);
assertFalse
(
nullFile
.
exists
());
}
@Test
@DisplayName
(
"Write recipe register correctly to file as text."
)
void
writeRecipeRegisterToFile
()
{
assertAll
(()
->
FileHandler
.
writeRegister
(
recipeRegister
,
"RecipeRegister"
));
File
recipeFile
=
new
File
(
"src/main/resources/recipes/RecipeRegister.register"
);
assertTrue
(
recipeFile
.
exists
());
}
}
...
...
@@ -137,8 +130,6 @@ class FileHandlerTest {
void
writeEmptyIngredientsAtHandToFile
()
{
IngredientsAtHand
emptyAtHand
=
new
IngredientsAtHand
();
assertAll
(()
->
FileHandler
.
writeIngredientsAtHand
(
emptyAtHand
,
"EmptyAtHandRegister"
));
File
recipeFile
=
new
File
(
"src/main/resources/recipes/EmptyAtHandRegister.register"
);
assertTrue
(
recipeFile
.
exists
());
assertEquals
(
0
,
Objects
.
requireNonNull
(
FileHandler
.
readIngredientsAtHand
(
"EmptyAtHandRegister"
)).
getIngredientsAtHand
().
size
());
}
...
...
@@ -147,8 +138,6 @@ class FileHandlerTest {
@DisplayName
(
"Write ingredients at hand to file."
)
void
writeIngredientsAtHandToFile
()
{
assertAll
(()
->
FileHandler
.
writeIngredientsAtHand
(
ingredientsAtHand
,
"AtHandRegister"
));
File
recipeFile
=
new
File
(
"src/main/resources/recipes/RecipeRegister.register"
);
assertTrue
(
recipeFile
.
exists
());
}
@Test
...
...
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