@Test public void createByUser_must_be_citizen() throws Exception { try { Account tourist = savedAccountTourist("tourist"); accountDao.changeTotalVotedDebate(tourist.getAccountId(), 10, 0); service.createByUser("aaa", "this is aaa", tourist); fail("AccessDeniedException expected"); } catch (AccessDeniedException expected) { } }
@Override public ZoneInfo createByUser(String zone, String aliasName, Authorization creator) throws CreditNotEnoughException { Account account = verifyAuthority(creator).flatMap(this::verifyCredit).get(); ZoneInfo zoneInfo = ZoneInfo.createDefault(zone, aliasName, Instant.now()) .withAdmins(singletonList(account.getAccountId())); zoneDao.create(zoneInfo); return zoneInfo; }
ZoneServiceImpl implements ZoneService { @Override public ZoneInfo createByUser(String zone, String aliasName, Authorization creator) throws CreditNotEnoughException { Account account = verifyAuthority(creator).flatMap(this::verifyCredit).get(); ZoneInfo zoneInfo = ZoneInfo.createDefault(zone, aliasName, Instant.now()) .withAdmins(singletonList(account.getAccountId())); zoneDao.create(zoneInfo); return zoneInfo; } }
ZoneServiceImpl implements ZoneService { @Override public ZoneInfo createByUser(String zone, String aliasName, Authorization creator) throws CreditNotEnoughException { Account account = verifyAuthority(creator).flatMap(this::verifyCredit).get(); ZoneInfo zoneInfo = ZoneInfo.createDefault(zone, aliasName, Instant.now()) .withAdmins(singletonList(account.getAccountId())); zoneDao.create(zoneInfo); return zoneInfo; }  }
ZoneServiceImpl implements ZoneService { @Override public ZoneInfo createByUser(String zone, String aliasName, Authorization creator) throws CreditNotEnoughException { Account account = verifyAuthority(creator).flatMap(this::verifyCredit).get(); ZoneInfo zoneInfo = ZoneInfo.createDefault(zone, aliasName, Instant.now()) .withAdmins(singletonList(account.getAccountId())); zoneDao.create(zoneInfo); return zoneInfo; }  @Override ZoneInfo loadZone(Zone zone); @Override ZoneInfo createDefault(String zone, String aliasName); @Override ZoneInfo createKaif(String zone, String aliasName); @Override void updateTheme(Zone zone, String theme); @Override Map<String, List<ZoneInfo>> listZoneAtoZ(); @Override List<ZoneInfo> listRecommendZones(); @Override List<ZoneInfo> listCitizenZones(); @Override ZoneInfo createByUser(String zone, String aliasName, Authorization creator); @Override List<ZoneInfo> listAdministerZones(String username); @Override boolean isZoneAvailable(String zone); @Override boolean canCreateZone(Authorization authorization); @Override List<String> listAdministratorsWithCache(Zone zone); }
ZoneServiceImpl implements ZoneService { @Override public ZoneInfo createByUser(String zone, String aliasName, Authorization creator) throws CreditNotEnoughException { Account account = verifyAuthority(creator).flatMap(this::verifyCredit).get(); ZoneInfo zoneInfo = ZoneInfo.createDefault(zone, aliasName, Instant.now()) .withAdmins(singletonList(account.getAccountId())); zoneDao.create(zoneInfo); return zoneInfo; }  @Override ZoneInfo loadZone(Zone zone); @Override ZoneInfo createDefault(String zone, String aliasName); @Override ZoneInfo createKaif(String zone, String aliasName); @Override void updateTheme(Zone zone, String theme); @Override Map<String, List<ZoneInfo>> listZoneAtoZ(); @Override List<ZoneInfo> listRecommendZones(); @Override List<ZoneInfo> listCitizenZones(); @Override ZoneInfo createByUser(String zone, String aliasName, Authorization creator); @Override List<ZoneInfo> listAdministerZones(String username); @Override boolean isZoneAvailable(String zone); @Override boolean canCreateZone(Authorization authorization); @Override List<String> listAdministratorsWithCache(Zone zone);  }