Corrected the file names

This commit is contained in:
Amitabh Tiwari 2020-11-03 19:13:59 +05:30
parent 080dd2f226
commit be3614c157
4 changed files with 31 additions and 23 deletions

View File

@ -0,0 +1,16 @@
package com.baeldung.exceptions.nosuchfielderror;
public class FieldErrorExample {
public static void main(String... args) {
fetchAndPrint();
}
public static String getDependentMessage() {
return Dependent.message;
}
public static void fetchAndPrint() {
System.out.println(getDependentMessage());
}
}

View File

@ -1,8 +0,0 @@
package com.baeldung.exceptions.nosuchfielderror;
public class NoSuchFieldErrorExample {
public static String getDependentMessage() {
return Dependent.message;
}
}

View File

@ -0,0 +1,15 @@
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));
}
}

View File

@ -1,15 +0,0 @@
package com.baeldung.exceptions.nosuchfielderror;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class NoSuchFieldErrorExampleUnitTest {
@Test
public void whenDependentMessage_returnMessage() {
String dependentMessage = NoSuchFieldErrorExample.getDependentMessage();
assertTrue("Hello Baeldung".equals(dependentMessage));
}
}