Commit 122593a7 authored by Abhishek Patil's avatar Abhishek Patil
Browse files

Removing unit test related to AppException

parent 7839f40a
Pipeline #20803 failed with stages
in 11 minutes and 51 seconds
......@@ -45,12 +45,6 @@ public class ServiceAccountClientImplTest {
final String tenantName = "Test Tenant";
final String validToken = "validToken";
@Mock
private ITenantFactory tenantInfoServiceProvider;
@Mock
private TenantInfo tenantInfo;
@Mock
private IdToken idToken;
......@@ -73,29 +67,9 @@ public class ServiceAccountClientImplTest {
@Before
public void setup() {
initMocks(this);
when(tenantInfo.getName()).thenReturn(tenantName);
when(this.tenantInfoServiceProvider.getTenantInfo(tenantName)).thenReturn(tenantInfo);
idToken = IdToken.builder().tokenValue(validToken).expirationTimeMillis(System.currentTimeMillis() + 10000000L).build();
}
@Test
public void should_throwAppException_getIdTokenTest() {
// Set up
when(this.tenantInfoServiceProvider.getTenantInfo(tenantName)).thenReturn(null);
try {
// Act
sut.getIdToken(tenantName);
// Assert
fail("Should throw exception");
} catch (AppException e) {
Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, e.getError().getCode());
Assert.assertEquals("Invalid tenant Name from azure", e.getError().getMessage());
} catch (Exception e) {
fail("Should not throw this exception" + e.getMessage());
}
}
@Test
public void should_getTokenFromCache_getIdTokenTest() {
// SetUp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment