Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tyoshikawa1106
committed
Nov 27, 2013
1 parent
b90e13e
commit 5d04048
Showing
11 changed files
with
74 additions
and
314 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,39 @@ | ||
/* | ||
/** | ||
* commandButton onComplete処理サンプル | ||
* © 2013 Force.com Developer | ||
* ---------------------------------------- | ||
* @createdDate : 2013/01/01 | ||
* @createdName : TAIKI,YOSHIKAWA | ||
* ---------------------------------------- | ||
* @lastModifiedDate : 2013/01/01 | ||
* @lastModifiedName : TAIKI,YOSHIKAWA | ||
* @createdName : Taiki,Yoshikawa | ||
* @lastModifiedName : Taiki,Yoshikawa | ||
* ---------------------------------------- | ||
*/ | ||
public with sharing class CommandButtonOnCompleteController { | ||
|
||
// メッセージ | ||
public String message {get; set;} | ||
|
||
/* | ||
* コンストラクタ | ||
* @param : なし | ||
* @return : なし | ||
*/ | ||
public CommandButtonOnCompleteController() { | ||
System.debug('◆◆◆◆CommandButtonOnCompleteController:START'); | ||
|
||
// メッセージ | ||
this.message = ''; | ||
|
||
System.debug('◆◆◆◆CommandButtonOnCompleteController:END'); | ||
} | ||
|
||
/* | ||
* ボタン押下処理 | ||
* @param : なし | ||
* @return : なし | ||
*/ | ||
public void doButtonClick() { | ||
System.debug('◆◆◆◆doButtonClick:START'); | ||
|
||
// メッセージ | ||
this.message = 'OK'; | ||
|
||
System.debug('◆◆◆◆doButtonClick:END'); | ||
} | ||
|
||
// メッセージ | ||
public String message {get; set;} | ||
|
||
/** | ||
* コンストラクタ | ||
*/ | ||
public CommandButtonOnCompleteController() { | ||
System.debug('CommandButtonOnCompleteController:START'); | ||
|
||
// メッセージ | ||
this.message = ''; | ||
|
||
System.debug('CommandButtonOnCompleteController:END'); | ||
} | ||
|
||
/** | ||
* ボタン押下処理 | ||
* @param : none | ||
* @return : none | ||
*/ | ||
public void doButtonClick() { | ||
System.debug('doButtonClick:START'); | ||
|
||
// メッセージ | ||
this.message = 'OK'; | ||
|
||
System.debug('doButtonClick:END'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>27.0</apiVersion> | ||
<apiVersion>29.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,41 @@ | ||
/* | ||
/** | ||
* commandButton onComplete処理サンプル | ||
* © 2013 Force.com Developer | ||
* ---------------------------------------- | ||
* @createdDate : 2013/01/01 | ||
* @createdName : TAIKI,YOSHIKAWA | ||
* ---------------------------------------- | ||
* @lastModifiedDate : 2013/01/01 | ||
* @lastModifiedName : TAIKI,YOSHIKAWA | ||
* @createdName : Taiki,Yoshikawa | ||
* @lastModifiedName : Taiki,Yoshikawa | ||
* ---------------------------------------- | ||
*/ | ||
@isTest | ||
private class CommandButtonOnCompleteControllerTest { | ||
/* | ||
* コンストラクタ・テスト | ||
*/ | ||
/** | ||
* コンストラクタ | ||
*/ | ||
static testMethod void CommandButtonOnCompleteControllerTest() { | ||
System.debug('◆◆◆◆CommandButtonOnCompleteControllerTest:START'); | ||
|
||
// ユーザ | ||
User user = getUser(); | ||
|
||
// テスト実施 | ||
System.RunAs(user) { | ||
|
||
// カレントページにパラメータを設定 | ||
PageReference pageRef = getPageReference(); | ||
Test.setCurrentPage(pageRef); | ||
|
||
// テスト開始 | ||
Test.startTest(); | ||
|
||
// コンストラクタ | ||
CommandButtonOnCompleteController cls = new CommandButtonOnCompleteController(); | ||
System.assertEquals(cls.message, ''); | ||
|
||
// テスト終了 | ||
Test.stopTest(); | ||
} | ||
Test.startTest(); | ||
|
||
System.debug('◆◆◆◆CommandButtonOnCompleteControllerTest:END'); | ||
CommandButtonOnCompleteController cls = new CommandButtonOnCompleteController(); | ||
System.assertEquals(cls.message, ''); | ||
|
||
Test.stopTest(); | ||
} | ||
|
||
/* | ||
* ボタン押下処理・テスト | ||
*/ | ||
/** | ||
* ボタン押下処理 | ||
*/ | ||
static testMethod void doButtonClickTest() { | ||
System.debug('◆◆◆◆doButtonClickTest:START'); | ||
|
||
// ユーザ | ||
User user = getUser(); | ||
Test.startTest(); | ||
|
||
// テスト実施 | ||
System.RunAs(user) { | ||
|
||
// カレントページにパラメータを設定 | ||
PageReference pageRef = getPageReference(); | ||
Test.setCurrentPage(pageRef); | ||
|
||
// テスト開始 | ||
Test.startTest(); | ||
|
||
// コンストラクタ | ||
CommandButtonOnCompleteController cls = new CommandButtonOnCompleteController(); | ||
System.assertEquals(cls.message, ''); | ||
// ボタン処理 | ||
cls.doButtonClick(); | ||
System.assertEquals(cls.message, 'OK'); | ||
|
||
// テスト終了 | ||
Test.stopTest(); | ||
} | ||
// コンストラクタ | ||
CommandButtonOnCompleteController cls = new CommandButtonOnCompleteController(); | ||
System.assertEquals(cls.message, ''); | ||
// ボタン処理 | ||
cls.doButtonClick(); | ||
System.assertEquals(cls.message, 'OK'); | ||
|
||
System.debug('◆◆◆◆doButtonClickTest:END'); | ||
} | ||
|
||
/* | ||
* ユーザ取得 | ||
*/ | ||
private static User getUser() { | ||
return [select Id from User where Id =: UserInfo.getUserId() limit 1]; | ||
} | ||
|
||
/* | ||
* テストページ取得 | ||
*/ | ||
private static PageReference getPageReference() { | ||
return new PageReference('TestPage'); | ||
Test.stopTest(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>27.0</apiVersion> | ||
<apiVersion>29.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
Oops, something went wrong.