@Test public void getMetadataGathersMetadataFromAllProviders() { when(this.provider1.provideMetadata(this.entity)).thenReturn(Collections.singletonMap("key1", "value1")); when(this.provider2.provideMetadata(this.entity)).thenReturn(Collections.singletonMap("key2", 2)); Map<String, Object> result = this.component.getMetadata(this.entity); Assert.assertEquals(2, result.size()); Assert.assertEquals("value1", result.get("key1")); Assert.assertEquals(2, result.get("key2")); }
@Override public Map<String, Object> getMetadata(PrimaryEntity entity) { Map<String, Object> result = new HashMap<>(); this.allProviders.get().forEach(provider -> result.putAll(provider.provideMetadata(entity))); return result; }
DefaultPrimaryEntityMetadataManager implements PrimaryEntityMetadataManager { @Override public Map<String, Object> getMetadata(PrimaryEntity entity) { Map<String, Object> result = new HashMap<>(); this.allProviders.get().forEach(provider -> result.putAll(provider.provideMetadata(entity))); return result; } }
DefaultPrimaryEntityMetadataManager implements PrimaryEntityMetadataManager { @Override public Map<String, Object> getMetadata(PrimaryEntity entity) { Map<String, Object> result = new HashMap<>(); this.allProviders.get().forEach(provider -> result.putAll(provider.provideMetadata(entity))); return result; }  }
DefaultPrimaryEntityMetadataManager implements PrimaryEntityMetadataManager { @Override public Map<String, Object> getMetadata(PrimaryEntity entity) { Map<String, Object> result = new HashMap<>(); this.allProviders.get().forEach(provider -> result.putAll(provider.provideMetadata(entity))); return result; }  @Override Map<String, Object> getMetadata(PrimaryEntity entity); }
DefaultPrimaryEntityMetadataManager implements PrimaryEntityMetadataManager { @Override public Map<String, Object> getMetadata(PrimaryEntity entity) { Map<String, Object> result = new HashMap<>(); this.allProviders.get().forEach(provider -> result.putAll(provider.provideMetadata(entity))); return result; }  @Override Map<String, Object> getMetadata(PrimaryEntity entity);  }