function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mahmoud Coudsi 1Mahmoud Coudsi 1 

Error: Compile Error: Expecting ')' (Right parenthesis) but was..

I keep getting this error message: Error: Compile Error: Expecting ')' but was: 'Red' at line 5 column 16, when I run the following Apex Class: 
public class Test {

Map<String, String> colorCodes = new Map<String, String>();

colorCodes.put('Red', 'FF0000');
colorCodes.put('Blue', '0000A0');

String myColor = colorCodes.remove('Blue');
String code2 = colorCodes.get('Blue');

System.assertEquals(null, code2);

}
What am I missing here?

 
Best Answer chosen by Mahmoud Coudsi 1
Alain CabonAlain Cabon
Hi,

A method name is missing ( myTestMethod1 )
 
@isTest
public class Test {

static testmethod void myTestMethod1() {

    Map<String, String> colorCodes = new Map<String, String>();

    colorCodes.put('Red', 'FF0000');
    colorCodes.put('Blue', '0000A0');

    String myColor = colorCodes.remove('Blue');
    String code2 = colorCodes.get('Blue');

    System.assertEquals(null, code2);

   }

}