Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
se1‐bestellung
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Domenik Schulz
se1‐bestellung
Commits
96f77885
Commit
96f77885
authored
4 years ago
by
Domenik Schulz
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
9d69e35f
Branches
master
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
commit.log
+211
-0
211 additions, 0 deletions
commit.log
src/system/Logic.java
+0
-2
0 additions, 2 deletions
src/system/Logic.java
test/model/CustomerTest.java
+1
-1
1 addition, 1 deletion
test/model/CustomerTest.java
test/system/LogicTest.java
+34
-35
34 additions, 35 deletions
test/system/LogicTest.java
with
246 additions
and
38 deletions
commit.log
0 → 100644
+
211
−
0
View file @
96f77885
commit 9d69e35f00ee3300181ff6b52823e78378046929
Merge: fed292b 7c50da0
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon Jun 29 15:47:15 2020 +0200
merge
commit fed292b942e31ee72fdde46a4143c24e69a5140e
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon Jun 29 15:27:38 2020 +0200
fixed tests
commit ab9fb364e04ffaf4abb0b406f791431da02158d7
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon Jun 29 00:00:43 2020 +0200
JUnit4 tests check-in
commit e83ab3cc4ce273a85cd116165c295124f9b6e827
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 28 23:55:33 2020 +0200
added factory classes and fixed structure
commit 7c50da0875ea176d4d20e0171f615dce2acdb31a
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 14 22:30:33 2020 +0200
JUnit4 tests check-in
commit 8ed68e5da34747999028ed7fdb0e94c68402459c
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 14 21:19:52 2020 +0200
added factoryclasses and implemented new structure
commit d5a8e8470cd4f85fab81955d6d120e9564b15c45
Merge: dc1b6e7 c1994bb
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 14 20:05:32 2020 +0200
merge from dev into master
commit c1994bbcaf2dd7aef1e0b0808fce6a4a77bfd52e
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 14 19:53:02 2020 +0200
implemented findAllById()
commit dc17270ab6dcd5944d1118de18ce7e62c5150fe6
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 14 19:46:43 2020 +0200
fix: Issue #2 and #3 implemented new DataRepository and fixed LogicImpl
commit 62a917fe683b7194fb95fbc641695aed98fb7dcd
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 14 10:45:22 2020 +0200
deleted old files and added new ones
commit 3c399264eab56a75a94146c6ce9b6708ebeb27b7
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 14 10:42:04 2020 +0200
added implementation in DataRepositoryImpl
commit 0b6ecd7a4c684fd3d2a890b8a302d68312cbb30e
Author: s80347 <s80347@beuth-hochschule.de>
Date: Wed Jun 10 11:52:57 2020 +0200
fix: Issue #1 - refactored project structure to seperate logic from business objects
commit 4fc3947661c088680e0022efd81d74e8f91bb027
Author: s80347 <s80347@beuth-hochschule.de>
Date: Wed Jun 10 11:41:00 2020 +0200
fix: Issue #4 - changed list to iterable to prevent manipulating order
commit 95cdcd3e13d3cd6f3350bd28a8a5b3399192f5ae
Author: s80347 <s80347@beuth-hochschule.de>
Date: Wed Jun 10 11:34:31 2020 +0200
changed ig
commit dc1b6e72d20499644f52b1b6e0cea78990c11c24
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon Jun 8 00:20:49 2020 +0200
extracted datarepositoryimpl from datarepostitory
commit 775b0a5f02d4125e93639b0657ddd1322aee3bb0
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon Jun 8 00:17:03 2020 +0200
fixed structure
commit b69e4f5aec6d22bfc5724f440ea080dc2d05bc80
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon Jun 8 00:01:51 2020 +0200
added new functionality
commit 49465005050d3ec8ee932c426c2bb41e7484a099
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 7 23:56:18 2020 +0200
added new Application
commit d4e2cd7257b9b8ab7d1c4c062819ac8152df9e39
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 7 23:54:02 2020 +0200
removed unused files
commit 2b26e3ae84d96745211e58278d4856f1464bf959
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 7 23:40:29 2020 +0200
removed text files
commit be0d99cf0a6eb9ffb601535d73b711bbcc208858
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 7 23:39:27 2020 +0200
added DataAccessImpl and MockDataBuilderImpl
commit 1413e11fe331e5ae9094f0d5fa2d7d65b235f7cc
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 7 23:38:38 2020 +0200
added basic functions
commit d710658370a021a6405e5bb67402c710aadddb39
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 7 23:26:49 2020 +0200
added DataRepository
commit 3e44629e931512d1fb232a0f81641221981d7eff
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun Jun 7 23:24:25 2020 +0200
added DataAccess logic
commit ba3082dba787f29ff32dce089f8510620b495d1d
Author: s80347 <s80347@beuth-hochschule.de>
Date: Tue May 12 09:03:38 2020 +0200
moved DataAccess in new package and updated imports
commit 90ec54eb7bc829b97c7bec7f2c25a2af46889ff7
Author: s80347 <s80347@beuth-hochschule.de>
Date: Tue May 12 08:53:58 2020 +0200
created new package
commit e96b0e53d0c1dab05c6cac1ba3ddfdd3d802adaf
Author: s80347 <s80347@beuth-hochschule.de>
Date: Tue May 12 08:49:54 2020 +0200
fix: changed argument in print orders to prevent manipulating the list object
commit 08fad5bc8d3daef7b6c91635d0d21887e16abef4
Author: s80347 <s80347@beuth-hochschule.de>
Date: Tue May 12 08:44:42 2020 +0200
pricetable
commit ed7cf49151191b0d397315303b9713b4b57a0a75
Author: s80347 <s80347@beuth-hochschule.de>
Date: Tue May 12 08:40:05 2020 +0200
alten Stand wiederhergestellt
commit 840fe54abf69415d28dc457a15f6254ebecf62a5
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon May 11 15:33:12 2020 +0200
added git_diff and git_log
commit ef8c8a270bfe66a5467a429412e7086603d212fb
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon May 11 15:32:09 2020 +0200
changed price table to normal price
commit f01c2e04be1a9272b5a634f7ca737c9e22367bc6
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon May 11 15:31:36 2020 +0200
added price table and selected discount
commit b595a148c3ea2f0c3427e3e155363d173c7e74de
Author: s80347 <s80347@beuth-hochschule.de>
Date: Mon May 11 15:19:19 2020 +0200
create orders in mock
commit 98f1bfa451fed7f0b13ef8ba698038aed8a4b8e9
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun May 10 19:28:35 2020 +0200
second commit
commit 9224ce6518ea7b16414794ea012de49ea68a2af9
Author: s80347 <s80347@beuth-hochschule.de>
Date: Sun May 10 19:25:28 2020 +0200
initial commit
This diff is collapsed.
Click to expand it.
src/system/Logic.java
+
0
−
2
View file @
96f77885
...
...
@@ -6,7 +6,6 @@ public interface Logic extends ComponentLifecycle {
public
void
printOrders
(
Iterable
<
Order
>
orders
);
//angepasst, damit der Zugriff ähnlich wie bei der printOrders(List<Order> orders) ist
public
void
printInventory
();
public
long
calculateTotal
(
Order
order
);
...
...
@@ -15,5 +14,4 @@ public interface Logic extends ComponentLifecycle {
public
void
fillOrder
(
Order
order
);
}
This diff is collapsed.
Click to expand it.
test/model/CustomerTest.java
+
1
−
1
View file @
96f77885
...
...
@@ -164,7 +164,7 @@ public class CustomerTest {
// MUST throw exception
NoSuchElementException
nse
=
assertThrows
(
NoSuchElementException
.
class
,
()
->
{
Customer
cLarryNotFound
=
customerData
.
findById
(
"XX--invaild_id--??//"
).
get
();
System
.
out
.
println
(
cLarryNotFound
.
getLastName
());
assertNull
(
cLarryNotFound
);
});
assertNotNull
(
nse
);
...
...
This diff is collapsed.
Click to expand it.
test/system/LogicTest.java
+
34
−
35
View file @
96f77885
...
...
@@ -6,12 +6,12 @@ import static org.junit.Assert.assertSame;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
org.junit.After
;
import
org.junit.AfterClass
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
data_access.DataAccess
;
import
data_access.DataRepository
;
...
...
@@ -21,13 +21,13 @@ import model.CustomerTest;
import
model.Order
;
import
model.OrderItem
;
import
testsuites.TestBuilder
;
/**
*
* JUnit4 tests for Logic interface.
*
* Use of assertions, see:
* https://junit.org/junit4/javadoc/latest/org/junit/Assert.html
* Use of assertions, see:
* https://junit.org/junit4/javadoc/latest/org/junit/Assert.html
*
* @author sgra64
*/
...
...
@@ -35,7 +35,7 @@ public class LogicTest {
/*
* Constants to compare expected results.
*/
*/
private
final
static
long
idO5234
=
5234968294L
;
// id of Eric's 1st order
private
final
static
long
idO8592
=
8592356245L
;
// id of Eric's 2nd order
private
final
static
long
idO3563
=
3563561357L
;
// id of Anne's order
...
...
@@ -51,30 +51,29 @@ public class LogicTest {
private
DataRepository
<
Article
,
String
>
articleData
=
null
;
private
DataRepository
<
Order
,
Long
>
orderData
=
null
;
/**
* JUnit4 Test Setup Code
* ------------------------------------------------------------------------
* Setup method invoked once before any @Test method is executed.
*
* Setup method invoked once before any @Test method is executed.
*
* @throws Exception
*/
@BeforeClass
public
static
void
setUpBeforeClass
()
throws
Exception
{
public
static
void
setUpBeforeClass
()
throws
Exception
{
// System.out.println( LogicTest.class.getSimpleName() + ".setUpBeforeClass()
// called." );
// called." );
}
/**
* Setup method executed each time before a @Test method executes. Each @Test
* method executes with a new instance of this class.
*
* method executes with a new instance of this class.
*
* @throws Exception
*/
@Before
public
void
setUp
()
throws
Exception
{
// System.out.println( this.getClass().getSimpleName() + ".setUp() called." );
public
void
setUp
()
throws
Exception
{
// System.out.println( this.getClass().getSimpleName() + ".setUp() called." );
TestBuilder
tb
=
TestBuilder
.
getInstance
();
DataAccess
da
=
tb
.
dataAccess
();
this
.
logic
=
tb
.
logic
();
...
...
@@ -82,7 +81,7 @@ public class LogicTest {
this
.
articleData
=
da
.
getArticleData
();
this
.
orderData
=
da
.
getOrderData
();
}
/**
* JUnit4 Test Code
* ------------------------------------------------------------------------
...
...
@@ -90,7 +89,7 @@ public class LogicTest {
@Test
public
void
testOrderItems
()
{
assertNotNull
(
orderData
);
// Eric's 1st order
...
...
@@ -108,11 +107,11 @@ public class LogicTest {
OrderItem
oi5234_1
=
items5234
.
get
(
0
);
Article
a3
=
oi5234_1
.
getArticle
();
Article
a3x
=
articleData
.
findById
(
"SKU-518957"
).
get
();
assertSame
(
a3
,
a3x
);
assertSame
(
a3
,
a3x
);
}
@Test
public
void
testOrderCalculations
()
{
public
void
testOrderCalculations
()
{
Order
o5234
=
orderData
.
findById
(
idO5234
).
get
();
// 2000, 319
long
total5234
=
logic
.
calculateTotal
(
o5234
);
assertEquals
(
total5234
,
2000L
);
...
...
@@ -123,32 +122,31 @@ public class LogicTest {
assertEquals
(
logic
.
calculateTotal
(
o8592
),
4984L
);
assertEquals
(
logic
.
calculateIncludedVAT
(
o8592
),
796
);
Order
o3563
=
orderData
.
findById
(
idO3563
).
get
();
// 2000, 3
19
Order
o3563
=
orderData
.
findById
(
idO3563
).
get
();
// 2000, 3
20
assertEquals
(
logic
.
calculateTotal
(
o3563
),
2000L
);
assertEquals
(
logic
.
calculateIncludedVAT
(
o3563
),
320
);
Order
o6135
=
orderData
.
findById
(
idO6135
).
get
();
// 7788,124
3
Order
o6135
=
orderData
.
findById
(
idO6135
).
get
();
// 7788,124
4
assertEquals
(
logic
.
calculateTotal
(
o6135
),
7788L
);
assertEquals
(
logic
.
calculateIncludedVAT
(
o6135
),
1244
);
Order
o9235
=
orderData
.
findById
(
idO9235
).
get
();
// 4793, 76
5
Order
o9235
=
orderData
.
findById
(
idO9235
).
get
();
// 4793, 76
6
assertEquals
(
logic
.
calculateTotal
(
o9235
),
4793L
);
assertEquals
(
logic
.
calculateIncludedVAT
(
o9235
),
766
);
Order
o7335
=
orderData
.
findById
(
idO7335
).
get
();
// 5191, 829
assertEquals
(
logic
.
calculateTotal
(
o7335
),
5191L
);
System
.
out
.
println
(
logic
.
calculateTotal
(
o7335
));
assertEquals
(
logic
.
calculateIncludedVAT
(
o7335
),
829
);
Order
o7356
=
orderData
.
findById
(
idO7356
).
get
();
// 3894, 622
assertEquals
(
logic
.
calculateTotal
(
o7356
),
3894L
);
assertEquals
(
logic
.
calculateIncludedVAT
(
o7356
),
622
);
assertEquals
(
logic
.
calculateIncludedVAT
(
o7356
),
622
);
}
@Test
public
void
testTotalOrderValue
()
{
long
total
=
0L
;
long
vat
=
0L
;
long
vat
=
0L
;
for
(
Order
order
:
orderData
.
findAll
())
{
long
orderTotal
=
0L
;
for
(
OrderItem
item
:
order
.
getItems
())
{
...
...
@@ -160,19 +158,20 @@ public class LogicTest {
long
vatCalculated
=
logic
.
calculateIncludedVAT
(
order
);
vat
+=
vatCalculated
;
}
assertEquals
(
total
,
30650L
);
// total order value: 306,50; 48,9
3
VAT
assertEquals
(
total
,
30650L
);
// total order value: 306,50; 48,9
7
VAT
assertEquals
(
vat
,
4897L
);
}
}
/**
* JUnit4 Test Tear-down Code
* ------------------------------------------------------------------------
*
* Tear-down method invoked each time after a @Test method has finished.
*
* Tear-down method invoked each time after a @Test method has finished.
*
* @throws Exception
*/
@After
public
void
tearDown
()
throws
Exception
{
public
void
tearDown
()
throws
Exception
{
// System.out.println( this.getClass().getSimpleName() + ".tearDown() called."
// );
}
...
...
@@ -180,14 +179,14 @@ public class LogicTest {
/**
* Tear-down method invoked once after all @Test methods in this class have
* finished.
*
*
* @throws Exception
*/
@AfterClass
public
static
void
tearDownAfterClass
()
throws
Exception
{
public
static
void
tearDownAfterClass
()
throws
Exception
{
// System.out.println( LogicTest.class.getSimpleName() + ".tearDownAfterClass()
// called." );
// called." );
TestBuilder
.
getInstance
().
tearDown
();
}
}
}
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