@Test
public void testGetJobInfo() throws Exception {
String jobId = "jobId";
Job mockJob = mock( Job.class );
doReturn( mockJob ).when( schedulerService ).getJob( jobId );
ISecurityHelper mockSecurityHelper = mock( ISecurityHelper.class );
doReturn( mockSecurityHelper ).when( schedulerService ).getSecurityHelper();
IPentahoSession mockPentahoSession = mock( IPentahoSession.class );
doReturn( mockPentahoSession ).when( schedulerService ).getSession();
String sessionName = "sessionName";
doReturn( sessionName ).when( mockPentahoSession ).getName();
doReturn( sessionName ).when( mockJob ).getUserName();
Map<String, Serializable> mockJobParams = mock( Map.class );
doReturn( mockJobParams ).when( mockJob ).getJobParams();
Set<String> jobParamsKeyset = new HashSet<String>();
doReturn( jobParamsKeyset ).when( mockJobParams ).keySet();
String jobParamKey = "key";
jobParamsKeyset.add( jobParamKey );
String value = "value";
String[] testArray = new String[]{value};
doReturn( testArray ).when( mockJobParams ).get( jobParamKey );
// Test 1
doReturn( true ).when( mockSecurityHelper ).isPentahoAdministrator( mockPentahoSession );
Job testJob = schedulerService.getJobInfo( jobId );
assertEquals( mockJob, testJob );
// Test 2
doReturn( false ).when( mockSecurityHelper ).isPentahoAdministrator( mockPentahoSession );
testJob = schedulerService.getJobInfo( jobId );