FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java_upgrade/src/test/java/optional/ProductDAOTest.java at master · MSMyanmar/java_upgrade · GitHub
MSMyanmar
/
java_upgrade
Public
forked from
kousen/java_upgrade
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java_upgrade
/
src
/
test
/
java
/
optional
/
ProductDAOTest.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (28 loc) · 886 Bytes
Breadcrumbs
java_upgrade
/
src
/
test
/
java
/
optional
/
ProductDAOTest.java
Copy path
File metadata and controls
36 lines (28 loc) · 886 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package
optional
;
import
org
.
junit
.
Test
;
import
java
.
util
.
Optional
;
import
java
.
util
.
stream
.
IntStream
;
import
static
org
.
junit
.
Assert
.*;
public
class
ProductDAOTest
{
private
ProductDAO
dao
=
new
ProductDAO
();
@
Test
public
void
findById_exists
() {
IntStream
.
rangeClosed
(
1
,
3
)
.
forEach
(
id
->
assertTrue
(
dao
.
findById
(
id
).
isPresent
()));
}
@
Test
public
void
findById_doesNotExist
() {
Optional
<
Product
>
optionalProduct
=
dao
.
findById
(
999
);
assertFalse
(
optionalProduct
.
isPresent
());
}
@
Test
public
void
getProductById_exists
() {
Product
product
=
dao
.
getProductById
(
1
);
assertEquals
(
1
,
product
.
getId
().
intValue
());
}
@
Test
public
void
getProductById_doesNotExist
() {
Product
product
=
dao
.
getProductById
(
999
);
assertEquals
(
999
,
product
.
getId
().
intValue
());
}
}
Back
|
FazBrowse Home
|
New Git URL