Monday, July 20, 2015
Monday, July 22, 2013
Mock private field and private method using PowerMock
Example
public class PrivateObject {
private String privateString;
public PrivateObject(String privateString) {
this.privateString = privateString;
}
private String getPrivateString() {
return this.privateString;
}
}
public class PrivateObject {
private String privateString;
public PrivateObject(String privateString) {
this.privateString = privateString;
}
private String getPrivateString() {
return this.privateString;
}
}
Mock using PowerMock
// class instance
PrivateObject instance = new PrivateObject ();
// mock private field/variable
MemberModifier
.field(PrivateObject .class, "privateString").set(
instance , "hellomock");
// mock private method
MemberModifier
.stub(MemberMatcher.method(PrivateObject .class,
"getPrivateString"))
.toReturn(
"Power Mock");
Wednesday, June 12, 2013
Hot Swap featuring Maven and Maven Embedded web server 'Jetty'
Developer always want to utilize time fruitfully by doing new things instead of doing repeat kinds of work. In J2EE web application development, change made on view pages can be replicate instantly on browser by hard refresh but for instant result of change that made in java class, web server need to restart as it need to redeploy those changes made java classes after java compiler compile it.
So to escape from this, follow Hot Swap concept and implement it featuring Maven and Maven embedded web server Jetty.
So to escape from this, follow Hot Swap concept and implement it featuring Maven and Maven embedded web server Jetty.
${basedir} - root directory of project
In my implementation,
${maven-compiler.version} - 2.3.2
${java.source.version} - 1.6
${jetty.version} - 8.1.8.v20121106
${jetty.port} - 8080
Enjoy Hot-swap!!!!!!!!!!!
Eclipse IDE asking authentication credential for Subversion every time while updating and committing code.
To over come,
go to path
C:\Users\${user}\AppData\Roaming\Subversion\auth
and remove "svn.simple" folder.
go to path
C:\Users\${user}\AppData\Roaming\Subversion\auth
and remove "svn.simple" folder.
Monday, February 22, 2010
How To Reach Gorkha
Gorkha Palace |
Basically, there are three entry point to reach the historical town, Gorkha.The entry points are the capital city of Kathmandu, Pokhara and Narayabnghat (Chitwan). Gorkha is about 4-5 hours drive from Kathmandu, 3-4 hour from Pokhara and 2 hours from Narayanghat(Chitwan). The distance between Gorkha and Kathmandu is round about 156km. similarly, it is at a distance of about 64km from Narayanghat(Chitwan) and 125km from the centre point of Pokhara.
View of Himalayan |
Buses from Kathmandu are available at New bus terminal, Gongabu- near balaju. Beside this, Micro bus, other private buses, taxis are available in Kathmandu, likewise there is daily bus services from Pokhara and Narayanghat also. A fine road leads you up to the township of Gorkha from all these entries.
sunset from children park |
There are no regular Air Flight services from Gorkha. If you want to visit Gorkha by air, Chartered helicopter services are available from Kathmandu.
Subscribe to:
Posts (Atom)