Hi all i receive Nullpointer when trying to execute this unit test.I want to test e class which receive 3 parameters and returns a string. I think i need to make @Before or something else but it didn't works. Do you have suggestions...Thanks !
public class UrlConstructorTest { private UrlConstructor urlConstructor; @Before public void setUp() { urlConstructor = new UrlConstructor(); } public static final String TEST_UPDATE_MANIFEST_SR = "/packages/proxyId/test/test1/123/test3/test_test"; @Test public void constructUpdateManifestSrInSasTokenTest() { String result = urlConstructor.composeDeviceRegistrationUrl("test","test123","test"); System.out.println(result); assertNotNull(result); assertEquals(TEST, result); } } UrlConstructor is define like this:
@Component public class UrlConstructor { And this is the method in this class:
public String composeDUrl(String deviceId, String scopeId) { return String.format(Constants.socpe, tes, test); } 
@Autowired private UrlConstructor urlConstructor;@Beforeis JUnit 4,@BeforeEachis the equivalent for JUnit 5.