BAEL-3769 | Writing templates for test cases using JUnit 5
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
package com.baeldung.junit5.templates;
|
||||
|
||||
public interface UserIdGenerator {
|
||||
String generate(String firstName, String lastName);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.junit5.templates;
|
||||
|
||||
public class UserIdGeneratorImpl implements UserIdGenerator {
|
||||
private boolean isFeatureEnabled;
|
||||
|
||||
public UserIdGeneratorImpl(boolean isFeatureEnabled) {
|
||||
this.isFeatureEnabled = isFeatureEnabled;
|
||||
}
|
||||
|
||||
public String generate(String firstName, String lastName) {
|
||||
String initialAndLastName = firstName.substring(0, 1)
|
||||
.concat(lastName);
|
||||
return isFeatureEnabled ? "bael".concat(initialAndLastName) : initialAndLastName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user