Merge pull request #10195 from amitiw4u/BAEL-4399-NoSuchFieldError
BAEL-4399:Changes for showing NoSuchFieldError
This commit is contained in:
commit
ce7b195b62
|
@ -0,0 +1,8 @@
|
|||
package com.baeldung.exceptions.nosuchfielderror;
|
||||
|
||||
public class Dependency {
|
||||
|
||||
// This needed to be commented post compilation of NoSuchFielDError and Compile
|
||||
public static String message = "Hello Baeldung!!";
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.baeldung.exceptions.nosuchfielderror;
|
||||
|
||||
public class FieldErrorExample {
|
||||
|
||||
public static void main(String... args) {
|
||||
|
||||
fetchAndPrint();
|
||||
}
|
||||
|
||||
public static String getDependentMessage() {
|
||||
|
||||
return Dependency.message;
|
||||
}
|
||||
|
||||
public static void fetchAndPrint() {
|
||||
|
||||
System.out.println(getDependentMessage());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.baeldung.exceptions.nosuchfielderror;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class FieldErrorExampleUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenDependentMessage_returnMessage() {
|
||||
|
||||
String dependentMessage = FieldErrorExample.getDependentMessage();
|
||||
assertTrue("Hello Baeldung!!".equals(dependentMessage));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue