BAEL-1852 moved the code into junit-5 module (#4915)
* BAEL-1852 moved the code into junit-5 module * BAEL-1852 removed junit-abstract module from parent-modules
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.baeldung.abstractclass.abstractmethod;
|
||||
|
||||
/**
|
||||
* When method calls abstract method.
|
||||
*/
|
||||
public abstract class AbstractMethodCalling {
|
||||
|
||||
public abstract String abstractFunc();
|
||||
|
||||
public String defaultImpl() {
|
||||
String res = abstractFunc();
|
||||
return (res == null) ? "Default" : (res + " Default");
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.baeldung.abstractclass.indepedentmethod;
|
||||
|
||||
/**
|
||||
* Test Independent Method
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractIndependent {
|
||||
|
||||
public abstract int abstractFunc();
|
||||
|
||||
public String defaultImpl() {
|
||||
return "DEFAULT-1";
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.baeldung.abstractclass.indepedentmethod;
|
||||
|
||||
public class ConcreteImpl extends AbstractIndependent {
|
||||
|
||||
@Override
|
||||
public int abstractFunc() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.baeldung.abstractclass.instancefields;
|
||||
|
||||
/**
|
||||
* Test Independent Method
|
||||
*/
|
||||
public abstract class AbstractInstanceFields {
|
||||
|
||||
protected int count;
|
||||
private boolean active = false;
|
||||
|
||||
public abstract int abstractFunc();
|
||||
|
||||
public String testFunc() {
|
||||
String response;
|
||||
if (count > 5) {
|
||||
response = "Overflow";
|
||||
} else {
|
||||
response = active ? "Added" : "Blocked";
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.baeldung.abstractclass.privatemethod;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public abstract class AbstractPrivateMethods {
|
||||
|
||||
public abstract int abstractFunc();
|
||||
|
||||
public String defaultImpl() {
|
||||
return getCurrentDateTime() + "DEFAULT-1";
|
||||
}
|
||||
|
||||
private String getCurrentDateTime() {
|
||||
return LocalDateTime.now()
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user