### Question:
ServerServiceDefinition { public static Builder builder(String serviceName) { return new Builder(serviceName); } private  ServerServiceDefinition(
      ServiceDescriptor serviceDescriptor, Map<String, ServerMethodDefinition<?, ?>> methods); static Builder builder(String serviceName); static Builder builder(ServiceDescriptor serviceDescriptor); ServiceDescriptor getServiceDescriptor(); Collection<ServerMethodDefinition<?, ?>> getMethods(); @Internal ServerMethodDefinition<?, ?> getMethod(String methodName);  }### Answer:
@Test public void addMethod_duplicateName() { ServiceDescriptor sd = new ServiceDescriptor(serviceName, method1); ServerServiceDefinition.Builder ssd = ServerServiceDefinition.builder(sd) .addMethod(method1, methodHandler1); thrown.expect(IllegalStateException.class); ssd.addMethod(diffMethod1, methodHandler2) .build(); }
@Test public void buildMisaligned_extraMethod() { ServiceDescriptor sd = new ServiceDescriptor(serviceName); ServerServiceDefinition.Builder ssd = ServerServiceDefinition.builder(sd) .addMethod(methodDef1); thrown.expect(IllegalStateException.class); ssd.build(); }
@Test public void buildMisaligned_diffMethodInstance() { ServiceDescriptor sd = new ServiceDescriptor(serviceName, method1); ServerServiceDefinition.Builder ssd = ServerServiceDefinition.builder(sd) .addMethod(diffMethod1, methodHandler1); thrown.expect(IllegalStateException.class); ssd.build(); }
@Test public void buildMisaligned_missingMethod() { ServiceDescriptor sd = new ServiceDescriptor(serviceName, method1); ServerServiceDefinition.Builder ssd = ServerServiceDefinition.builder(sd); thrown.expect(IllegalStateException.class); ssd.build(); }