### Question:
LifecyclePhase { @Override public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; List<LifecycleMojo> mojos = getMojos(); if ( mojos != null ) { for ( LifecycleMojo mojo: mojos ) { if ( first ) { first = false; } else { sb.append( ',' ); } sb.append( mojo.getGoal() ); } } return sb.toString(); } LifecyclePhase();  LifecyclePhase( String goals ); List<LifecycleMojo> getMojos(); void setMojos( List<LifecycleMojo> mojos ); void set( String goals ); @Override String toString(); @Deprecated static Map<String, String> toLegacyMap( Map<String, LifecyclePhase> lifecyclePhases );  }### Answer:
@Test public void testToString() { LifecyclePhase phase = new LifecyclePhase(); assertEquals( "", phase.toString() ); LifecycleMojo mojo1 = new LifecycleMojo(); mojo1.setGoal( "jar:jar" ); phase.setMojos( Arrays.asList( mojo1 ) ); assertEquals( "jar:jar", phase.toString() ); LifecycleMojo mojo2 = new LifecycleMojo(); mojo2.setGoal( "war:war" ); phase.setMojos( Arrays.asList( mojo1, mojo2 ) ); assertEquals( "jar:jar,war:war", phase.toString() ); }