@Test public void immutableRequiredApps() { List<String> ra = REQ_APPS_UNSAFE; Application app = new DefaultApplication(APP_ID, VER, TITLE, DESC, ORIGIN, CATEGORY, URL, README, ICON, ROLE, PERMS, Optional.of(FURL), FEATURES, ra); List<String> reqApps = app.requiredApps(); try { reqApps.add(EVIL); } catch (UnsupportedOperationException e) { } assertTrue("no fifi required app", reqApps.contains(FIFI)); assertEquals("extra required apps!", 1, reqApps.size()); }
@Override public List<String> requiredApps() { return requiredApps; }
DefaultApplication implements Application { @Override public List<String> requiredApps() { return requiredApps; } }
DefaultApplication implements Application { @Override public List<String> requiredApps() { return requiredApps; } DefaultApplication(ApplicationId appId, Version version, String title,
                              String description, String origin, String category,
                              String url, String readme, byte[] icon,
                              ApplicationRole role, Set<Permission> permissions,
                              Optional<URI> featuresRepo, List<String> features,
                              List<String> requiredApps); }
DefaultApplication implements Application { @Override public List<String> requiredApps() { return requiredApps; } DefaultApplication(ApplicationId appId, Version version, String title,
                              String description, String origin, String category,
                              String url, String readme, byte[] icon,
                              ApplicationRole role, Set<Permission> permissions,
                              Optional<URI> featuresRepo, List<String> features,
                              List<String> requiredApps); @Override ApplicationId id(); @Override Version version(); @Override String title(); @Override String description(); @Override String category(); @Override String url(); @Override String readme(); @Override byte[] icon(); @Override String origin(); @Override ApplicationRole role(); @Override Set<Permission> permissions(); @Override Optional<URI> featuresRepo(); @Override List<String> features(); @Override List<String> requiredApps(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
DefaultApplication implements Application { @Override public List<String> requiredApps() { return requiredApps; } DefaultApplication(ApplicationId appId, Version version, String title,
                              String description, String origin, String category,
                              String url, String readme, byte[] icon,
                              ApplicationRole role, Set<Permission> permissions,
                              Optional<URI> featuresRepo, List<String> features,
                              List<String> requiredApps); @Override ApplicationId id(); @Override Version version(); @Override String title(); @Override String description(); @Override String category(); @Override String url(); @Override String readme(); @Override byte[] icon(); @Override String origin(); @Override ApplicationRole role(); @Override Set<Permission> permissions(); @Override Optional<URI> featuresRepo(); @Override List<String> features(); @Override List<String> requiredApps(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }