This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Scanner; | |
import java.util.TreeMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wemblog.cq.core.servlet; | |
import com.day.cq.dam.api.Asset; | |
import com.day.cq.dam.commons.util.DamUtil; | |
import com.wemblog.utility.RunModeUtil; | |
import java.io.IOException; | |
import java.util.Dictionary; | |
import javax.servlet.RequestDispatcher; | |
import javax.servlet.ServletException; | |
import org.apache.commons.lang3.StringUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import urllib2 | |
import urllib | |
import datetime | |
from openpyxl import Workbook | |
from watson_developer_cloud import AlchemyLanguageV1 | |
# Get google API key from https://developers.google.com/custom-search/json-api/v1/introduction#identify_your_application_to_google_with_api_key | |
google_api_key = '*****' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wemblog.test; | |
import com.adobe.granite.xss.XSSAPI; | |
import com.google.gson.JsonArray; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import static org.junit.Assert.*; | |
import static org.mockito.Mockito.any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.jacoco</groupId> | |
<artifactId>jacoco-maven-plugin</artifactId> | |
<version>0.7.2.201409121644</version> | |
<executions> | |
<!-- Prepares the property pointing to the JaCoCo runtime agent | |
which is passed as VM argument when Maven the Surefire plugin is executed. --> | |
<execution> | |
<id>pre-unit-test</id> | |
<goals> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.8.2</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-simple</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Method 1, By using Inject Mock | |
@RunWith(PowerMockRunner.class) | |
@PrepareForTest(MyServiceImpl.class) | |
public class MyServiceImplTest { | |
@InjectMocks | |
MyServiceImpl _myService; | |
@Before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wemblog.util; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertFalse; | |
import static org.junit.Assert.assertNotNull; | |
import static org.junit.Assert.assertNull; | |
import static org.junit.Assert.assertTrue; | |
import static org.mockito.Mockito.mock; | |
import static org.mockito.Mockito.when; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wemblog.foundation.utility; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertFalse; | |
import static org.junit.Assert.assertTrue; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum IPHeaders { | |
CLIENT_IP_UNDERSCORE("Client_IP"), | |
CLIENT_IP("Client-IP"), | |
X_CLIENT_IP("X-Client-IP"), | |
X_FORWARDED_FOR("X-Forwarded-For"), | |
FORWARDED_FOR("Forwarded-For"), | |
VIA("Via"), | |
REMOTE_ADDR("Remote-Addr"), | |
X_REMOTE_ADDR("X-Remote-Addr"), | |
X_CLUSTER_CLIENT_IP("X-Cluster-Client-IP"), |
NewerOlder