• saldm
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies

I have a page named myPage, with standardController="myObject__c" and extensions="myExtension".

 

In myExtension I have the method,

 

public Integer getThisMonth() {
DateTime myDT = DateTime.now();
return Integer.valueOf(myDT.format('M'));
} // public Integer getThisMonth() {

 

I am creating a test class and I want to test this method with something like the following

 

 

@isTest
private class myTestSuite {
Integer n = getThisMonth();
System.assertEquals(3, n);
}

 

Clearly, this does not work because I need to tie myTestSuite to the controller and extension but I am having difficulty determining how to do this.

 

My attempts to do something like

myExtension.getThisMonth()

have been unsuccessful

 

and my attempts to put the test in the context of the page,

PageReference pageRef = Page.myPage;

Test.setCurrentPage(pageRef);

have been unsuccessful as well.

 

I do recognize this particular test is rather meaningless (and invalid at the end of the month) but I want to use it as a starting point for the other tests I need to write.

 

I would greatly appreciate any assistance in this area.

 

Thank you.

 

  • March 05, 2009
  • Like
  • 0

I'm using a repeat block to display a list of results (each result appears in a div with some further markup for styling).

 

I would like to display the index number with the div.  Is it possible to access this value?

 

Any help or links to relevant material would be appreciated.  Thank you.

 

- Sal

  • February 13, 2009
  • Like
  • 0

I have a page named myPage, with standardController="myObject__c" and extensions="myExtension".

 

In myExtension I have the method,

 

public Integer getThisMonth() {
DateTime myDT = DateTime.now();
return Integer.valueOf(myDT.format('M'));
} // public Integer getThisMonth() {

 

I am creating a test class and I want to test this method with something like the following

 

 

@isTest
private class myTestSuite {
Integer n = getThisMonth();
System.assertEquals(3, n);
}

 

Clearly, this does not work because I need to tie myTestSuite to the controller and extension but I am having difficulty determining how to do this.

 

My attempts to do something like

myExtension.getThisMonth()

have been unsuccessful

 

and my attempts to put the test in the context of the page,

PageReference pageRef = Page.myPage;

Test.setCurrentPage(pageRef);

have been unsuccessful as well.

 

I do recognize this particular test is rather meaningless (and invalid at the end of the month) but I want to use it as a starting point for the other tests I need to write.

 

I would greatly appreciate any assistance in this area.

 

Thank you.

 

  • March 05, 2009
  • Like
  • 0

Hello.

 

How to send value from visualforce page to apex class ?

 

I tried to use this code, but it does not work.

 

 

global class Bibizanka { public String getBibizankaValue(String Bibiz){ return Bibiz; } }

 

 

<apex:page cache="true" showHeader="false" sidebar="false" controller="Bibizanka"> Bibizanka value = {!BibizankaValue('test')} </apex:page>

 

Thanks.

 

I'm using a repeat block to display a list of results (each result appears in a div with some further markup for styling).

 

I would like to display the index number with the div.  Is it possible to access this value?

 

Any help or links to relevant material would be appreciated.  Thank you.

 

- Sal

  • February 13, 2009
  • Like
  • 0