target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void setPointNameText() { FellowPlayer fellowPlayer = new FellowPlayer(); int IDCountBefore = FellowPlayer.IDCOUNTER ; fellowPlayer.setPointName(ReferencePointName.Ball); int IDCountAfter = FellowPlayer.IDCOUNTER; assert(IDCountBefore+1==IDCountAfter); } | @Override void setPointName( ReferencePointName aPointName ) { super.setPointName( ReferencePointName.Player ); mId = IDCOUNTER++; } | FellowPlayer extends ReferencePoint { @Override void setPointName( ReferencePointName aPointName ) { super.setPointName( ReferencePointName.Player ); mId = IDCOUNTER++; } } | FellowPlayer extends ReferencePoint { @Override void setPointName( ReferencePointName aPointName ) { super.setPointName( ReferencePointName.Player ); mId = IDCOUNTER++; } FellowPlayer(); FellowPlayer(int aId, String aNickname, Boolean aStatus, double aDistanceToPlayer, double aAngleToPlayer, double aOrientation); } | FellowPlayer extends ReferencePoint { @Override void setPointName( ReferencePointName aPointName ) { super.setPointName( ReferencePointName.Player ); mId = IDCOUNTER++; } FellowPlayer(); FellowPlayer(int aId, String aNickname, Boolean aStatus, double aDistanceToPlayer, double aAngleToPlayer, double aOrientation); @Xml... | FellowPlayer extends ReferencePoint { @Override void setPointName( ReferencePointName aPointName ) { super.setPointName( ReferencePointName.Player ); mId = IDCOUNTER++; } FellowPlayer(); FellowPlayer(int aId, String aNickname, Boolean aStatus, double aDistanceToPlayer, double aAngleToPlayer, double aOrientation); @Xml... |
@Test public void testSetXOfPoint() { ReferencePoint referencePoint = new ReferencePoint(); referencePoint.setXOfPoint(10); assertThat(referencePoint.getXOfPoint()).isCloseTo(10, Percentage.withPercentage(1)); } | public void setXOfPoint( double aXValue ) { mX = aXValue; set( mX, mY, false ); } | ReferencePoint { public void setXOfPoint( double aXValue ) { mX = aXValue; set( mX, mY, false ); } } | ReferencePoint { public void setXOfPoint( double aXValue ) { mX = aXValue; set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aRefe... | ReferencePoint { public void setXOfPoint( double aXValue ) { mX = aXValue; set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aRefe... | ReferencePoint { public void setXOfPoint( double aXValue ) { mX = aXValue; set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aRefe... |
@Test public void testSetYOfPoint() { ReferencePoint referencePoint = new ReferencePoint(); referencePoint.setYOfPoint(10); assertThat(referencePoint.getYOfPoint()).isCloseTo(10, Percentage.withPercentage(1)); } | public void setYOfPoint( double aYValue ) { mY = aYValue; set( mX, mY, false ); } | ReferencePoint { public void setYOfPoint( double aYValue ) { mY = aYValue; set( mX, mY, false ); } } | ReferencePoint { public void setYOfPoint( double aYValue ) { mY = aYValue; set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aRefe... | ReferencePoint { public void setYOfPoint( double aYValue ) { mY = aYValue; set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aRefe... | ReferencePoint { public void setYOfPoint( double aYValue ) { mY = aYValue; set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aRefe... |
@Test public void testCopy() { ReferencePoint referencePoint = new ReferencePoint(10,15,false); ReferencePoint copyOfReferencePoint = referencePoint.copy(); assertThat(copyOfReferencePoint).isNotNull(); assertThat(copyOfReferencePoint).isInstanceOf(ReferencePoint.class); assertThat(copyOfReferencePoint.getXOfPoint()).i... | public ReferencePoint copy () { return new ReferencePoint( this ); } | ReferencePoint { public ReferencePoint copy () { return new ReferencePoint( this ); } } | ReferencePoint { public ReferencePoint copy () { return new ReferencePoint( this ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aReferencePoint );... | ReferencePoint { public ReferencePoint copy () { return new ReferencePoint( this ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aReferencePoint );... | ReferencePoint { public ReferencePoint copy () { return new ReferencePoint( this ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); ReferencePoint( ReferencePoint aReferencePoint );... |
@Test(expected = IllegalArgumentException.class) public void testSetWithPolarcoordinatesWithNegativeDistance() { ReferencePoint referencePoint = new ReferencePoint(); referencePoint.set(-5,25,true); } | public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... |
@Test(expected = IllegalArgumentException.class) public void testSetWithPolarcoordinatesWithToSmallAngle() { ReferencePoint referencePoint = new ReferencePoint(); referencePoint.set(13,-190,true); } | public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... |
@Test(expected = IllegalArgumentException.class) public void testSetWithPolarcoordinatesWithToBigAngle() { ReferencePoint referencePoint = new ReferencePoint(); referencePoint.set(13,190,true); } | public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... | ReferencePoint { public ReferencePoint set ( ReferencePoint aReferencePoint ) { mDistanceToPoint = aReferencePoint.getDistanceToPoint(); mAngleToPoint = aReferencePoint.getAngleToPoint(); mX = aReferencePoint.getXOfPoint(); mY = aReferencePoint.getYOfPoint(); mPointName = ReferencePointName.NoFixedName; return this; } ... |
@Test public void testAdd() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); ReferencePoint plusReferencePoint = new ReferencePoint(10,10, false); referencePoint.add(plusReferencePoint); assertThat(referencePoint.getXOfPoint()).isCloseTo(60,Percentage.withPercentage(1)); assertThat(referencePoint.getY... | public ReferencePoint add( ReferencePoint aReferencePoint ) { mX += aReferencePoint.mX; mY += aReferencePoint.mY; return set( mX, mY, false ); } | ReferencePoint { public ReferencePoint add( ReferencePoint aReferencePoint ) { mX += aReferencePoint.mX; mY += aReferencePoint.mY; return set( mX, mY, false ); } } | ReferencePoint { public ReferencePoint add( ReferencePoint aReferencePoint ) { mX += aReferencePoint.mX; mY += aReferencePoint.mY; return set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boo... | ReferencePoint { public ReferencePoint add( ReferencePoint aReferencePoint ) { mX += aReferencePoint.mX; mY += aReferencePoint.mY; return set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boo... | ReferencePoint { public ReferencePoint add( ReferencePoint aReferencePoint ) { mX += aReferencePoint.mX; mY += aReferencePoint.mY; return set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boo... |
@Test public void testMultiply() { ReferencePoint referencePoint = new ReferencePoint(50,20, false); referencePoint.multiply(2.0); assertThat(referencePoint.getXOfPoint()).isCloseTo(100, Percentage.withPercentage(1)); assertThat(referencePoint.getYOfPoint()).isCloseTo(40,Percentage.withPercentage(1)); } | public ReferencePoint multiply( double scalar ) { mX *= scalar; mY *= scalar; return set( mX, mY, false ); } | ReferencePoint { public ReferencePoint multiply( double scalar ) { mX *= scalar; mY *= scalar; return set( mX, mY, false ); } } | ReferencePoint { public ReferencePoint multiply( double scalar ) { mX *= scalar; mY *= scalar; return set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); Reference... | ReferencePoint { public ReferencePoint multiply( double scalar ) { mX *= scalar; mY *= scalar; return set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); Reference... | ReferencePoint { public ReferencePoint multiply( double scalar ) { mX *= scalar; mY *= scalar; return set( mX, mY, false ); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ReferencePoint( double aFirstValue, double aSecondValue, boolean aPolarcoordinates ); Reference... |
@Test public void testEpsilonEqualsReferencePointExactCorrect() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(new ReferencePoint(50,20,false),0); assertThat(result).isEqualTo(true); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void getXMLString() throws Exception { Kick kick = new Kick(90.1, (float) 21.0); assertThat(kick.getXMLString()).isEqualTo("<command> <kick> <angle>90.1</angle> <force>21.0</force> </kick> </command>"); } | @Override public String getXMLString() { return "<command> <kick> <angle>" + mAngle + "</angle> <force>" + mForce + "</force> </kick> </command>"; } | Kick implements Action { @Override public String getXMLString() { return "<command> <kick> <angle>" + mAngle + "</angle> <force>" + mForce + "</force> </kick> </command>"; } } | Kick implements Action { @Override public String getXMLString() { return "<command> <kick> <angle>" + mAngle + "</angle> <force>" + mForce + "</force> </kick> </command>"; } Kick( double aAngle, float aForce); } | Kick implements Action { @Override public String getXMLString() { return "<command> <kick> <angle>" + mAngle + "</angle> <force>" + mForce + "</force> </kick> </command>"; } Kick( double aAngle, float aForce); @Override String getXMLString(); double getAngle(); float getForce(); } | Kick implements Action { @Override public String getXMLString() { return "<command> <kick> <angle>" + mAngle + "</angle> <force>" + mForce + "</force> </kick> </command>"; } Kick( double aAngle, float aForce); @Override String getXMLString(); double getAngle(); float getForce(); } |
@Test public void testEpsilonEqualsReferencePointNotExactCorrect() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(new ReferencePoint(51,19,false),2); assertThat(result).isEqualTo(true); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsReferencePointExactNotCorrect() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(new ReferencePoint(100, 38, false), 0); assertThat(result).isEqualTo(false); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsReferencePointNotExactNotCorrect() { ReferencePoint referencePoint = new ReferencePoint(50,20, false); Boolean result = referencePoint.epsilonEquals(new ReferencePoint(100,38,false), 2); assertThat(result).isEqualTo(false); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsReferencePointWithReferencePointIsNull() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(null,0); assertThat(result).isEqualTo(false); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsReferencePointYSmallerThanEpsilon() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(new ReferencePoint(50,0,false),1); assertThat(result).isEqualTo(false); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsDoubleNotExactIsTrue() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(51.0,19.0,2); assertThat(result).isEqualTo(true); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsDoubleNotExactIsFalse() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(50.0,0.0,1); assertThat(result).isEqualTo(false); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsDoubleExactIsTrue() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(50.0,20.0,0); assertThat(result).isEqualTo(true); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEpsilonEqualsDoubleExactIsFalse() { ReferencePoint referencePoint = new ReferencePoint(50,20,false); Boolean result = referencePoint.epsilonEquals(138.0,31.0,0); assertThat(result).isEqualTo(false); } | public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } } | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... | ReferencePoint { public boolean epsilonEquals ( ReferencePoint aReferencePoint, double aEpsilon ) { return aReferencePoint != null && (Math.abs(aReferencePoint.getXOfPoint() - mX) <= aEpsilon) && (Math.abs(aReferencePoint.getYOfPoint() - mY) <= aEpsilon); } ReferencePoint( ); @Deprecated ReferencePoint( double aDistan... |
@Test public void testEqualsSameObject() { ReferencePoint referencePoint = new ReferencePoint(); Boolean result = referencePoint.equals(referencePoint); assertThat(result).isEqualTo(true); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return false; if (Double.dou... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... |
@Test public void testGetXMLString() { Movement movement = new Movement(51,50); assertThat(movement.getXMLString()).isEqualTo("<command> <wheel_velocities> <right>51</right> <left>50</left> </wheel_velocities> </command>"); } | @Override public String getXMLString() { return "<command> <wheel_velocities> <right>" + mRightWheelVelocity + "</right> <left>" + mLeftWheelVelocity + "</left> </wheel_velocities> </command>"; } | Movement implements Action { @Override public String getXMLString() { return "<command> <wheel_velocities> <right>" + mRightWheelVelocity + "</right> <left>" + mLeftWheelVelocity + "</left> </wheel_velocities> </command>"; } } | Movement implements Action { @Override public String getXMLString() { return "<command> <wheel_velocities> <right>" + mRightWheelVelocity + "</right> <left>" + mLeftWheelVelocity + "</left> </wheel_velocities> </command>"; } Movement( int aRightWheelVelocity, int aLeftWheelVelocity ); } | Movement implements Action { @Override public String getXMLString() { return "<command> <wheel_velocities> <right>" + mRightWheelVelocity + "</right> <left>" + mLeftWheelVelocity + "</left> </wheel_velocities> </command>"; } Movement( int aRightWheelVelocity, int aLeftWheelVelocity ); int getmRightWheelVelocity(); int ... | Movement implements Action { @Override public String getXMLString() { return "<command> <wheel_velocities> <right>" + mRightWheelVelocity + "</right> <left>" + mLeftWheelVelocity + "</left> </wheel_velocities> </command>"; } Movement( int aRightWheelVelocity, int aLeftWheelVelocity ); int getmRightWheelVelocity(); int ... |
@Test public void testEqualsObjectIsNull() { ReferencePoint referencePoint = new ReferencePoint(); Boolean result = referencePoint.equals(null); assertThat(result).isEqualTo(false); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return false; if (Double.dou... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... |
@Test public void testEqualsObjectIsOtherClass() { ReferencePoint referencePoint = new ReferencePoint(); Boolean result = referencePoint.equals(new Double(1.2)); assertThat(result).isEqualTo(false); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return false; if (Double.dou... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... | ReferencePoint { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePoint other = (ReferencePoint) obj; if (Double.doubleToLongBits(mAngleToPoint) != Double.doubleToLongBits(other.mAngleToPoint)) return fals... |
@Test public void testToString() { ReferencePoint referencePoint = new ReferencePoint(); referencePoint.setPointName(ReferencePointName.NoFixedName); double distance = 1.41421356; double angle = 45.0; referencePoint.setDistanceToPoint(distance); referencePoint.setAngleToPoint(angle); double x = referencePoint.getDistan... | @Override public String toString() { return "ReferencePoint [mPointName=" + mPointName + ", mDistanceToPoint=" + mDistanceToPoint + ", mAngleToPoint=" + mAngleToPoint + ", mX=" + mX + ", mY=" + mY + "]"; } | ReferencePoint { @Override public String toString() { return "ReferencePoint [mPointName=" + mPointName + ", mDistanceToPoint=" + mDistanceToPoint + ", mAngleToPoint=" + mAngleToPoint + ", mX=" + mX + ", mY=" + mY + "]"; } } | ReferencePoint { @Override public String toString() { return "ReferencePoint [mPointName=" + mPointName + ", mDistanceToPoint=" + mDistanceToPoint + ", mAngleToPoint=" + mAngleToPoint + ", mX=" + mX + ", mY=" + mY + "]"; } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ... | ReferencePoint { @Override public String toString() { return "ReferencePoint [mPointName=" + mPointName + ", mDistanceToPoint=" + mDistanceToPoint + ", mAngleToPoint=" + mAngleToPoint + ", mX=" + mX + ", mY=" + mY + "]"; } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ... | ReferencePoint { @Override public String toString() { return "ReferencePoint [mPointName=" + mPointName + ", mDistanceToPoint=" + mDistanceToPoint + ", mAngleToPoint=" + mAngleToPoint + ", mX=" + mX + ", mY=" + mY + "]"; } ReferencePoint( ); @Deprecated ReferencePoint( double aDistanceToPoint, double aAngleToPoint ); ... |
@Test public void testCreateRawWorldData() { ObjectFactory objectFactory = new ObjectFactory(); assertThat(objectFactory.createRawWorldData()).isInstanceOf(RawWorldData.class); } | public RawWorldData createRawWorldData() { return new RawWorldData(); } | ObjectFactory { public RawWorldData createRawWorldData() { return new RawWorldData(); } } | ObjectFactory { public RawWorldData createRawWorldData() { return new RawWorldData(); } } | ObjectFactory { public RawWorldData createRawWorldData() { return new RawWorldData(); } RawWorldData createRawWorldData(); } | ObjectFactory { public RawWorldData createRawWorldData() { return new RawWorldData(); } RawWorldData createRawWorldData(); } |
@Test public void testInitialConnectionData() { fail("Not yet implemented"); } | public InitialConnectionData( BotInformation aBot ){ mConnection.type = "Client"; mConnection.protocol_version = 1.0; mConnection.nickname = aBot.getBotname(); mConnection.rc_id = aBot.getRcId(); mConnection.vt_id = aBot.getVtId(); } | InitialConnectionData implements Action { public InitialConnectionData( BotInformation aBot ){ mConnection.type = "Client"; mConnection.protocol_version = 1.0; mConnection.nickname = aBot.getBotname(); mConnection.rc_id = aBot.getRcId(); mConnection.vt_id = aBot.getVtId(); } } | InitialConnectionData implements Action { public InitialConnectionData( BotInformation aBot ){ mConnection.type = "Client"; mConnection.protocol_version = 1.0; mConnection.nickname = aBot.getBotname(); mConnection.rc_id = aBot.getRcId(); mConnection.vt_id = aBot.getVtId(); } InitialConnectionData( BotInformation aBot )... | InitialConnectionData implements Action { public InitialConnectionData( BotInformation aBot ){ mConnection.type = "Client"; mConnection.protocol_version = 1.0; mConnection.nickname = aBot.getBotname(); mConnection.rc_id = aBot.getRcId(); mConnection.vt_id = aBot.getVtId(); } InitialConnectionData( BotInformation aBot )... | InitialConnectionData implements Action { public InitialConnectionData( BotInformation aBot ){ mConnection.type = "Client"; mConnection.protocol_version = 1.0; mConnection.nickname = aBot.getBotname(); mConnection.rc_id = aBot.getRcId(); mConnection.vt_id = aBot.getVtId(); } InitialConnectionData( BotInformation aBot )... |
@Test public void testGetXMLString() { InitialConnectionData initialConnectionData = new InitialConnectionData(botInformationMock); fail("Not yet implemented"); } | @Override public String getXMLString() { StringWriter vXMLDataStream = new StringWriter(); JAXB.marshal( mConnection, vXMLDataStream ); String vXMLDataString = vXMLDataStream.toString(); vXMLDataString = vXMLDataString.substring( vXMLDataString.indexOf('>') + 2 ); return vXMLDataString; } | InitialConnectionData implements Action { @Override public String getXMLString() { StringWriter vXMLDataStream = new StringWriter(); JAXB.marshal( mConnection, vXMLDataStream ); String vXMLDataString = vXMLDataStream.toString(); vXMLDataString = vXMLDataString.substring( vXMLDataString.indexOf('>') + 2 ); return vXMLDa... | InitialConnectionData implements Action { @Override public String getXMLString() { StringWriter vXMLDataStream = new StringWriter(); JAXB.marshal( mConnection, vXMLDataStream ); String vXMLDataString = vXMLDataStream.toString(); vXMLDataString = vXMLDataString.substring( vXMLDataString.indexOf('>') + 2 ); return vXMLDa... | InitialConnectionData implements Action { @Override public String getXMLString() { StringWriter vXMLDataStream = new StringWriter(); JAXB.marshal( mConnection, vXMLDataStream ); String vXMLDataString = vXMLDataStream.toString(); vXMLDataString = vXMLDataString.substring( vXMLDataString.indexOf('>') + 2 ); return vXMLDa... | InitialConnectionData implements Action { @Override public String getXMLString() { StringWriter vXMLDataStream = new StringWriter(); JAXB.marshal( mConnection, vXMLDataStream ); String vXMLDataString = vXMLDataStream.toString(); vXMLDataString = vXMLDataString.substring( vXMLDataString.indexOf('>') + 2 ); return vXMLDa... |
@Test public void testSendDatagramm() { } | public void sendDatagramm( String aData ) throws IOException { mDataPaket.setData( aData.getBytes() ); mToServerSocket.send( mDataPaket ); } | NetworkCommunication { public void sendDatagramm( String aData ) throws IOException { mDataPaket.setData( aData.getBytes() ); mToServerSocket.send( mDataPaket ); } } | NetworkCommunication { public void sendDatagramm( String aData ) throws IOException { mDataPaket.setData( aData.getBytes() ); mToServerSocket.send( mDataPaket ); } NetworkCommunication( InetAddress aServerAddress, int aServerPort ); NetworkCommunication( InetAddress aServerAddress, int aServerPort, int aClientPort); } | NetworkCommunication { public void sendDatagramm( String aData ) throws IOException { mDataPaket.setData( aData.getBytes() ); mToServerSocket.send( mDataPaket ); } NetworkCommunication( InetAddress aServerAddress, int aServerPort ); NetworkCommunication( InetAddress aServerAddress, int aServerPort, int aClientPort); v... | NetworkCommunication { public void sendDatagramm( String aData ) throws IOException { mDataPaket.setData( aData.getBytes() ); mToServerSocket.send( mDataPaket ); } NetworkCommunication( InetAddress aServerAddress, int aServerPort ); NetworkCommunication( InetAddress aServerAddress, int aServerPort, int aClientPort); v... |
@Test public void testParseCommandLineArgumentsWithNoExceptionsWithRemoteStart() { String[] args = {"-bn","3","-tn","Northern Stars","-t","blau","-ids","13","-s","localhost:3310","-aiarc","../mrbotkiexample/bin/exampleai/brain","-aicl","exampleai.brain.Striker","-aiarg","0","-rs"}; boolean result = CommandLineOptions.p... | static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, new TeamConverter()); c... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... |
@Test public void testParseCommandLineArgumentsWithNoExceptionsWithoutRemoteStart() { String[] args = {"-bn","3","-tn","Northern Stars","-t","blau","-ids","13","-s","localhost:3310","-aiarc","../mrbotkiexample/bin/exampleai/brain","-aicl","exampleai.brain.Striker","-aiarg","0"}; boolean result = CommandLineOptions.pars... | static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, new TeamConverter()); c... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... |
@Test public void testParseCommandLineArgumentsWithNoExceptionsWithMissingArgument() { String[] args = {"-bn","3","-tn","Northern Stars","-t","blau","-ids","13","-s","localhost:3310","-aiarc","../mrbotkiexample/bin/exampleai/brain","-aicl","exampleai.brain.Striker","-aiarg","0"}; boolean result = CommandLineOptions.par... | static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, new TeamConverter()); c... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... | CommandLineOptions { static boolean parseCommandLineArguments( String[] aArguments ) { Core.getLogger().trace( "Parsing commandline." ); CommandLineOptions commandLineOptions = new CommandLineOptions(); try { CommandLine commandLine = new CommandLine(commandLineOptions) .registerConverter(BotInformation.Teams.class, ne... |
@Test public void testHashCode() { Movement movement = new Movement(51,50); assertThat(movement.hashCode()).isEqualTo(2562); } | @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + mLeftWheelVelocity; result = prime * result + mRightWheelVelocity; return result; } | Movement implements Action { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + mLeftWheelVelocity; result = prime * result + mRightWheelVelocity; return result; } } | Movement implements Action { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + mLeftWheelVelocity; result = prime * result + mRightWheelVelocity; return result; } Movement( int aRightWheelVelocity, int aLeftWheelVelocity ); } | Movement implements Action { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + mLeftWheelVelocity; result = prime * result + mRightWheelVelocity; return result; } Movement( int aRightWheelVelocity, int aLeftWheelVelocity ); int getmRightWheelVelocity(); int getmLeftWheelV... | Movement implements Action { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + mLeftWheelVelocity; result = prime * result + mRightWheelVelocity; return result; } Movement( int aRightWheelVelocity, int aLeftWheelVelocity ); int getmRightWheelVelocity(); int getmLeftWheelV... |
@Test public void testSetOptions() { String[] args = {"-bn","3","-tn","Northern Stars","-t","blau","-ids","13","-s","localhost:3310","-aiarc","../mrbotkiexample/bin/exampleai/brain","-aicl","exampleai.brain.Striker","-aiarg","0"}; CommandLineOptions.parseCommandLineArguments(args); BotInformation botInformation = Core.... | private void setOptions() throws UnknownHostException { BotInformation botInformation = Core.getInstance().getBotinformation(); botInformation.setAIClassname(this.aiClassname); botInformation.setAIArchive(this.aiArchive); botInformation.setAIArgs(Arrays.toString(this.aiArguments)); botInformation.setTeamname(this.teamN... | CommandLineOptions { private void setOptions() throws UnknownHostException { BotInformation botInformation = Core.getInstance().getBotinformation(); botInformation.setAIClassname(this.aiClassname); botInformation.setAIArchive(this.aiArchive); botInformation.setAIArgs(Arrays.toString(this.aiArguments)); botInformation.s... | CommandLineOptions { private void setOptions() throws UnknownHostException { BotInformation botInformation = Core.getInstance().getBotinformation(); botInformation.setAIClassname(this.aiClassname); botInformation.setAIArchive(this.aiArchive); botInformation.setAIArgs(Arrays.toString(this.aiArguments)); botInformation.s... | CommandLineOptions { private void setOptions() throws UnknownHostException { BotInformation botInformation = Core.getInstance().getBotinformation(); botInformation.setAIClassname(this.aiClassname); botInformation.setAIArchive(this.aiArchive); botInformation.setAIArgs(Arrays.toString(this.aiArguments)); botInformation.s... | CommandLineOptions { private void setOptions() throws UnknownHostException { BotInformation botInformation = Core.getInstance().getBotinformation(); botInformation.setAIClassname(this.aiClassname); botInformation.setAIArchive(this.aiArchive); botInformation.setAIArgs(Arrays.toString(this.aiArguments)); botInformation.s... |
@Test public void testConvertWithValueIsGelb() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("gelb"); assertThat(result).isEqualTo(BotInformation.Teams.Yellow); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void testConvertWithValueIsYellow() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("yellow"); assertThat(result).isEqualTo(BotInformation.Teams.Yellow); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void testConvertWithValueIsG() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("g"); assertThat(result).isEqualTo(BotInformation.Teams.Yellow); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void testConvertWithValueIsY() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("y"); assertThat(result).isEqualTo(BotInformation.Teams.Yellow); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void testConvertWithValueIsBlau() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("blau"); assertThat(result).isEqualTo(BotInformation.Teams.Blue); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void testConvertWithValueIsBlue() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("blue"); assertThat(result).isEqualTo(BotInformation.Teams.Blue); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void testConvertWithValueIsB() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("b"); assertThat(result).isEqualTo(BotInformation.Teams.Blue); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void testConvertWithValueIsSomething() throws Exception { TeamConverter teamConverter = new TeamConverter(); BotInformation.Teams result = teamConverter.convert("something"); assertThat(result).isEqualTo(BotInformation.Teams.NotSpecified); } | @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; else return NotSpecified; } | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... | TeamConverter implements CommandLine.ITypeConverter<BotInformation.Teams> { @Override public BotInformation.Teams convert(String value) throws Exception { if (value == "gelb" || value == "yellow" || value == "g" || value == "y") return Yellow; else if (value == "blau" || value == "blue" || value == "b") return Blue; el... |
@Test public void mainWithEmptyCommandline() { String[] vEmptyCommandline = new String[0]; doNothing().when(mCoreMock).startBot(vEmptyCommandline); Main.main(vEmptyCommandline); assertThat(System.getProperty("Bot")).isEqualToIgnoringCase(ManagementFactory.getRuntimeMXBean().getName()); verify(mLoggerMock).info("Startin... | public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandline) { vP... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... |
@Test public void testEqualsWithSameObject() { Movement movement = new Movement(51,50); assertThat(movement.equals(movement)).isEqualTo(true); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRightWheelVelocity) return false... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... |
@Test public void mainWithACommandline() { String[] vCommandline = new String[5]; vCommandline[0] = "Hello,"; vCommandline[1] = "this"; vCommandline[2] = "is"; vCommandline[3] = "a"; vCommandline[4] = "test."; doNothing().when(mCoreMock).startBot(vCommandline); Main.main(vCommandline); assertThat(System.getProperty("Bo... | public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandline) { vP... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... |
@Test public void mainWithFatalError() { String[] vEmptyCommandline = new String[0]; RuntimeException vTestException = new RuntimeException(); doThrow(vTestException).when(mCoreMock).startBot(vEmptyCommandline); Main.main(vEmptyCommandline); verify(mCoreMock).startBot(vEmptyCommandline); verify(mLoggerMock).fatal( "Fat... | public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandline) { vP... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... | Main { public static void main( String[] aCommandline ) { System.setProperty("Bot", ManagementFactory.getRuntimeMXBean().getName() + "" ); Core.getLogger().info("Starting Bot(" + ManagementFactory.getRuntimeMXBean().getName() + ")" ); StringBuilder vParameters = new StringBuilder(); for ( String vParameter: aCommandlin... |
@Test public void testConstructorWithBotInformation() { mSUT = new Core(mBotInformationMock); assertThat(mSUT.getBotinformation()).isEqualTo(mBotInformationMock); } | synchronized public BotInformation getBotinformation() { Core.getLogger().debug( "Retriving Botinformation: \n" + mBotinformation.toString() ); return mBotinformation; } | Core { synchronized public BotInformation getBotinformation() { Core.getLogger().debug( "Retriving Botinformation: \n" + mBotinformation.toString() ); return mBotinformation; } } | Core { synchronized public BotInformation getBotinformation() { Core.getLogger().debug( "Retriving Botinformation: \n" + mBotinformation.toString() ); return mBotinformation; } Core(); Core( BotInformation aBotInformation ); } | Core { synchronized public BotInformation getBotinformation() { Core.getLogger().debug( "Retriving Botinformation: \n" + mBotinformation.toString() ); return mBotinformation; } Core(); Core( BotInformation aBotInformation ); static Core getInstance(); static synchronized Logger getLogger(); void close(); void startBo... | Core { synchronized public BotInformation getBotinformation() { Core.getLogger().debug( "Retriving Botinformation: \n" + mBotinformation.toString() ); return mBotinformation; } Core(); Core( BotInformation aBotInformation ); static Core getInstance(); static synchronized Logger getLogger(); void close(); void startBo... |
@Test public void testGetInstance() { mSUT = Core.getInstance(); assertThat(mSUT).isInstanceOf(Core.class); assertThat(mSUT).isEqualTo(Core.getInstance()); assertThat(mSUT.getBotinformation()).isEqualTo(Core.getInstance().getBotinformation()); } | public static Core getInstance() { if( Core.sINSTANCE == null){ Core.getLogger().trace( "Creating Core-instance." ); Core.sINSTANCE = new Core(); } Core.getLogger().trace( "Retrieving Core-instance." ); return Core.sINSTANCE; } | Core { public static Core getInstance() { if( Core.sINSTANCE == null){ Core.getLogger().trace( "Creating Core-instance." ); Core.sINSTANCE = new Core(); } Core.getLogger().trace( "Retrieving Core-instance." ); return Core.sINSTANCE; } } | Core { public static Core getInstance() { if( Core.sINSTANCE == null){ Core.getLogger().trace( "Creating Core-instance." ); Core.sINSTANCE = new Core(); } Core.getLogger().trace( "Retrieving Core-instance." ); return Core.sINSTANCE; } Core(); Core( BotInformation aBotInformation ); } | Core { public static Core getInstance() { if( Core.sINSTANCE == null){ Core.getLogger().trace( "Creating Core-instance." ); Core.sINSTANCE = new Core(); } Core.getLogger().trace( "Retrieving Core-instance." ); return Core.sINSTANCE; } Core(); Core( BotInformation aBotInformation ); static Core getInstance(); static s... | Core { public static Core getInstance() { if( Core.sINSTANCE == null){ Core.getLogger().trace( "Creating Core-instance." ); Core.sINSTANCE = new Core(); } Core.getLogger().trace( "Retrieving Core-instance." ); return Core.sINSTANCE; } Core(); Core( BotInformation aBotInformation ); static Core getInstance(); static s... |
@Test public void testGetLogger() { Logger vLoggerToTest = Core.getLogger(); assertThat(vLoggerToTest).isInstanceOf(Logger.class); assertThat(vLoggerToTest).isEqualTo(Core.getLogger()); } | public static synchronized Logger getLogger(){ return sBOTCORELOGGER; } | Core { public static synchronized Logger getLogger(){ return sBOTCORELOGGER; } } | Core { public static synchronized Logger getLogger(){ return sBOTCORELOGGER; } Core(); Core( BotInformation aBotInformation ); } | Core { public static synchronized Logger getLogger(){ return sBOTCORELOGGER; } Core(); Core( BotInformation aBotInformation ); static Core getInstance(); static synchronized Logger getLogger(); void close(); void startBot( String[] aCommandline ); @SuppressWarnings("resource") boolean initializeAI(); void disposeAI()... | Core { public static synchronized Logger getLogger(){ return sBOTCORELOGGER; } Core(); Core( BotInformation aBotInformation ); static Core getInstance(); static synchronized Logger getLogger(); void close(); void startBot( String[] aCommandline ); @SuppressWarnings("resource") boolean initializeAI(); void disposeAI()... |
@Test public void testStartManagementWithoutNetworkConnection() { when(mCoreMock.getServerConnection()).thenReturn( null ); try{ mSUT.startManagement(); fail("Expected Nullpointerexception"); } catch( Exception vExpectedException ) { assertThat(vExpectedException).isInstanceOf(NullPointerException.class); assertThat(vE... | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagement can not be started again." ); } else... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... |
@Test public void testStartManagementWithNetworkConnectionAndNotAlive() { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( null ); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock).info("FromServerManagement started."); } | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagement can not be started again." ); } else... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... |
@Test public void testStartManagementWithNetworkConnectionAndAlive() { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( null ); mSUT.startManagement(); try{ mSUT.startManagement(); fail("Expected IllegalThreadStateException"); } catch( Exception vExpecte... | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagement can not be started again." ); } else... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... |
@Test public void testStartWithoutNetworkConnection() { when(mCoreMock.getServerConnection()).thenReturn( null ); try{ mSUT.start(); fail("Expected Nullpointerexception"); } catch( Exception vExpectedException ) { assertThat(vExpectedException).isInstanceOf(NullPointerException.class); assertThat(vExpectedException.get... | @Override public void start(){ startManagement(); } | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } } | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } FromServerManagement(); } | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } FromServerManagement(); static FromServerManagement getInstance(); void close(); void resumeManagement(); void suspendManagement(); boolean isSuspended(); @Override void start(); void startManagement(); void stopManagement(); @Ove... | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } FromServerManagement(); static FromServerManagement getInstance(); void close(); void resumeManagement(); void suspendManagement(); boolean isSuspended(); @Override void start(); void startManagement(); void stopManagement(); @Ove... |
@Test public void testStartWithNetworkConnectionAndNotAlive() { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( null ); mSUT.start(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock).info("FromServerManagement started."); } | @Override public void start(){ startManagement(); } | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } } | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } FromServerManagement(); } | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } FromServerManagement(); static FromServerManagement getInstance(); void close(); void resumeManagement(); void suspendManagement(); boolean isSuspended(); @Override void start(); void startManagement(); void stopManagement(); @Ove... | FromServerManagement extends Thread { @Override public void start(){ startManagement(); } FromServerManagement(); static FromServerManagement getInstance(); void close(); void resumeManagement(); void suspendManagement(); boolean isSuspended(); @Override void start(); void startManagement(); void stopManagement(); @Ove... |
@Test public void testEqualsWithObjectIsNull() { Movement movement = new Movement(51,50); assertThat(movement.equals(null)).isEqualTo(false); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRightWheelVelocity) return false... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... |
@Test public void testGetInstance() { FromServerManagement vSaveToCompare = FromServerManagement.getInstance(); assertThat(vSaveToCompare).isInstanceOf(FromServerManagement.class); assertThat(vSaveToCompare).isEqualTo(FromServerManagement.getInstance()); } | public static FromServerManagement getInstance() { if( FromServerManagement.sINSTANCE == null){ FromServerManagement.sINSTANCE = new FromServerManagement(); } return FromServerManagement.sINSTANCE; } | FromServerManagement extends Thread { public static FromServerManagement getInstance() { if( FromServerManagement.sINSTANCE == null){ FromServerManagement.sINSTANCE = new FromServerManagement(); } return FromServerManagement.sINSTANCE; } } | FromServerManagement extends Thread { public static FromServerManagement getInstance() { if( FromServerManagement.sINSTANCE == null){ FromServerManagement.sINSTANCE = new FromServerManagement(); } return FromServerManagement.sINSTANCE; } FromServerManagement(); } | FromServerManagement extends Thread { public static FromServerManagement getInstance() { if( FromServerManagement.sINSTANCE == null){ FromServerManagement.sINSTANCE = new FromServerManagement(); } return FromServerManagement.sINSTANCE; } FromServerManagement(); static FromServerManagement getInstance(); void close(); v... | FromServerManagement extends Thread { public static FromServerManagement getInstance() { if( FromServerManagement.sINSTANCE == null){ FromServerManagement.sINSTANCE = new FromServerManagement(); } return FromServerManagement.sINSTANCE; } FromServerManagement(); static FromServerManagement getInstance(); void close(); v... |
@Test public void testStopManagementWhenNotAlive() { assertThat(mSUT.isAlive()).isFalse(); mSUT.stopManagement(); assertThat(mSUT.isAlive()).isFalse(); verify(mLoggerMock, never()).info("FromServerManagement stopped."); } | public void stopManagement(){ synchronized (this) { mManageMessagesFromServer = false; } if( isAlive()){ mSuspended = false; while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping FromServerManagement.", vException ); } } Core.getLogger().info( "FromServer... | FromServerManagement extends Thread { public void stopManagement(){ synchronized (this) { mManageMessagesFromServer = false; } if( isAlive()){ mSuspended = false; while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping FromServerManagement.", vException ); ... | FromServerManagement extends Thread { public void stopManagement(){ synchronized (this) { mManageMessagesFromServer = false; } if( isAlive()){ mSuspended = false; while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping FromServerManagement.", vException ); ... | FromServerManagement extends Thread { public void stopManagement(){ synchronized (this) { mManageMessagesFromServer = false; } if( isAlive()){ mSuspended = false; while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping FromServerManagement.", vException ); ... | FromServerManagement extends Thread { public void stopManagement(){ synchronized (this) { mManageMessagesFromServer = false; } if( isAlive()){ mSuspended = false; while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping FromServerManagement.", vException ); ... |
@Test public void testIsReceivingMessagesWhenNotAlive() { assertThat(mSUT.isAlive()).isFalse(); assertThat(mSUT.isReceivingMessages()).isFalse(); } | public boolean isReceivingMessages(){ return isAlive() && (System.currentTimeMillis() - mLastReceivedMessage.get()) < 100; } | FromServerManagement extends Thread { public boolean isReceivingMessages(){ return isAlive() && (System.currentTimeMillis() - mLastReceivedMessage.get()) < 100; } } | FromServerManagement extends Thread { public boolean isReceivingMessages(){ return isAlive() && (System.currentTimeMillis() - mLastReceivedMessage.get()) < 100; } FromServerManagement(); } | FromServerManagement extends Thread { public boolean isReceivingMessages(){ return isAlive() && (System.currentTimeMillis() - mLastReceivedMessage.get()) < 100; } FromServerManagement(); static FromServerManagement getInstance(); void close(); void resumeManagement(); void suspendManagement(); boolean isSuspended(); @O... | FromServerManagement extends Thread { public boolean isReceivingMessages(){ return isAlive() && (System.currentTimeMillis() - mLastReceivedMessage.get()) < 100; } FromServerManagement(); static FromServerManagement getInstance(); void close(); void resumeManagement(); void suspendManagement(); boolean isSuspended(); @O... |
@Test public void testRecieveMessagesWithAI() throws Exception { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( mArtificialIntelligenceMock ); WorldData vTestData = RawWorldData.createRawWorldDataFromXML("<rawWorldData><time>0</time><agent_id>20</agent... | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagement can not be started again." ); } else... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... |
@Test public void testLoseServerConnectionWhileRecievingMessages() throws Exception { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( mArtificialIntelligenceMock ); doReturn(new RawWorldData().toXMLString()).when(mNetworkCommunicationMock).getDatagramm(... | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagement can not be started again." ); } else... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... | FromServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting FromServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "FromServerManagemen... |
@Test public void testStartManagementWhileNotAlive() { when(mCoreMock.getAI()).thenReturn( null ); assertThat(mSUT.isAlive()).isFalse(); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock).info("RestartAiServerManagement started."); } | public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... |
@Test public void testStartManagementWhileAlive() { when(mCoreMock.getAI()).thenReturn( null ); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock, times(1)).info("RestartAiServerManagement started."); } | public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... |
@Test public void testStartWhileNotAlive() { when(mCoreMock.getAI()).thenReturn( null ); assertThat(mSUT.isAlive()).isFalse(); mSUT.start(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock).info("RestartAiServerManagement started."); } | @Override public void start(){ startManagement(); } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } ReloadAiManagement(); } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopManagement(); @Override void run(); } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopManagement(); @Override void run(); } |
@Test public void testStartWhileAlive() { when(mCoreMock.getAI()).thenReturn( null ); mSUT.start(); assertThat(mSUT.isAlive()).isTrue(); mSUT.start(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock, times(1)).info("RestartAiServerManagement started."); } | @Override public void start(){ startManagement(); } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } ReloadAiManagement(); } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopManagement(); @Override void run(); } | ReloadAiManagement extends Thread { @Override public void start(){ startManagement(); } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopManagement(); @Override void run(); } |
@Test public void testGetInstance() { ReloadAiManagement vSaveToCompare = ReloadAiManagement.getInstance(); assertThat(vSaveToCompare).isInstanceOf(ReloadAiManagement.class); assertThat(vSaveToCompare).isEqualTo(ReloadAiManagement.getInstance()); } | public static ReloadAiManagement getInstance() { if( ReloadAiManagement.sINSTANCE == null){ ReloadAiManagement.sINSTANCE = new ReloadAiManagement(); } return ReloadAiManagement.sINSTANCE; } | ReloadAiManagement extends Thread { public static ReloadAiManagement getInstance() { if( ReloadAiManagement.sINSTANCE == null){ ReloadAiManagement.sINSTANCE = new ReloadAiManagement(); } return ReloadAiManagement.sINSTANCE; } } | ReloadAiManagement extends Thread { public static ReloadAiManagement getInstance() { if( ReloadAiManagement.sINSTANCE == null){ ReloadAiManagement.sINSTANCE = new ReloadAiManagement(); } return ReloadAiManagement.sINSTANCE; } ReloadAiManagement(); } | ReloadAiManagement extends Thread { public static ReloadAiManagement getInstance() { if( ReloadAiManagement.sINSTANCE == null){ ReloadAiManagement.sINSTANCE = new ReloadAiManagement(); } return ReloadAiManagement.sINSTANCE; } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void st... | ReloadAiManagement extends Thread { public static ReloadAiManagement getInstance() { if( ReloadAiManagement.sINSTANCE == null){ ReloadAiManagement.sINSTANCE = new ReloadAiManagement(); } return ReloadAiManagement.sINSTANCE; } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void st... |
@Test public void testEqualsWithDifferentClass() { Movement movement = new Movement(51,50); assertThat(movement.equals(new Integer(12))).isEqualTo(false); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRightWheelVelocity) return false... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... |
@Test public void testStopManagementWhenNotAlive() { when(mCoreMock.getAI()).thenReturn( null ); assertThat(mSUT.isAlive()).isFalse(); mSUT.stopManagement(); assertThat(mSUT.isAlive()).isFalse(); verify(mLoggerMock, never()).info("RestartAiServerManagement stopped."); } | public void stopManagement(){ mAiActive = false; if( isAlive()){ Core.getLogger().info( "RestartAiServerManagement stopping." ); while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping RestartAiServerManagement.", vException ); } } Core.getLogger().info( "R... | ReloadAiManagement extends Thread { public void stopManagement(){ mAiActive = false; if( isAlive()){ Core.getLogger().info( "RestartAiServerManagement stopping." ); while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping RestartAiServerManagement.", vExcept... | ReloadAiManagement extends Thread { public void stopManagement(){ mAiActive = false; if( isAlive()){ Core.getLogger().info( "RestartAiServerManagement stopping." ); while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping RestartAiServerManagement.", vExcept... | ReloadAiManagement extends Thread { public void stopManagement(){ mAiActive = false; if( isAlive()){ Core.getLogger().info( "RestartAiServerManagement stopping." ); while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping RestartAiServerManagement.", vExcept... | ReloadAiManagement extends Thread { public void stopManagement(){ mAiActive = false; if( isAlive()){ Core.getLogger().info( "RestartAiServerManagement stopping." ); while(isAlive()){ try { Thread.sleep( 10 ); } catch ( Exception vException ) { Core.getLogger().error( "Error stopping RestartAiServerManagement.", vExcept... |
@Test public void testRunWithoutStart() throws Exception { when(mCoreMock.getAI()).thenReturn( mArtificialIntelligenceMock ); assertThat(mSUT.isAlive()).isFalse(); mSUT.run(); assertThat(mSUT.isAlive()).isFalse(); verifyZeroInteractions(mArtificialIntelligenceMock); } | @Override public void run(){ while( mAiActive ){ try { if(Core.getInstance().getAI() != null && Core.getInstance().getAI().wantRestart()){ Core.getInstance().initializeAI(); Core.getInstance().resumeAI(); Thread.sleep( 500 ); } Thread.sleep( 50 ); } catch ( Exception vException ) { Core.getLogger().error( "Error while ... | ReloadAiManagement extends Thread { @Override public void run(){ while( mAiActive ){ try { if(Core.getInstance().getAI() != null && Core.getInstance().getAI().wantRestart()){ Core.getInstance().initializeAI(); Core.getInstance().resumeAI(); Thread.sleep( 500 ); } Thread.sleep( 50 ); } catch ( Exception vException ) { C... | ReloadAiManagement extends Thread { @Override public void run(){ while( mAiActive ){ try { if(Core.getInstance().getAI() != null && Core.getInstance().getAI().wantRestart()){ Core.getInstance().initializeAI(); Core.getInstance().resumeAI(); Thread.sleep( 500 ); } Thread.sleep( 50 ); } catch ( Exception vException ) { C... | ReloadAiManagement extends Thread { @Override public void run(){ while( mAiActive ){ try { if(Core.getInstance().getAI() != null && Core.getInstance().getAI().wantRestart()){ Core.getInstance().initializeAI(); Core.getInstance().resumeAI(); Thread.sleep( 500 ); } Thread.sleep( 50 ); } catch ( Exception vException ) { C... | ReloadAiManagement extends Thread { @Override public void run(){ while( mAiActive ){ try { if(Core.getInstance().getAI() != null && Core.getInstance().getAI().wantRestart()){ Core.getInstance().initializeAI(); Core.getInstance().resumeAI(); Thread.sleep( 500 ); } Thread.sleep( 50 ); } catch ( Exception vException ) { C... |
@Test public void testRunWithoutAI() throws Exception { when(mCoreMock.getAI()).thenReturn( null ); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); } | public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... |
@Test public void testRunWithAIAndNoNeedToRestart() throws Exception { when(mCoreMock.getAI()).thenReturn( mArtificialIntelligenceMock ); when(mArtificialIntelligenceMock.wantRestart()).thenReturn(false); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); await().atMost(2, SECONDS).untilAsserted(()->verify(mA... | public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... |
@Test public void testRunWithAIAndNeedToRestart() throws Exception { when(mCoreMock.getAI()).thenReturn( mArtificialIntelligenceMock ); when(mArtificialIntelligenceMock.wantRestart()).thenReturn(true).thenReturn(false); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); await().atMost(2, SECONDS).untilAsserte... | public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); } | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... | ReloadAiManagement extends Thread { public void startManagement(){ if( !isAlive() ){ mAiActive = true; super.start(); Core.getLogger().info( "RestartAiServerManagement started." ); } } ReloadAiManagement(); static ReloadAiManagement getInstance(); void close(); @Override void start(); void startManagement(); void stopM... |
@Test public void testStartManagementWithoutNetworkConnection() { when(mCoreMock.getServerConnection()).thenReturn( null ); try{ mSUT.startManagement(); fail("Expected Nullpointerexception"); } catch( Exception vExpectedException ) { assertThat(vExpectedException).isInstanceOf(NullPointerException.class); assertThat(vE... | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can not be started again." ); } else { s... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... |
@Test public void testStartManagementWithNetworkConnectionAndNotAlive() { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( null ); mSUT.startManagement(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock).info("ToServerManagement started."); } | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can not be started again." ); } else { s... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... |
@Test public void testStartManagementWithNetworkConnectionAndAlive() { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( null ); mSUT.startManagement(); try{ mSUT.startManagement(); fail("Expected IllegalThreadStateException"); } catch( Exception vExpecte... | public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can not be started again." ); } else { s... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... | ToServerManagement extends Thread { public void startManagement(){ if( Core.getInstance().getServerConnection() == null ) { throw new NullPointerException( "NetworkCommunication cannot be NULL when starting ToServerManagement." ) ; } else if ( isAlive() ){ throw new IllegalThreadStateException( "ToServerManagement can ... |
@Test public void testStartWithoutNetworkConnection() { when(mCoreMock.getServerConnection()).thenReturn( null ); try{ mSUT.start(); fail("Expected Nullpointerexception"); } catch( Exception vExpectedException ) { assertThat(vExpectedException).isInstanceOf(NullPointerException.class); assertThat(vExpectedException.get... | @Override public void start(){ this.startManagement(); } | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } } | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } ToServerManagement(); } | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } ToServerManagement(); static ToServerManagement getInstance(); void close(); void resumeManagement(); boolean isSuspended(); void suspendManagement(); @Override void start(); void startManagement(); void stopManagement(); @Over... | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } ToServerManagement(); static ToServerManagement getInstance(); void close(); void resumeManagement(); boolean isSuspended(); void suspendManagement(); @Override void start(); void startManagement(); void stopManagement(); @Over... |
@Test public void testStartWithNetworkConnectionAndNotAlive() { when(mCoreMock.getServerConnection()).thenReturn( mNetworkCommunicationMock ); when(mCoreMock.getAI()).thenReturn( null ); mSUT.start(); assertThat(mSUT.isAlive()).isTrue(); verify(mLoggerMock).info("ToServerManagement started."); } | @Override public void start(){ this.startManagement(); } | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } } | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } ToServerManagement(); } | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } ToServerManagement(); static ToServerManagement getInstance(); void close(); void resumeManagement(); boolean isSuspended(); void suspendManagement(); @Override void start(); void startManagement(); void stopManagement(); @Over... | ToServerManagement extends Thread { @Override public void start(){ this.startManagement(); } ToServerManagement(); static ToServerManagement getInstance(); void close(); void resumeManagement(); boolean isSuspended(); void suspendManagement(); @Override void start(); void startManagement(); void stopManagement(); @Over... |
@Test public void testEqualsWithDifferentLeftWheelVelocity() { Movement movement1 = new Movement(51,50); Movement movement2 = new Movement(51,49); assertThat(movement1.equals(movement2)).isEqualTo(false); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRightWheelVelocity) return false... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... | Movement implements Action { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Movement other = (Movement) obj; if (mLeftWheelVelocity != other.mLeftWheelVelocity) return false; if (mRightWheelVelocity != other.mRig... |
@Test public void testUndertowHttp2Enabled() { props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0); UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory(); webConfigurer.customize(container); Builder builder = Undertow.builder(); container.getBuilderCustomizers()... | @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("html", "text/html;charset=utf-8"); mappings.add("json", "text/html;charset=utf-8"); container.setMimeMappings(mappings); setLocationForStaticAssets(container); ... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("html", "text/html;charset=utf-8"); mappings.add("json", "text/html;char... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("html", "text/html;charset=utf-8"); mappings.add("json", "text/html;char... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("html", "text/html;charset=utf-8"); mappings.add("json", "text/html;char... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("html", "text/html;charset=utf-8"); mappings.add("json", "text/html;char... |
@Test public void testCorsFilterOnApiPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props.g... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... |
@Test public void testCorsFilterOnOtherPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... |
@Test public void testCorsFilterDeactivated() throws Exception { props.getCors().setAllowedOrigins(null); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( get("/api/test-cors") .header(HttpHeaders.ORIGIN, "other.domai... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... |
@Test public void testCorsFilterDeactivated2() throws Exception { props.getCors().setAllowedOrigins(new ArrayList<>()); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( get("/api/test-cors") .header(HttpHeaders.ORIGIN... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... | WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAl... |
@Test public void getActiveProfilesTest() throws Exception { MvcResult res = mock.perform(get("/api/profile-info") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andReturn(); assertTrue(res.getResponse().getContentAsString().contains(... | @GetMapping("/profile-info") public ProfileInfoVM getActiveProfiles() { String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env); return new ProfileInfoVM(activeProfiles, getRibbonEnv(activeProfiles)); } | ProfileInfoResource { @GetMapping("/profile-info") public ProfileInfoVM getActiveProfiles() { String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env); return new ProfileInfoVM(activeProfiles, getRibbonEnv(activeProfiles)); } } | ProfileInfoResource { @GetMapping("/profile-info") public ProfileInfoVM getActiveProfiles() { String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env); return new ProfileInfoVM(activeProfiles, getRibbonEnv(activeProfiles)); } ProfileInfoResource(Environment env, JHipsterProperties jHipsterProperties); } | ProfileInfoResource { @GetMapping("/profile-info") public ProfileInfoVM getActiveProfiles() { String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env); return new ProfileInfoVM(activeProfiles, getRibbonEnv(activeProfiles)); } ProfileInfoResource(Environment env, JHipsterProperties jHipsterProperties); @GetMa... | ProfileInfoResource { @GetMapping("/profile-info") public ProfileInfoVM getActiveProfiles() { String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env); return new ProfileInfoVM(activeProfiles, getRibbonEnv(activeProfiles)); } ProfileInfoResource(Environment env, JHipsterProperties jHipsterProperties); @GetMa... |
@Test public void testReturnFalseWhenJWTisUnsupported() { String unsupportedToken = createUnsupportedToken(); boolean isTokenValid = tokenProvider.validateToken(unsupportedToken); assertThat(isTokenValid).isEqualTo(false); } | public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken); return true; } catch (SignatureException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature trace: {}", e); } catch (MalformedJwtException e) { log.info("Invalid JWT token."); ... | TokenProvider { public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken); return true; } catch (SignatureException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature trace: {}", e); } catch (MalformedJwtException e) { log.info("Invali... | TokenProvider { public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken); return true; } catch (SignatureException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature trace: {}", e); } catch (MalformedJwtException e) { log.info("Invali... | TokenProvider { public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken); return true; } catch (SignatureException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature trace: {}", e); } catch (MalformedJwtException e) { log.info("Invali... | TokenProvider { public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken); return true; } catch (SignatureException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature trace: {}", e); } catch (MalformedJwtException e) { log.info("Invali... |
@Test public void getListTest() throws Exception { mock.perform(get("/management/logs") .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)); } | @GetMapping("/logs") @Timed public List<LoggerVM> getList() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); return context.getLoggerList() .stream() .map(LoggerVM::new) .collect(Collectors.toList()); } | LogsResource { @GetMapping("/logs") @Timed public List<LoggerVM> getList() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); return context.getLoggerList() .stream() .map(LoggerVM::new) .collect(Collectors.toList()); } } | LogsResource { @GetMapping("/logs") @Timed public List<LoggerVM> getList() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); return context.getLoggerList() .stream() .map(LoggerVM::new) .collect(Collectors.toList()); } } | LogsResource { @GetMapping("/logs") @Timed public List<LoggerVM> getList() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); return context.getLoggerList() .stream() .map(LoggerVM::new) .collect(Collectors.toList()); } @GetMapping("/logs") @Timed List<LoggerVM> getList(); @PutMapping("/logs"... | LogsResource { @GetMapping("/logs") @Timed public List<LoggerVM> getList() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); return context.getLoggerList() .stream() .map(LoggerVM::new) .collect(Collectors.toList()); } @GetMapping("/logs") @Timed List<LoggerVM> getList(); @PutMapping("/logs"... |
@Test public void changeLevelTest() throws Exception { LoggerVM logger = new LoggerVM(); logger.setLevel("ERROR"); logger.setName("ROOT"); mock.perform(put("/management/logs") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(new ObjectMapper().writeValueAsString(logger))) .andExpect(status().isNoContent()); MvcRe... | @PutMapping("/logs") @ResponseStatus(HttpStatus.NO_CONTENT) @Timed public void changeLevel(@RequestBody LoggerVM jsonLogger) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); } | LogsResource { @PutMapping("/logs") @ResponseStatus(HttpStatus.NO_CONTENT) @Timed public void changeLevel(@RequestBody LoggerVM jsonLogger) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); } } | LogsResource { @PutMapping("/logs") @ResponseStatus(HttpStatus.NO_CONTENT) @Timed public void changeLevel(@RequestBody LoggerVM jsonLogger) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); } } | LogsResource { @PutMapping("/logs") @ResponseStatus(HttpStatus.NO_CONTENT) @Timed public void changeLevel(@RequestBody LoggerVM jsonLogger) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); } @GetMapping(... | LogsResource { @PutMapping("/logs") @ResponseStatus(HttpStatus.NO_CONTENT) @Timed public void changeLevel(@RequestBody LoggerVM jsonLogger) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); } @GetMapping(... |
@Test public void eurekaTest() throws Exception { Mockito.doReturn(null).when(ssh).getPublicKey(); mock.perform(get("/api/ssh/public_key")) .andExpect(status().isNotFound()); Mockito.doReturn("key").when(ssh).getPublicKey(); mock.perform(get("/api/ssh/public_key")) .andExpect(content().contentTypeCompatibleWith(MediaTy... | @GetMapping(value = "/ssh/public_key", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<String> eureka() { try { String publicKey = getPublicKey(); if(publicKey != null) return new ResponseEntity<>(publicKey, HttpStatus.OK); } catch (IOException e) { log.warn("SSH public key could not be loaded: {}",... | SshResource { @GetMapping(value = "/ssh/public_key", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<String> eureka() { try { String publicKey = getPublicKey(); if(publicKey != null) return new ResponseEntity<>(publicKey, HttpStatus.OK); } catch (IOException e) { log.warn("SSH public key could not b... | SshResource { @GetMapping(value = "/ssh/public_key", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<String> eureka() { try { String publicKey = getPublicKey(); if(publicKey != null) return new ResponseEntity<>(publicKey, HttpStatus.OK); } catch (IOException e) { log.warn("SSH public key could not b... | SshResource { @GetMapping(value = "/ssh/public_key", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<String> eureka() { try { String publicKey = getPublicKey(); if(publicKey != null) return new ResponseEntity<>(publicKey, HttpStatus.OK); } catch (IOException e) { log.warn("SSH public key could not b... | SshResource { @GetMapping(value = "/ssh/public_key", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<String> eureka() { try { String publicKey = getPublicKey(); if(publicKey != null) return new ResponseEntity<>(publicKey, HttpStatus.OK); } catch (IOException e) { log.warn("SSH public key could not b... |
@Test public void authorizeTest() throws Exception { LoginVM vm = new LoginVM(); vm.setUsername("admin"); vm.setPassword("admin"); vm.setRememberMe(true); Mockito.doReturn("fakeToken").when(tokenProvider) .createToken(Mockito.any(Authentication.class), Mockito.anyBoolean()); mock.perform(post("/api/authenticate") .cont... | @PostMapping("/authenticate") @Timed public ResponseEntity authorize(@Valid @RequestBody LoginVM loginVM, HttpServletResponse response) { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginVM.getUsername(), loginVM.getPassword()); try { Authentication authentication =... | UserJWTController { @PostMapping("/authenticate") @Timed public ResponseEntity authorize(@Valid @RequestBody LoginVM loginVM, HttpServletResponse response) { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginVM.getUsername(), loginVM.getPassword()); try { Authenticat... | UserJWTController { @PostMapping("/authenticate") @Timed public ResponseEntity authorize(@Valid @RequestBody LoginVM loginVM, HttpServletResponse response) { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginVM.getUsername(), loginVM.getPassword()); try { Authenticat... | UserJWTController { @PostMapping("/authenticate") @Timed public ResponseEntity authorize(@Valid @RequestBody LoginVM loginVM, HttpServletResponse response) { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginVM.getUsername(), loginVM.getPassword()); try { Authenticat... | UserJWTController { @PostMapping("/authenticate") @Timed public ResponseEntity authorize(@Valid @RequestBody LoginVM loginVM, HttpServletResponse response) { UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginVM.getUsername(), loginVM.getPassword()); try { Authenticat... |
@Test public void processValidationErrorTest() throws Exception { UserJWTController control = new UserJWTController(null, null); MockMvc jwtMock = MockMvcBuilders.standaloneSetup(control) .setControllerAdvice(new ExceptionTranslator()) .build(); MvcResult res = jwtMock.perform(post("/api/authenticate") .contentType(Med... | @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ErrorVM processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List<FieldError> fieldErrors = result.getFieldErrors(); ErrorVM dto = new ErrorVM(Error... | ExceptionTranslator { @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ErrorVM processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List<FieldError> fieldErrors = result.getFieldErrors(); ErrorVM d... | ExceptionTranslator { @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ErrorVM processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List<FieldError> fieldErrors = result.getFieldErrors(); ErrorVM d... | ExceptionTranslator { @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ErrorVM processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List<FieldError> fieldErrors = result.getFieldErrors(); ErrorVM d... | ExceptionTranslator { @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ErrorVM processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List<FieldError> fieldErrors = result.getFieldErrors(); ErrorVM d... |
@Test public void processParameterizedValidationErrorTest() throws Exception { SecurityContext securityContext = Mockito.mock(SecurityContext.class); Mockito.when(securityContext.getAuthentication()).thenThrow(new CustomParameterizedException(null)); SecurityContextHolder.setContext(securityContext); MvcResult res = mo... | @ExceptionHandler(CustomParameterizedException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ParameterizedErrorVM processParameterizedValidationError(CustomParameterizedException ex) { return ex.getErrorVM(); } | ExceptionTranslator { @ExceptionHandler(CustomParameterizedException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ParameterizedErrorVM processParameterizedValidationError(CustomParameterizedException ex) { return ex.getErrorVM(); } } | ExceptionTranslator { @ExceptionHandler(CustomParameterizedException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ParameterizedErrorVM processParameterizedValidationError(CustomParameterizedException ex) { return ex.getErrorVM(); } } | ExceptionTranslator { @ExceptionHandler(CustomParameterizedException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ParameterizedErrorVM processParameterizedValidationError(CustomParameterizedException ex) { return ex.getErrorVM(); } @ExceptionHandler(MethodArgumentNotValidException.class) @Respon... | ExceptionTranslator { @ExceptionHandler(CustomParameterizedException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ParameterizedErrorVM processParameterizedValidationError(CustomParameterizedException ex) { return ex.getErrorVM(); } @ExceptionHandler(MethodArgumentNotValidException.class) @Respon... |
@Test public void processAccessDeniedExceptionTest() throws Exception { SecurityContext securityContext = Mockito.mock(SecurityContext.class); Mockito.when(securityContext.getAuthentication()).thenThrow(new AccessDeniedException(null)); SecurityContextHolder.setContext(securityContext); MvcResult res = mock.perform(get... | @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.FORBIDDEN) @ResponseBody public ErrorVM processAccessDeniedException(AccessDeniedException e) { return new ErrorVM(ErrorConstants.ERR_ACCESS_DENIED, e.getMessage()); } | ExceptionTranslator { @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.FORBIDDEN) @ResponseBody public ErrorVM processAccessDeniedException(AccessDeniedException e) { return new ErrorVM(ErrorConstants.ERR_ACCESS_DENIED, e.getMessage()); } } | ExceptionTranslator { @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.FORBIDDEN) @ResponseBody public ErrorVM processAccessDeniedException(AccessDeniedException e) { return new ErrorVM(ErrorConstants.ERR_ACCESS_DENIED, e.getMessage()); } } | ExceptionTranslator { @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.FORBIDDEN) @ResponseBody public ErrorVM processAccessDeniedException(AccessDeniedException e) { return new ErrorVM(ErrorConstants.ERR_ACCESS_DENIED, e.getMessage()); } @ExceptionHandler(MethodArgumentNotValidException.class... | ExceptionTranslator { @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.FORBIDDEN) @ResponseBody public ErrorVM processAccessDeniedException(AccessDeniedException e) { return new ErrorVM(ErrorConstants.ERR_ACCESS_DENIED, e.getMessage()); } @ExceptionHandler(MethodArgumentNotValidException.class... |
@Test public void processMethodNotSupportedExceptionTest() throws Exception { MvcResult res = mock.perform(post("/api/account") .content("{\"testFakeParam\"}")) .andExpect(status().isMethodNotAllowed()) .andReturn(); assertThat(res.getResolvedException(), instanceOf(HttpRequestMethodNotSupportedException.class)); } | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) @ResponseBody @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) public ErrorVM processMethodNotSupportedException(HttpRequestMethodNotSupportedException exception) { return new ErrorVM(ErrorConstants.ERR_METHOD_NOT_SUPPORTED, exception.getMessage()); } | ExceptionTranslator { @ExceptionHandler(HttpRequestMethodNotSupportedException.class) @ResponseBody @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) public ErrorVM processMethodNotSupportedException(HttpRequestMethodNotSupportedException exception) { return new ErrorVM(ErrorConstants.ERR_METHOD_NOT_SUPPORTED, exception.g... | ExceptionTranslator { @ExceptionHandler(HttpRequestMethodNotSupportedException.class) @ResponseBody @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) public ErrorVM processMethodNotSupportedException(HttpRequestMethodNotSupportedException exception) { return new ErrorVM(ErrorConstants.ERR_METHOD_NOT_SUPPORTED, exception.g... | ExceptionTranslator { @ExceptionHandler(HttpRequestMethodNotSupportedException.class) @ResponseBody @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) public ErrorVM processMethodNotSupportedException(HttpRequestMethodNotSupportedException exception) { return new ErrorVM(ErrorConstants.ERR_METHOD_NOT_SUPPORTED, exception.g... | ExceptionTranslator { @ExceptionHandler(HttpRequestMethodNotSupportedException.class) @ResponseBody @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) public ErrorVM processMethodNotSupportedException(HttpRequestMethodNotSupportedException exception) { return new ErrorVM(ErrorConstants.ERR_METHOD_NOT_SUPPORTED, exception.g... |
@Test public void processRuntimeExceptionTest() throws Exception { SecurityContext securityContext = Mockito.mock(SecurityContext.class); Mockito.when(securityContext.getAuthentication()).thenThrow(new RuntimeException()); SecurityContextHolder.setContext(securityContext); MvcResult res = mock.perform(get("/api/account... | @ExceptionHandler(Exception.class) public ResponseEntity<ErrorVM> processRuntimeException(Exception ex) { BodyBuilder builder; ErrorVM errorVM; ResponseStatus responseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class); if (responseStatus != null) { builder = ResponseEntity.status(responseStatu... | ExceptionTranslator { @ExceptionHandler(Exception.class) public ResponseEntity<ErrorVM> processRuntimeException(Exception ex) { BodyBuilder builder; ErrorVM errorVM; ResponseStatus responseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class); if (responseStatus != null) { builder = ResponseEntit... | ExceptionTranslator { @ExceptionHandler(Exception.class) public ResponseEntity<ErrorVM> processRuntimeException(Exception ex) { BodyBuilder builder; ErrorVM errorVM; ResponseStatus responseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class); if (responseStatus != null) { builder = ResponseEntit... | ExceptionTranslator { @ExceptionHandler(Exception.class) public ResponseEntity<ErrorVM> processRuntimeException(Exception ex) { BodyBuilder builder; ErrorVM errorVM; ResponseStatus responseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class); if (responseStatus != null) { builder = ResponseEntit... | ExceptionTranslator { @ExceptionHandler(Exception.class) public ResponseEntity<ErrorVM> processRuntimeException(Exception ex) { BodyBuilder builder; ErrorVM errorVM; ResponseStatus responseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class); if (responseStatus != null) { builder = ResponseEntit... |
@Test public void getErrorVMTest() throws Exception { CustomParameterizedException exc = new CustomParameterizedException("Test"); try { throw exc; } catch ( Exception exception ) { assertTrue(exception instanceof CustomParameterizedException); CustomParameterizedException exceptionCast = (CustomParameterizedException)... | public ParameterizedErrorVM getErrorVM() { return new ParameterizedErrorVM(message, paramMap); } | CustomParameterizedException extends RuntimeException { public ParameterizedErrorVM getErrorVM() { return new ParameterizedErrorVM(message, paramMap); } } | CustomParameterizedException extends RuntimeException { public ParameterizedErrorVM getErrorVM() { return new ParameterizedErrorVM(message, paramMap); } CustomParameterizedException(String message, String... params); CustomParameterizedException(String message, Map<String, String> paramMap); } | CustomParameterizedException extends RuntimeException { public ParameterizedErrorVM getErrorVM() { return new ParameterizedErrorVM(message, paramMap); } CustomParameterizedException(String message, String... params); CustomParameterizedException(String message, Map<String, String> paramMap); ParameterizedErrorVM getEr... | CustomParameterizedException extends RuntimeException { public ParameterizedErrorVM getErrorVM() { return new ParameterizedErrorVM(message, paramMap); } CustomParameterizedException(String message, String... params); CustomParameterizedException(String message, Map<String, String> paramMap); ParameterizedErrorVM getEr... |
@Test public void getObjectNameTest() throws Exception { FieldErrorVM vm = new FieldErrorVM(null, null, null); assertNull(vm.getObjectName()); vm = new FieldErrorVM("dto", "field", "message"); assertEquals("dto", vm.getObjectName()); } | public String getObjectName() { return objectName; } | FieldErrorVM implements Serializable { public String getObjectName() { return objectName; } } | FieldErrorVM implements Serializable { public String getObjectName() { return objectName; } FieldErrorVM(String dto, String field, String message); } | FieldErrorVM implements Serializable { public String getObjectName() { return objectName; } FieldErrorVM(String dto, String field, String message); String getObjectName(); String getField(); String getMessage(); } | FieldErrorVM implements Serializable { public String getObjectName() { return objectName; } FieldErrorVM(String dto, String field, String message); String getObjectName(); String getField(); String getMessage(); } |
@Test public void getFieldTest() throws Exception { FieldErrorVM vm = new FieldErrorVM(null, null, null); assertNull(vm.getField()); vm = new FieldErrorVM("dto", "field", "message"); assertEquals("field", vm.getField()); } | public String getField() { return field; } | FieldErrorVM implements Serializable { public String getField() { return field; } } | FieldErrorVM implements Serializable { public String getField() { return field; } FieldErrorVM(String dto, String field, String message); } | FieldErrorVM implements Serializable { public String getField() { return field; } FieldErrorVM(String dto, String field, String message); String getObjectName(); String getField(); String getMessage(); } | FieldErrorVM implements Serializable { public String getField() { return field; } FieldErrorVM(String dto, String field, String message); String getObjectName(); String getField(); String getMessage(); } |
@Test public void getMessageTest() throws Exception { FieldErrorVM vm = new FieldErrorVM(null, null, null); assertNull(vm.getMessage()); vm = new FieldErrorVM("dto", "field", "message"); assertEquals("message", vm.getMessage()); } | public String getMessage() { return message; } | FieldErrorVM implements Serializable { public String getMessage() { return message; } } | FieldErrorVM implements Serializable { public String getMessage() { return message; } FieldErrorVM(String dto, String field, String message); } | FieldErrorVM implements Serializable { public String getMessage() { return message; } FieldErrorVM(String dto, String field, String message); String getObjectName(); String getField(); String getMessage(); } | FieldErrorVM implements Serializable { public String getMessage() { return message; } FieldErrorVM(String dto, String field, String message); String getObjectName(); String getField(); String getMessage(); } |
@Test public void addTest() throws Exception { assertNull(vm1.getFieldErrors()); assertNull(vm2.getFieldErrors()); assertNotNull(vm3.getFieldErrors()); assertNull(vm1null.getFieldErrors()); assertNull(vm2null.getFieldErrors()); assertNull(vm3null.getFieldErrors()); vm1.add("testObjectName", "testField", "testMsg"); vm2... | public void add(String objectName, String field, String message) { if (fieldErrors == null) { fieldErrors = new ArrayList<>(); } fieldErrors.add(new FieldErrorVM(objectName, field, message)); } | ErrorVM implements Serializable { public void add(String objectName, String field, String message) { if (fieldErrors == null) { fieldErrors = new ArrayList<>(); } fieldErrors.add(new FieldErrorVM(objectName, field, message)); } } | ErrorVM implements Serializable { public void add(String objectName, String field, String message) { if (fieldErrors == null) { fieldErrors = new ArrayList<>(); } fieldErrors.add(new FieldErrorVM(objectName, field, message)); } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String messa... | ErrorVM implements Serializable { public void add(String objectName, String field, String message) { if (fieldErrors == null) { fieldErrors = new ArrayList<>(); } fieldErrors.add(new FieldErrorVM(objectName, field, message)); } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String messa... | ErrorVM implements Serializable { public void add(String objectName, String field, String message) { if (fieldErrors == null) { fieldErrors = new ArrayList<>(); } fieldErrors.add(new FieldErrorVM(objectName, field, message)); } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String messa... |
@Test public void getMessageTest() throws Exception { assertEquals(message, vm1.getMessage()); assertEquals(message, vm2.getMessage()); assertEquals(message, vm3.getMessage()); assertNull(vm1null.getMessage()); assertNull(vm2null.getMessage()); assertNull(vm3null.getMessage()); } | public String getMessage() { return message; } | ErrorVM implements Serializable { public String getMessage() { return message; } } | ErrorVM implements Serializable { public String getMessage() { return message; } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String message, String description, List<FieldErrorVM> fieldErrors); } | ErrorVM implements Serializable { public String getMessage() { return message; } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String message, String description, List<FieldErrorVM> fieldErrors); void add(String objectName, String field, String message); String getMessage(); String get... | ErrorVM implements Serializable { public String getMessage() { return message; } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String message, String description, List<FieldErrorVM> fieldErrors); void add(String objectName, String field, String message); String getMessage(); String get... |
@Test public void getDescriptionTest() throws Exception { assertNull(vm1.getDescription()); assertEquals(description, vm2.getDescription()); assertEquals(description, vm3.getDescription()); assertNull(vm1null.getDescription()); assertNull(vm2null.getDescription()); assertNull(vm3null.getDescription()); } | public String getDescription() { return description; } | ErrorVM implements Serializable { public String getDescription() { return description; } } | ErrorVM implements Serializable { public String getDescription() { return description; } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String message, String description, List<FieldErrorVM> fieldErrors); } | ErrorVM implements Serializable { public String getDescription() { return description; } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String message, String description, List<FieldErrorVM> fieldErrors); void add(String objectName, String field, String message); String getMessage(); St... | ErrorVM implements Serializable { public String getDescription() { return description; } ErrorVM(String message); ErrorVM(String message, String description); ErrorVM(String message, String description, List<FieldErrorVM> fieldErrors); void add(String objectName, String field, String message); String getMessage(); St... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.