TrafficSource { public JSONObject toJSONObject( String helpMessage, Locale locale, String title) { return JSONUtil.put( "countryKeywords", _getCountryKeywordsJSONArray(locale) ).put( "helpMessage", helpMessage ).put( "name", getName() ).put( "share", getTrafficShare() ).put( "title", title ).put( "value", Math.toIntExact(getTrafficAmount()) ); } TrafficSource();  TrafficSource(
		List<CountrySearchKeywords> countrySearchKeywordsList, String name,
		long trafficAmount, double trafficShare); @Override boolean equals(Object object); @JsonProperty("countryKeywords") List<CountrySearchKeywords> getCountrySearchKeywordsList(); String getName(); long getTrafficAmount(); double getTrafficShare(); @Override int hashCode(); void setCountrySearchKeywordsList(
		List<CountrySearchKeywords> countrySearchKeywordsList); void setName(String name); void setTrafficAmount(long trafficAmount); void setTrafficShare(double trafficShare); JSONObject toJSONObject(
		String helpMessage, Locale locale, String title);  }
@Test public void testToJSONObject() { TrafficSource trafficSource = new TrafficSource( Collections.emptyList(), RandomTestUtil.randomString(), RandomTestUtil.randomInt(), RandomTestUtil.randomDouble()); String helpMessage = RandomTestUtil.randomString(); String title = RandomTestUtil.randomString(); Assert.assertEquals( JSONUtil.put( "countryKeywords", JSONFactoryUtil.createJSONArray() ).put( "helpMessage", helpMessage ).put( "name", trafficSource.getName() ).put( "share", trafficSource.getTrafficShare() ).put( "title", title ).put( "value", Math.toIntExact(trafficSource.getTrafficAmount()) ).toString(), String.valueOf( trafficSource.toJSONObject(helpMessage, LocaleUtil.US, title))); }
@Test(expected = ArithmeticException.class) public void testToJSONObjectWithLongTrafficAmount() { TrafficSource trafficSource = new TrafficSource( Collections.emptyList(), RandomTestUtil.randomString(), Long.MAX_VALUE, RandomTestUtil.randomDouble()); trafficSource.toJSONObject( RandomTestUtil.randomString(), LocaleUtil.US, RandomTestUtil.randomString()); }