use of rocks.coffeenet.autoconfigure.discovery.service.CoffeeNetApp in project coffeenet-starter by coffeenet.
the class CoffeeNetNavigationServiceImplTest method getNoUser.
@Test
public void getNoUser() {
when(dataExtractorMock.extractUser()).thenReturn(Optional.empty());
Optional<CoffeeNetNavigationAppInformation> coffeeNetNavigationAppInformation = Optional.of(new CoffeeNetNavigationAppInformation("groupId", "artifactId", "0.1.0", "parent-groupId", "parent-artifactId", "0.2.0"));
when(dataExtractorMock.extractAppInformation()).thenReturn(coffeeNetNavigationAppInformation);
Map<String, List<CoffeeNetApp>> apps = new HashMap<>();
CoffeeNetApp coffeeNetApp = new CoffeeNetApp("Coffee App", "coffeeapp.coffeenet", emptySet());
apps.put("apps", singletonList(coffeeNetApp));
CoffeeNetApp profileApp = new CoffeeNetApp("Profile", "profile.coffeenet", emptySet());
apps.put("profile", singletonList(profileApp));
when(dataExtractorMock.extractApps()).thenReturn(Optional.of(apps));
when(dataExtractorMock.extractLogoutPath()).thenReturn("/logout");
CoffeeNetNavigationInformation coffeeNetNavigationInformation = sut.get();
assertThat(coffeeNetNavigationInformation.getLogoutPath()).isEqualTo("/logout");
assertThat(coffeeNetNavigationInformation.getCurrentCoffeeNetUser()).isNull();
Assertions.assertThat(coffeeNetNavigationInformation.getProfileApp()).isSameAs(profileApp);
Assertions.assertThat(coffeeNetNavigationInformation.getCoffeeNetApps()).hasSize(1);
Assertions.assertThat(coffeeNetNavigationInformation.getCoffeeNetApps().get(0)).isSameAs(coffeeNetApp);
assertThat(coffeeNetNavigationInformation.getCoffeeNetNavigationAppInformation()).isSameAs(coffeeNetNavigationAppInformation.get());
}
use of rocks.coffeenet.autoconfigure.discovery.service.CoffeeNetApp in project coffeenet-starter by coffeenet.
the class CoffeeNetNavigationServiceImplTest method get.
@Test
public void get() {
Optional<CurrentCoffeeNetUser> coffeeNetWebUser = Optional.of(new CurrentCoffeeNetUser("username", "email"));
when(dataExtractorMock.extractUser()).thenReturn(coffeeNetWebUser);
Optional<CoffeeNetNavigationAppInformation> coffeeNetNavigationAppInformation = Optional.of(new CoffeeNetNavigationAppInformation("groupId", "artifactId", "0.1.0", "parent-groupId", "parent-artifactId", "0.2.0"));
when(dataExtractorMock.extractAppInformation()).thenReturn(coffeeNetNavigationAppInformation);
Map<String, List<CoffeeNetApp>> apps = new HashMap<>();
CoffeeNetApp coffeeNetApp = new CoffeeNetApp("Coffee App", "coffeeapp.coffeenet", emptySet());
apps.put("apps", singletonList(coffeeNetApp));
CoffeeNetApp profileApp = new CoffeeNetApp("Profile", "profile.coffeenet", emptySet());
apps.put("profile", singletonList(profileApp));
when(dataExtractorMock.extractApps()).thenReturn(Optional.of(apps));
when(dataExtractorMock.extractLogoutPath()).thenReturn("/logout");
CoffeeNetNavigationInformation coffeeNetNavigationInformation = sut.get();
assertThat(coffeeNetNavigationInformation.getLogoutPath()).isEqualTo("/logout");
assertThat(coffeeNetNavigationInformation.getCurrentCoffeeNetUser().getUsername()).isSameAs("username");
assertThat(coffeeNetNavigationInformation.getCurrentCoffeeNetUser().getEmail()).isSameAs("email");
Assertions.assertThat(coffeeNetNavigationInformation.getProfileApp()).isSameAs(profileApp);
Assertions.assertThat(coffeeNetNavigationInformation.getCoffeeNetApps()).hasSize(1);
Assertions.assertThat(coffeeNetNavigationInformation.getCoffeeNetApps().get(0)).isSameAs(coffeeNetApp);
assertThat(coffeeNetNavigationInformation.getCoffeeNetNavigationAppInformation()).isSameAs(coffeeNetNavigationAppInformation.get());
}
Aggregations