Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Who Me Too'd this topic

Avatar

Avatar
Validate 50
Level 6
cquser1
Level 6

Likes

75 likes

Total Posts

313 posts

Correct Reply

15 solutions
Top badges earned
Validate 50
Validate 25
Validate 10
Validate 1
Give Back 50
View profile

Avatar
Validate 50
Level 6
cquser1
Level 6

Likes

75 likes

Total Posts

313 posts

Correct Reply

15 solutions
Top badges earned
Validate 50
Validate 25
Validate 10
Validate 1
Give Back 50
View profile
cquser1
Level 6

25-07-2017

Hi All,

I have a sling model class, with four different dialog properties that I have as below. For example :

@Inject

    @Optional

    @Via("resource")

    private String videoType;

@Inject

    @Optional

    @Via("resource")

    private String videoId;

and similarly for the other 2 properties

private String videoUrl = StringUtils.EMPTY;

@PostConstruct

    public void init() {

videoUrl = Utility.getVideoUrl(videoType, videoId);

}

public String getVideoUrl() {

        return videoUrl;

    }

The utility class is as below :

    String videoUrl = StringUtils.EMPTY;

        if (videoType != null && id != null) {

            if (videoType.equals("youtube")) {

                videoUrl = Constants.youtube_link + id;

            } else {

                videoUrl = Constants.streamsite + id;

            }

        }

        return videoUrl;

    }

I need to write Junit classes for this utility method and model class. Went through multiple links and codes. but not able to get started on this.

If someone can tell me how to write Junit classes for this, would be really really helpful.

Who Me Too'd this topic