@Test
public void testUpdateAgentInstanceAttributes() {

    ExtTestSubscriber<Object> testSubscriber = new ExtTestSubscriber<>();
    AgentInstance agentInstance = instanceSet0.get(0);
    String agentInstanceId = agentInstance.getId();
    assertThat(agentInstance.getAttributes()).isEmpty();
    Map<String, String> attributes = Collections.singletonMap("a", "1");
    when(agentCache.updateAgentInstanceStore(eq(agentInstanceId), any()))
            .thenReturn(Single.just(agentInstance.toBuilder().withAttributes(attributes).build()));
    service.updateAgentInstanceAttributes(agentInstance.getId(), attributes).toObservable().subscribe(testSubscriber);
    verify(agentCache, times(1)).updateAgentInstanceStore(eq(agentInstanceId), any());
}