<commit_before>package com.hazelcast.client.map;

import com.hazelcast.client.HazelcastClient;
import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.core.MapStoreAdapter;
import com.hazelcast.map.mapstore.MapStoreTest;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

@RunWith(HazelcastSerialClassRunner.class)
@Category(QuickTest.class)
public class ClientMapLoaderExceptionHandlingTest extends HazelcastTestSupport {

    @Test(expected = ClassCastException.class)
    public void test_initial_map_load_propagates_exception_to_client() throws Exception {
        final String mapName = randomMapName();
        final Config config = createNewConfig(mapName);
        final HazelcastInstance server = Hazelcast.newHazelcastInstance(config);
        final HazelcastInstance client = HazelcastClient.newHazelcastClient();
        final IMap<Integer, Integer> map = client.getMap(mapName);
        map.get(1);

        closeResources(client, server);
    }

    private static Config createNewConfig(String mapName) {
        final ExceptionalMapStore store = new ExceptionalMapStore();
        return MapStoreTest.newConfig(mapName, store, 0);
    }

    private static class ExceptionalMapStore extends MapStoreAdapter {

        @Override
        public Set loadAllKeys() {<commit_msg>test fix<commit_after>package com.hazelcast.client.map;

import com.hazelcast.client.HazelcastClient;
import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.core.MapStoreAdapter;
import com.hazelcast.map.mapstore.MapStoreTest;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

@RunWith(HazelcastSerialClassRunner.class)
@Category(QuickTest.class)
public class ClientMapLoaderExceptionHandlingTest extends HazelcastTestSupport {

    @Test(expected = ClassCastException.class)
    public void test_initial_map_load_propagates_exception_to_client() throws Exception {
        final String mapName = randomMapName();
        final Config config = createNewConfig(mapName);
        final HazelcastInstance server = Hazelcast.newHazelcastInstance(config);
        final HazelcastInstance client = HazelcastClient.newHazelcastClient();
        final IMap<Integer, Integer> map = client.getMap(mapName);
        try {
            map.get(1);
        } finally {
            closeResources(client, server);
        }
    }

    private static Config createNewConfig(String mapName) {
        final ExceptionalMapStore store = new ExceptionalMapStore();
        return MapStoreTest.newConfig(mapName, store, 0);
    }

    private static class ExceptionalMapStore extends MapStoreAdapter {

        @Override
        public Set loadAllKeys() {
{'fraction_non_alphanumeric': 0.08414985590778098, 'fraction_numerical': 0.0011527377521613833, 'mean_word_length': 4.5893719806763285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2775311', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1035, 'n_words': 199}