File tree 3 files changed +41
-0
lines changed
intro-gwtboot-springboot-shared
main/java/com/company/crm/shared
test/java/com/company/crm/shared
3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 24
24
<version >1.0.0-RC5</version >
25
25
<scope >provided</scope >
26
26
</dependency >
27
+
28
+ <dependency >
29
+ <groupId >org.junit.jupiter</groupId >
30
+ <artifactId >junit-jupiter-engine</artifactId >
31
+ <version >5.8.1</version >
32
+ <scope >test</scope >
33
+ </dependency >
27
34
</dependencies >
28
35
29
36
<build >
Original file line number Diff line number Diff line change
1
+ package com .company .crm .shared ;
2
+
3
+ public class FieldVerifier {
4
+
5
+ public static boolean isValidName (String name ) {
6
+ if (name == null ) {
7
+ return false ;
8
+ }
9
+ return name .length () > 3 ;
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ package com .company .crm .shared ;
2
+
3
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
4
+
5
+ import org .junit .jupiter .api .Test ;
6
+
7
+ class FieldVerifierTest {
8
+
9
+ @ Test
10
+ void name_less_than_3_chars_not_valid () {
11
+ boolean validName = FieldVerifier .isValidName ("Lof" );
12
+
13
+ assertTrue (!validName );
14
+ }
15
+
16
+ @ Test
17
+ void name_longer_than_3_chars_valid () {
18
+ boolean validName = FieldVerifier .isValidName ("Lofi" );
19
+
20
+ assertTrue (validName );
21
+ }
22
+
23
+ }
You can’t perform that action at this time.
0 commit comments