You need to sign in to do that
Don't have an account?
Mike Schumacher 2
pass wrapper class to another method
I have a wrapper class defined and a method that is expecting a <list> of the wrapper class. I get the error 'method does not exist or incorrect signature: void methodname<list>.......
Here is the simple class:
public class Test_ClassWrapper {
public static void miketest3(List<MikeRecordWrapper> mRecord) {
System.debug('....in miketest3 routine');
}
public class MikeRecordWrapper {
public String Mike1;
public String Mike2;
}
}
When I create a test class to pass a wrapper list I receive my compliation error message.
Test Script:
@isTest (SeeAllData=true)
public class Test_ClassWrapper_Test {
static testMethod void Test_ClassWrapper_Test() {
MikeRecordWrapper mr = new MikeRecordWrapper();
mr.Mike1 = 'test';
mr.Mike2 = 'test2';
//create my wrapper list
List<MikeRecordWrapper> mikerecordList = new List<MikeRecordWrapper>();
mikerecordList.add(mr);
Test_ClassWrapper.miketest3( mikerecordList);
}
public class MikeRecordWrapper {
public String Mike1;
public String Mike2;
}
}
I get the error on line "Test_ClassWrapper.miketest3( mikerecordList);"
Error:
Method does not exist or incorrect signature: void miketest3(List<Test_ClassWrapper_Test.MikeRecordWrapper>) from the type Test_ClassWrapper
If I change the classes to just pass a simple list of strings no error message. I thought I could then pass a list of my custom wrapper.
Any asistance is appreciated.
Thanks
Mike
Here is the simple class:
public class Test_ClassWrapper {
public static void miketest3(List<MikeRecordWrapper> mRecord) {
System.debug('....in miketest3 routine');
}
public class MikeRecordWrapper {
public String Mike1;
public String Mike2;
}
}
When I create a test class to pass a wrapper list I receive my compliation error message.
Test Script:
@isTest (SeeAllData=true)
public class Test_ClassWrapper_Test {
static testMethod void Test_ClassWrapper_Test() {
MikeRecordWrapper mr = new MikeRecordWrapper();
mr.Mike1 = 'test';
mr.Mike2 = 'test2';
//create my wrapper list
List<MikeRecordWrapper> mikerecordList = new List<MikeRecordWrapper>();
mikerecordList.add(mr);
Test_ClassWrapper.miketest3( mikerecordList);
}
public class MikeRecordWrapper {
public String Mike1;
public String Mike2;
}
}
I get the error on line "Test_ClassWrapper.miketest3( mikerecordList);"
Error:
Method does not exist or incorrect signature: void miketest3(List<Test_ClassWrapper_Test.MikeRecordWrapper>) from the type Test_ClassWrapper
If I change the classes to just pass a simple list of strings no error message. I thought I could then pass a list of my custom wrapper.
Any asistance is appreciated.
Thanks
Mike
thanks, Mike
@isTest (SeeAllData=true)
public class Test_ClassWrapper_Test {
static testMethod void Test_ClassWrapper_Test() {
Test_ClassWrapper.MikeRecordWrapper mr = new Test_ClassWrapper.MikeRecordWrapper();
mr.Mike1 = 'test';
mr.Mike2 = 'test2';
List<Test_ClassWrapper.MikeRecordWrapper> mikerecordList = new List<Test_ClassWrapper.MikeRecordWrapper>();
mikerecordList.add(mr);
//Test_ClassWrapper tcw = new Test_ClassWrapper();
Test_ClassWrapper.miketest3( mr);
}
//removed the MikeRecordWrapper class from the test script
}