Skip to content

Commit

Permalink
add Travis CI and update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
keets2012 committed Jun 26, 2018
1 parent 857da99 commit 840f8ea
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/test/java/com/blueskykong/auth/AuthApplicationTest.java
@@ -1,10 +1,23 @@
package com.blueskykong.auth;


import com.blueskykong.auth.dao.ClientSecretDAO;
import com.blueskykong.auth.dto.ApiClientDTO;
import com.blueskykong.auth.entity.ClientSecret;
import com.blueskykong.auth.service.ClientSecretService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.UUID;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
* @author keets
* @date 2016/12/5
Expand All @@ -14,5 +27,31 @@
@SpringBootTest
public class AuthApplicationTest {

@Mock
private ClientSecretDAO clientSecretDao;

@Mock
private ClientSecretService clientSecretService;

@Before
public void setUp() {
ApiClientDTO mockClient = new ApiClientDTO();
mockClient.setClientId("test");
mockClient.setClientSecret("test");
mockClient.setPurpose("test..");
ClientSecret clientSecret = new ClientSecret.ClientSecretBuilder()
.withTenantId(UUID.randomUUID())
.build();
when(clientSecretService.getClientSecretByClientId("test")).thenReturn(mockClient);

// when(clientSecretDao.get(clientSecret)).thenReturn()
}

@Test
public void getClientSecretByClientIdTest() {
ApiClientDTO apiClientDTO = clientSecretService.getClientSecretByClientId("test");
Assert.assertEquals(apiClientDTO.getClientSecret(),"test" );
}


}

0 comments on commit 840f8ea

Please sign in to comment.