### Question:
SystemArguments { public static Optional<ProfileId> getProfileIdFromArgs(NamespaceId namespaceId, Map<String, String> args) { if (args.containsKey(PROFILE_NAME)) { String scopedProfile = args.get(SystemArguments.PROFILE_NAME); ProfileId profileId = ProfileId.fromScopedName(namespaceId, scopedProfile); return Optional.of(profileId); } return Optional.empty(); } private  SystemArguments(); static Map<String, Level> getLogLevels(Map<String, String> args); static boolean isProgramMetricsEnabled(Map<String, String> args, boolean defaultValue); static void setLogLevel(Arguments args, LogAppenderInitializer initializer); static void setTransactionTimeout(Map<String, String> args, int timeout); static int getTransactionTimeout(Map<String, String> args, CConfiguration cConf); static void validateTransactionTimeout(Map<String, String> args, CConfiguration cConf); static void validateTransactionTimeout(Map<String, String> args, CConfiguration cConf,
                                                @Nullable String scope, @Nullable String name); static RetryStrategy getRetryStrategy(Map<String, String> args, ProgramType programType,
                                               CConfiguration cConf); static Resources getResources(Arguments args, @Nullable Resources defaultResources); static Resources getResources(Map<String, String> args, @Nullable Resources defaultResources); static Map<String, String> getTwillApplicationConfigs(Map<String, String> args); static Map<String, String> getTwillContainerConfigs(Map<String, String> args, int containerMemory); static T configureNettyHttpService(Map<String, String> args, T builder); static ProfileId getProfileIdForProgram(ProgramId programId, Map<String, String> args); static boolean isProfileAllowed(ProgramType programType); static Optional<ProfileId> getProfileIdFromArgs(NamespaceId namespaceId, Map<String, String> args); static void addProfileArgs(Map<String, String> args, Profile profile); static String getProfileProvisioner(Map<String, String> args); static RuntimeMonitorType getRuntimeMonitorType(CConfiguration cConf, ProgramOptions programOptions); static Map<String, String> getProfileProperties(Map<String, String> args); static final String MEMORY_KEY; static final String CORES_KEY; static final String RESERVED_MEMORY_KEY_OVERRIDE; static final String TRANSACTION_TIMEOUT; static final String METRICS_ENABLED; static final String METRICS_CONTEXT_TASK_INCLUDED; static final String SERVICE_THREADS; static final String SERVICE_THREAD_KEEPALIVE_SECS; static final String PROFILE_NAME; static final String PROFILE_PROVISIONER; static final String PROFILE_PROPERTIES_PREFIX; static final String RUNTIME_KEYTAB_PATH; static final String RUNTIME_PRINCIPAL_NAME; static final String RUNTIME_MONITOR_TYPE; }### Answer:
@Test public void testGetProfileId() { Assert.assertFalse(SystemArguments.getProfileIdFromArgs(NamespaceId.DEFAULT, Collections.emptyMap()).isPresent()); Map<String, String> args = new HashMap<>(); args.put("system.log.level", "DEBUG"); args.put("system.log.leveldummyKey", "ERROR"); Assert.assertFalse(SystemArguments.getProfileIdFromArgs(NamespaceId.DEFAULT, args).isPresent()); ProfileId expected = NamespaceId.DEFAULT.profile("MyProfile"); args.put("system.profile.name", expected.getProfile()); Assert.assertEquals(expected, SystemArguments.getProfileIdFromArgs(NamespaceId.DEFAULT, args).get()); expected = NamespaceId.SYSTEM.profile("MyProfile"); args.put("system.profile.name", expected.getScopedName()); Assert.assertEquals(expected, SystemArguments.getProfileIdFromArgs(NamespaceId.DEFAULT, args).get()); expected = NamespaceId.DEFAULT.profile("MyProfile"); args.put("system.profile.name", expected.getScopedName()); Assert.assertEquals(expected, SystemArguments.getProfileIdFromArgs(NamespaceId.DEFAULT, args).get()); }