use of structural.proxy.style1.Subject in project act-platform by mnemonic-no.
the class SubjectInfoServiceAccountResolverTest method testResolveCachesSubject.
@Test
public void testResolveCachesSubject() throws Exception {
Subject model = Subject.builder().setId(UUID.randomUUID()).build();
when(subjectResolver.resolveSubject(notNull(), isA(UUID.class))).thenReturn(model);
resolver.apply(model.getId());
assertEquals(1, subjectCache.size());
assertSame(model, subjectCache.get(model.getId()));
}
use of structural.proxy.style1.Subject in project act-platform by mnemonic-no.
the class SubjectInfoServiceAccountResolverTest method testResolvePreviouslyCachedSubject.
@Test
public void testResolvePreviouslyCachedSubject() {
Subject model = Subject.builder().setId(UUID.randomUUID()).setName("name").build();
subjectCache.put(model.getId(), model);
SubjectInfoSEB seb = resolver.apply(model.getId());
assertNotNull(seb);
assertEquals(model.getId(), seb.getId());
assertEquals(model.getName(), seb.getName());
verifyNoInteractions(subjectResolver);
}
use of structural.proxy.style1.Subject in project act-platform by mnemonic-no.
the class SubjectByIdResponseResolverTest method testConvertUncachedSubjectNotAvailable.
@Test
public void testConvertUncachedSubjectNotAvailable() throws Exception {
UUID id = UUID.randomUUID();
Subject model = converter.apply(id);
assertNotNull(model);
assertEquals(id, model.getId());
assertEquals("N/A", model.getName());
verify(subjectResolver).resolveSubject(notNull(), eq(id));
}
use of structural.proxy.style1.Subject in project act-platform by mnemonic-no.
the class SubjectByIdResponseResolverTest method testConvertUncachedSubjectWithInvalidCredentials.
@Test
public void testConvertUncachedSubjectWithInvalidCredentials() throws Exception {
UUID id = UUID.randomUUID();
when(subjectResolver.resolveSubject(notNull(), isA(UUID.class))).thenThrow(InvalidCredentialsException.class);
Subject model = converter.apply(id);
assertNotNull(model);
assertEquals(id, model.getId());
assertEquals("N/A", model.getName());
verify(subjectResolver).resolveSubject(notNull(), eq(id));
}
use of structural.proxy.style1.Subject in project act-platform by mnemonic-no.
the class SubjectByIdResponseResolverTest method testConvertUncachedSubject.
@Test
public void testConvertUncachedSubject() throws Exception {
UUID id = UUID.randomUUID();
Subject model = Subject.builder().build();
when(subjectResolver.resolveSubject(notNull(), isA(UUID.class))).thenReturn(model);
assertSame(model, converter.apply(id));
verify(subjectResolver).resolveSubject(notNull(), eq(id));
}
Aggregations