Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
tyoshikawa1106 committed Nov 27, 2013
1 parent b90e13e commit 5d04048
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 314 deletions.
22 changes: 0 additions & 22 deletions .gitattributes

This file was deleted.

163 changes: 0 additions & 163 deletions .gitignore

This file was deleted.

1 change: 0 additions & 1 deletion memo.txt

This file was deleted.

69 changes: 32 additions & 37 deletions src/classes/CommandButtonOnCompleteController.cls
@@ -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');
}
}
2 changes: 1 addition & 1 deletion src/classes/CommandButtonOnCompleteController.cls-meta.xml
@@ -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>
96 changes: 23 additions & 73 deletions src/classes/CommandButtonOnCompleteControllerTest.cls
@@ -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();
}
}
@@ -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>

0 comments on commit 5d04048

Please sign in to comment.