Skip to content

Commit

Permalink
Added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakhi Agrawal committed Oct 9, 2024
1 parent e224dcf commit 8bb1ad4
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.linkedin.metadata.dao.ingestion.preupdate;

import com.google.protobuf.Message;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import static org.testng.AssertJUnit.*;
import static org.mockito.Mockito.*;


public class PreRoutingInfoTest {
private PreRoutingInfo routingInfo;
private PreUpdateRoutingClient<? extends Message> mockPreUpdateClient;

@BeforeMethod
public void setUp() {
routingInfo = new PreRoutingInfo();
mockPreUpdateClient = mock(PreUpdateRoutingClient.class);
}

@Test
public void testPreUpdateClientSetterAndGetter() {
routingInfo.setPreUpdateClient(mockPreUpdateClient);
assertEquals(mockPreUpdateClient, routingInfo.getPreUpdateClient());
}

@Test
public void testRoutingActionEnum() {
assertEquals("PROCEED", PreRoutingInfo.RoutingAction.PROCEED.name());
assertEquals("SKIP", PreRoutingInfo.RoutingAction.SKIP.name());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.linkedin.metadata.dao.ingestion.preupdate;

import com.linkedin.data.template.RecordTemplate;
import org.testng.annotations.Test;

import static org.mockito.Mockito.*;
import static org.testng.AssertJUnit.*;


public class PreUpdateResponseTest {

@Test
public void testConstructorAndGetter() {
// Create a mock instance of RecordTemplate
RecordTemplate mockAspect = mock(RecordTemplate.class);

// Create an instance of PreUpdateResponse with the mock aspect
PreUpdateResponse<RecordTemplate> response = new PreUpdateResponse<>(mockAspect);

// Verify that the getter returns the correct value
assertEquals(mockAspect, response.getUpdatedAspect());
}
}

0 comments on commit 8bb1ad4

Please sign in to comment.