Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.intuit.oauth2.data;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

/**
* @author enzozafra
*/
public class AddressTest {
private Address address;

private String streetAddress;
private String locality;
private String region;
private String postalCode;
private String country;

@BeforeTest
public void init() {
streetAddress = "123 Test Street";
locality = "locality";
region = "region";
country = "country";
postalCode = "12345";
}

@BeforeMethod
public void setUp() {
address = new Address();
address.setStreetAddress(streetAddress);
address.setLocality(locality);
address.setRegion(region);
address.setCountry(country);
address.setPostalCode(postalCode);
}

@Test
public void testAllGetters() {
Assert.assertEquals(address.getStreetAddress(), streetAddress);
Assert.assertEquals(address.getLocality(), locality);
Assert.assertEquals(address.getRegion(), region);
Assert.assertEquals(address.getCountry(), country);
Assert.assertEquals(address.getPostalCode(), postalCode);
}

@Test
public void testAllSetters() {
String newStreetAddress = "321 New Street Address";
String newLocality = "New Locality";
String newRegion = "New Region";
String newCountry = "New Country";
String newPostalCode = "54321";

address.setStreetAddress(newStreetAddress);
address.setLocality(newLocality);
address.setRegion(newRegion);
address.setCountry(newCountry);
address.setPostalCode(newPostalCode);

Assert.assertEquals(address.getStreetAddress(), newStreetAddress);
Assert.assertEquals(address.getLocality(), newLocality);
Assert.assertEquals(address.getRegion(), newRegion);
Assert.assertEquals(address.getCountry(), newCountry);
Assert.assertEquals(address.getPostalCode(), newPostalCode);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.intuit.oauth2.data;

import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

/**
* @author enzozafra
*/
public class DiscoveryAPIResponseTest {
private DiscoveryAPIResponse discoveryAPIResponse;

private String issuer;
private String authorizationEndpoint;
private String tokenEndpoint;
private String userinfoEndpoint;
private String revocationEndpoint;
private String jwksUri;

@BeforeTest
public void init() {
issuer = "issuer";
authorizationEndpoint = "authorizationEndpoint";
tokenEndpoint = "tokenEndpoint";
revocationEndpoint = "revocationEndpoint";
userinfoEndpoint = "userinfoEndpoint";
jwksUri = "jwksUri";
}

@BeforeMethod
public void setUp() {
discoveryAPIResponse = new DiscoveryAPIResponse();
discoveryAPIResponse.setIssuer(issuer);
discoveryAPIResponse.setAuthorizationEndpoint(authorizationEndpoint);
discoveryAPIResponse.setTokenEndpoint(tokenEndpoint);
discoveryAPIResponse.setRevocationEndpoint(revocationEndpoint);
discoveryAPIResponse.setUserinfoEndpoint(userinfoEndpoint);
discoveryAPIResponse.setJwksUri(jwksUri);
}

@Test
public void testAllGetters() {
Assert.assertEquals(discoveryAPIResponse.getIssuer(), issuer);
Assert.assertEquals(discoveryAPIResponse.getAuthorizationEndpoint(), authorizationEndpoint);
Assert.assertEquals(discoveryAPIResponse.getTokenEndpoint(), tokenEndpoint);
Assert.assertEquals(discoveryAPIResponse.getRevocationEndpoint(), revocationEndpoint);
Assert.assertEquals(discoveryAPIResponse.getUserinfoEndpoint(), userinfoEndpoint);
Assert.assertEquals(discoveryAPIResponse.getJwksUri(), jwksUri);
}

@Test
public void testAllSetters() {
String newIssuer = "321 New Street Address";
String newAuthorizationEndpoint = "New authorizationEndpoint";
String newTokenEndpoint = "New TokenEndpoint";
String newRevocationEndpoint = "New RevocationEndpoint";
String newUserInfoEndpoint = "New UserinfoEndpoint";
String newJwksUri = "new JwksUri";

discoveryAPIResponse.setIssuer(newIssuer);
discoveryAPIResponse.setAuthorizationEndpoint(newAuthorizationEndpoint);
discoveryAPIResponse.setTokenEndpoint(newTokenEndpoint);
discoveryAPIResponse.setRevocationEndpoint(newRevocationEndpoint);
discoveryAPIResponse.setUserinfoEndpoint(newUserInfoEndpoint);
discoveryAPIResponse.setJwksUri(newJwksUri);

Assert.assertEquals(discoveryAPIResponse.getIssuer(), newIssuer);
Assert.assertEquals(discoveryAPIResponse.getAuthorizationEndpoint(), newAuthorizationEndpoint);
Assert.assertEquals(discoveryAPIResponse.getTokenEndpoint(), newTokenEndpoint);
Assert.assertEquals(discoveryAPIResponse.getRevocationEndpoint(), newRevocationEndpoint);
Assert.assertEquals(discoveryAPIResponse.getUserinfoEndpoint(), newUserInfoEndpoint);
Assert.assertEquals(discoveryAPIResponse.getJwksUri(), newJwksUri);
}
}