You need to sign in to do that
Don't have an account?
how can i test "the DML operation was false"?
global class tt {
WebService static Boolean sayHelloWorld(String name) {
Boolean updateFlg = true;
Account [] accountList = [Select a.Name from Account a where o.Name = name];
for(Account oli : accountList ){
oli.Name = '23';
}
Database.SaveResult[] SR = database.update(accountList);
try{
for(Database.SaveResult lsr:SR){
if(!lsr.isSuccess()){
updateFlg = false;
break;
}
}
}catch (System.Exception e) {
}
static testMethod void testHelloWorld() {
System.assertEquals(false, sayHelloWorld('name1'));
}
}
}
<?xml version="1.0" encoding="Shift_JIS"?>
<project name="sfdc-b03" default="build" basedir="." >
<property name="FROM_CLASS" value="./bin" />
<property name="JAR_NAME" value="cdfs-bb.jar"/>
<property name="runtime_classpath" value="../bin/bb/ cdfs-bb-stub.jar activation.jar axis.jar axis-ant.jar commons-discovery-0.2.jar commons-logging-1.0.4.jar jaxrpc.jar log4j-1.2.8.jar mail.jar mailapi.jar partner.jar saaj.jar sfdc-anywarp-util.jar sfdc-b-common.jar sfdc-stub-common.jar wsdl4j-1.5.1.jar"/>
<property name="main_class_name" value="jp.co.hbs.bb.BBMain"/>
<!-- copyto -->
<property name="HTTP_IF_WEB-INF" value="./"/>
<!-- copyfrom -->
<property name="TARGET_TO" value="../CDFS//lib"/>
<target name="build_jar" >
<jar compress="true" destfile="${JAR_NAME}">
<fileset dir="${FROM_CLASS}">
<patternset>
<include name="**/*.class"/>
<exclude name="**/.svn"/>
<exclude name="**/test/*.class"/>
<!-- cool.properties is not -->
</patternset>
</fileset>
<manifest>
<attribute name="Main-Class" value="${main_class_name}"/>
<attribute name="Class-Path" value="${runtime_classpath}"/>
</manifest>
</jar>
</target>
<!-- JARcopy-->
<target name="copy_jar" depends="build_jar">
<mkdir dir="${TARGET_TO}"/>
<copy todir="${TARGET_TO}" preservelastmodified="${PRESERVELASTMODIFIED}" overwrite="${OVERWRITE}" verbose="${VERBOSE}">
<fileset dir=".">
<patternset>
<include name="${JAR_NAME}"/>
</patternset>
</fileset>
</copy>
</target>
<target name="build" depends="copy_jar">
</target>
</project>