Skip to content

Commit 3c4a517

Browse files
committed
BAEL-2492 Rename WireMockScenario test class
2 parents 0da5c11 + e2988ce commit 3c4a517

106 files changed

Lines changed: 3473 additions & 768 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.baeldung.traits
2+
3+
trait AnimalTrait {
4+
5+
String basicBehavior() {
6+
return "Animalistic!!"
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.traits
2+
3+
class Dog implements WalkingTrait, SpeakingTrait {
4+
5+
String speakAndWalk() {
6+
WalkingTrait.super.speakAndWalk()
7+
}
8+
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.baeldung.traits
2+
3+
class Employee implements UserTrait {
4+
5+
String name() {
6+
return 'Bob'
7+
}
8+
9+
String lastName() {
10+
return "Marley"
11+
}
12+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.baeldung.traits
2+
3+
interface Human {
4+
5+
String lastName()
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.baeldung.traits
2+
3+
trait SpeakingTrait {
4+
5+
String basicAbility() {
6+
return "Speaking!!"
7+
}
8+
9+
String speakAndWalk() {
10+
return "Speak and walk!!"
11+
}
12+
13+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.baeldung.traits
2+
3+
trait UserTrait implements Human {
4+
5+
String sayHello() {
6+
return "Hello!"
7+
}
8+
9+
abstract String name()
10+
11+
String showName() {
12+
return "Hello, ${name()}!"
13+
}
14+
15+
private String greetingMessage() {
16+
return 'Hello, from a private method!'
17+
}
18+
19+
String greet() {
20+
def msg = greetingMessage()
21+
println msg
22+
msg
23+
}
24+
25+
def whoAmI() {
26+
return this
27+
}
28+
29+
String showLastName() {
30+
return "Hello, ${lastName()}!"
31+
}
32+
33+
String email
34+
String address
35+
}
36+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.baeldung.traits
2+
3+
trait WalkingTrait {
4+
5+
String basicAbility() {
6+
return "Walking!!"
7+
}
8+
9+
String speakAndWalk() {
10+
return "Walk and speak!!"
11+
}
12+
13+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package groovy.com.baeldung.stringtypes
2+
3+
import org.junit.Assert
4+
import org.junit.Test
5+
6+
class CharacterInGroovy {
7+
8+
@Test
9+
void 'character'() {
10+
char a = 'A' as char
11+
char b = 'B' as char
12+
char c = (char) 'C'
13+
14+
Assert.assertTrue(a instanceof Character)
15+
Assert.assertTrue(b instanceof Character)
16+
Assert.assertTrue(c instanceof Character)
17+
}
18+
19+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package groovy.com.baeldung.stringtypes
2+
3+
import org.junit.Test
4+
5+
class DollarSlashyString {
6+
7+
@Test
8+
void 'dollar slashy string'() {
9+
def name = "John"
10+
11+
def dollarSlashy = $/
12+
Hello $name!,
13+
14+
I can show you $ sign or escaped dollar sign: $$
15+
Both slashes works: \ or /, but we can still escape it: $/
16+
17+
We have to escape opening and closing delimiter:
18+
- $$$/
19+
- $/$$
20+
/$
21+
22+
print(dollarSlashy)
23+
}
24+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package groovy.com.baeldung.stringtypes
2+
3+
import org.junit.Assert
4+
import org.junit.Test
5+
6+
class DoubleQuotedString {
7+
8+
@Test
9+
void 'escape double quoted string'() {
10+
def example = "Hello \"world\"!"
11+
12+
println(example)
13+
}
14+
15+
@Test
16+
void 'String ang GString'() {
17+
def string = "example"
18+
def stringWithExpression = "example${2}"
19+
20+
Assert.assertTrue(string instanceof String)
21+
Assert.assertTrue(stringWithExpression instanceof GString)
22+
Assert.assertTrue(stringWithExpression.toString() instanceof String)
23+
}
24+
25+
@Test
26+
void 'placeholder with variable'() {
27+
def name = "John"
28+
def helloName = "Hello $name!".toString()
29+
30+
Assert.assertEquals("Hello John!", helloName)
31+
}
32+
33+
@Test
34+
void 'placeholder with expression'() {
35+
def result = "result is ${2 * 2}".toString()
36+
37+
Assert.assertEquals("result is 4", result)
38+
}
39+
40+
@Test
41+
void 'placeholder with dotted access'() {
42+
def person = [name: 'John']
43+
44+
def myNameIs = "I'm $person.name, and you?".toString()
45+
46+
Assert.assertEquals("I'm John, and you?", myNameIs)
47+
}
48+
49+
@Test
50+
void 'placeholder with method call'() {
51+
def name = 'John'
52+
53+
def result = "Uppercase name: ${name.toUpperCase()}".toString()
54+
55+
Assert.assertEquals("Uppercase name: JOHN", result)
56+
}
57+
58+
59+
@Test
60+
void 'GString and String hashcode'() {
61+
def string = "2+2 is 4"
62+
def gstring = "2+2 is ${4}"
63+
64+
Assert.assertTrue(string.hashCode() != gstring.hashCode())
65+
}
66+
67+
}

0 commit comments

Comments
 (0)