Info |
---|
Split into two teams (team sizes can range from 1 - 3). Team 1 must set the project up. It should be an empty maven project with NO code. Once team 2 have created the git repo, team 1 should get an invite from team 2 join the git You will need two git accounts. A root account where team 1 create the main project repo and to which all other teams get invited. Other teams create their own accounts. Team 1 on a suitable location on a machine create the main project (git init and some kind of project structure - files and folders) and link it to the root git repo (git remote add origin…). This becomes team 1’s repo, and also the main repo. Team 2 should create the git repo. Once created team 2 should invite team 1 to join the repo. Also, once created, team 1 must push the empty maven project to this git repo (they cannot do this until have joined the repo from the invite).Finally team 2 should obtain a clone of the project team 1 created - this can be through a git clone or git pullreceived an invite to team 1’s repo, and should have accepted the invite. Team 2, using their own git account should git clone their version of the repo on their own machine. So the same project (git repo) is available in two git repos and on two different machines, each local git repo is tied to different git account i.e. having different ORIGINS. |
Activities
Team 1
Create the following piece of code
Unit Test
...
Code Block |
---|
xxx |
Class Under Test
...
- NameBuilderTest.java
Code Block |
---|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.celestial.gitflow.walkthrough;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
*
* @author Selvyn
*/
public class NameBuilderTest
{
public NameBuilderTest()
{
}
// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
//
@Test
public void test_null_params_result_empty_name()
{
// arrange
NameBuilder cut = new NameBuilder();
String[] input = {};
String expected = "";
// act
String actual = cut.buildName( input );
// assert
assertEquals(expected, actual);
}
} |
Class Under Test - NameBuilder.java
Code Block |
---|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.celestial.gitflow.walkthrough;
/**
*
* @author Selvyn
*/
class NameBuilder
{
public String buildName(String[] input)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} |
Once completed push your code to the repo
Team 2
Unit Test
...
Code Block |
---|
xxx |
Class Under Test
...
- JSONFormatterTest.java
Code Block |
---|
package com.celestial.gitflow.team2;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class JSONFormatterTest
{
@Test
void test()
{
// arrange
JSONFormatter cut = new JSONFormatter();
String input = "{}";
String expected = "{}";
// act
String actual = cut.format( input );
// assert
assertEquals(expected, actual);
}
} |
Class Under Test - JSONFormatter.java
Code Block |
---|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.celestial.gitflow.team2;
/**
*
* @author Selvyn
*/
class JSONFormatter
{
String format(String input)
{
return __format(input);
}
private String __format( String inputStream )
{
return inputStream;
}
} |
JSONFormatter.java
Code Block |
---|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.celestial.gitflow.team2;
/**
*
* @author Selvyn
*/
public interface Formatter
{
String format( String dataStream );
} |
Once completed push your code to the repo
...