### Question:
MapEventFactory { static PerformanceEvent buildPerformanceEvent(@NonNull PhoneState phoneState, @NonNull String sessionId, @NonNull Bundle data) { return new PerformanceEvent(phoneState, sessionId, data); }    }### Answer:
@Test public void testPerformanceEvent() { String nameAttribute = "nameAttribute"; String valueAttribute = "100"; String nameCounters = "nameCounters"; Double valuesCounters = 1000.0; JsonObject metaData = new JsonObject(); metaData.addProperty("os", "android"); metaData.addProperty("manufacturer", Build.MANUFACTURER); metaData.addProperty("brand", Build.BRAND); metaData.addProperty("device", Build.MODEL); metaData.addProperty("version", Build.VERSION.RELEASE); metaData.addProperty("abi", Build.CPU_ABI); metaData.addProperty("country", Locale.getDefault().getISO3Country()); metaData.addProperty("ram", "ram"); metaData.addProperty("screenSize", "1000"); Bundle data = mock(Bundle.class); ArrayList<PerformanceEvent.PerformanceAttribute<String>> attribtueList = new ArrayList<>(); PerformanceAttribute<String> attribute = new PerformanceAttribute<>(nameAttribute, valueAttribute); attribtueList.add(attribute); ArrayList<PerformanceEvent.PerformanceAttribute<Double>> countersList = new ArrayList<>(); PerformanceAttribute<Double> counter = new PerformanceAttribute<>(nameCounters, valuesCounters); countersList.add(counter); when(data.getString("attributes")).thenReturn(gson.toJson(attribtueList)); when(data.getString("counters")).thenReturn(gson.toJson(countersList)); when(data.getString("metadata")).thenReturn(metaData.toString()); PerformanceEvent performanceEvent = MapEventFactory.buildPerformanceEvent(phoneState, SESSION_ID, data); assertEquals(CREATED, performanceEvent.getCreated()); assertEquals(metaData.toString(), performanceEvent.getMetadata().toString()); assertEquals(SESSION_ID, performanceEvent.getSessionId()); List<PerformanceEvent.PerformanceAttribute<String>> attributeList = performanceEvent.getAttributes(); assertEquals(1, attribtueList.size()); assertEquals(attribute, attribtueList.get(0)); List<PerformanceEvent.PerformanceAttribute<Double>> counterList = performanceEvent.getCounters(); assertEquals(1, counterList.size()); assertEquals(counter, counterList.get(0)); }