public static QueryOptimizer newOptimizer(HazelcastProperties properties) {
        HazelcastProperty property = ClusterProperty.QUERY_OPTIMIZER_TYPE;
        String string = properties.getString(property);
        Type type;
        try {
            type = Type.valueOf(string);
        } catch (IllegalArgumentException e) {
            throw onInvalidOptimizerType(string);
        }
        switch (type) {
            case RULES:
                return new RuleBasedQueryOptimizer();
            default:
                return new EmptyOptimizer();
        }
    }
@Test(expected = IllegalArgumentException.class)
    public void newOptimizer_whenUnknownValue_thenThrowIllegalArgumentException() {
        HazelcastProperties hazelcastProperties = createMockHazelcastProperties(QUERY_OPTIMIZER_TYPE, "foo");
        QueryOptimizerFactory.newOptimizer(hazelcastProperties);
    }