Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
🚀
This server has been upgraded to GitLab release
15.7
.
🚀
Open sidebar
SweGl-public
fhnw-swegl-22fs-it
Commits
dc7e21b9
Commit
dc7e21b9
authored
May 23, 2022
by
Sibylle Peter
Browse files
started TDD market
parent
dd5f0739
Changes
3
Hide whitespace changes
Inline
Side-by-side
fhnw-swegl-22fs-it.iml
0 → 100644
View file @
dc7e21b9
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
inherit-compiler-output=
"true"
>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test"
isTestSource=
"true"
/>
</content>
<orderEntry
type=
"jdk"
jdkName=
"17"
jdkType=
"JavaSDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"module-library"
scope=
"TEST"
>
<library
name=
"JUnit5.7.0"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar!/"
/>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar!/"
/>
</CLASSES>
<JAVADOC
/>
<SOURCES
/>
</library>
</orderEntry>
</component>
</module>
\ No newline at end of file
src/market/Booth.java
0 → 100644
View file @
dc7e21b9
package
market
;
public
class
Booth
{
private
static
final
int
BASE_TAX
=
20
;
public
static
final
int
PRICE_PER_METER
=
10
;
int
price
=
BASE_TAX
;
private
int
length
;
private
boolean
table
;
private
boolean
food
;
public
Booth
(
int
length
){
//TODO: refactor after calculate price works again.
//this(length, false, false);
this
.
length
=
length
;
}
public
Booth
(
int
length
,
boolean
table
,
boolean
food
)
{
this
.
length
=
length
;
this
.
table
=
table
;
this
.
food
=
food
;
}
private
void
calculatePrice
(){
price
+=
(
length
-
2
)*
PRICE_PER_METER
;
//TODO implement for table and food
}
public
int
getPrice
()
{
// TODO: should calculate price return price???
calculatePrice
();
return
price
;
}
}
test/market/BoothTest.java
0 → 100644
View file @
dc7e21b9
package
market
;
import
org.junit.jupiter.api.Test
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
public
class
BoothTest
{
@Test
void
testBoothWith3LMNoTableNoFood
(){
//given lm 3, no table, no food
Booth
booth
=
new
Booth
(
3
);
// when calculate price
// then price = 30 CHF
assertEquals
(
30
,
booth
.
getPrice
());
}
@Test
void
testBoothWith7mTableFood
(){
//given lm 3, no table, no food
Booth
booth
=
new
Booth
(
7
,
true
,
true
);
// when calculate price
// then price = 30 CHF
assertEquals
(
140
,
booth
.
getPrice
());
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment