### Question:
BasicImportOrganizer implements ImportOrganizer { @Override public OrganizedImports organizeImports(List<Import> imports) { Map<Boolean, ImmutableSortedSet<Import>> partionedByStatic = imports.stream() .collect( Collectors.partitioningBy( Import::isStatic, toImmutableSortedSet(Comparator.comparing(Import::getType)))); return new OrganizedImports() .addGroups(partionedByStatic, order.groupOrder()); } BasicImportOrganizer(StaticOrder order); @Override OrganizedImports organizeImports(List<Import> imports);  }### Answer:
@Test public void testStaticFirstOrdering() { BasicImportOrganizer organizer = new BasicImportOrganizer(StaticOrder.STATIC_FIRST); ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS); assertThat(organized.asImportBlock()) .isEqualTo( "import static android.foo.bar;\n" + "import static com.android.blah.blah;\n" + "import static java.ping.pong;\n" + "import static javax.pong.ping;\n" + "import static net.wilma.flintstone;\n" + "import static unknown.fred.flintstone;\n" + "\n" + "import android.foo;\n" + "import com.android.blah;\n" + "import java.ping;\n" + "import javax.pong;\n" + "import net.wilma;\n" + "import unknown.barney;\n" + "import unknown.fred;\n"); }
@Test public void testStaticLastOrdering() { BasicImportOrganizer organizer = new BasicImportOrganizer(StaticOrder.STATIC_LAST); ImportOrganizer.OrganizedImports organized = organizer.organizeImports(IMPORTS); assertThat(organized.asImportBlock()) .isEqualTo( "import android.foo;\n" + "import com.android.blah;\n" + "import java.ping;\n" + "import javax.pong;\n" + "import net.wilma;\n" + "import unknown.barney;\n" + "import unknown.fred;\n" + "\n" + "import static android.foo.bar;\n" + "import static com.android.blah.blah;\n" + "import static java.ping.pong;\n" + "import static javax.pong.ping;\n" + "import static net.wilma.flintstone;\n" + "import static unknown.fred.flintstone;\n"); }